An tabbox item may never be bigger than the screen.

BUG: 235143

svn path=/trunk/KDE/kdebase/workspace/; revision=1130011
This commit is contained in:
Martin Gräßlin 2010-05-24 08:00:59 +00:00
parent ba59ddb5b9
commit 612864aed2

View file

@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt
#include <QPainter>
// KDE
#include <kephal/screens.h>
#include <KGlobalSettings>
#include <KIconEffect>
#include <KIconLoader>
@ -58,7 +59,6 @@ void ClientItemDelegate::setConfig(const KWin::TabBox::ItemLayoutConfig& config)
QSize ClientItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
Q_UNUSED( option )
if( !index.isValid() )
return QSize( 0, 0 );
@ -97,6 +97,18 @@ QSize ClientItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QM
height = qMax<qreal>( height, element.iconSize().height() );
}
}
if (!option.rect.isValid())
{
// item may not be bigger than the screen geometry
const QRect screenRect = Kephal::ScreenUtils::screenGeometry( tabBox->activeScreen() );
width = qMin( width, qreal(screenRect.width()) );
height = qMin( height, qreal(screenRect.height()) );
}
else
{
width = qMin( width, qreal(option.rect.width()) );
height = qMin( height, qreal(option.rect.height()) );
}
return QSize( width + left + right, height + top + bottom );
}