diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-20 06:16:11 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-20 06:16:11 +0000 |
commit | 0369eb65aa64440d34c975eea79da600abc1ee2b (patch) | |
tree | 0a23c265bf013c11bb885b4e40136a0aa5170d37 /kdeui | |
parent | 3033222c21d070743c3153b52e38fade9769208a (diff) | |
download | tdelibs-0369eb65aa64440d34c975eea79da600abc1ee2b.tar.gz tdelibs-0369eb65aa64440d34c975eea79da600abc1ee2b.zip |
Add ability to use old style rectangular icon text boxes
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1177312 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeui')
-rw-r--r-- | kdeui/kiconview.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/kdeui/kiconview.cpp b/kdeui/kiconview.cpp index 98d608fba..13b6183ad 100644 --- a/kdeui/kiconview.cpp +++ b/kdeui/kiconview.cpp @@ -247,7 +247,7 @@ void KIconView::emitExecute( TQIconViewItem *item, const TQPoint &pos ) m_pAutoSelect->stop(); - //Don´t emit executed if in SC mode and Shift or Ctrl are pressed + //Don�t emit executed if in SC mode and Shift or Ctrl are pressed if( !( m_bUseSingle && ((keybstate & ShiftButton) || (keybstate & ControlButton)) ) ) { setSelected( item, false ); viewport()->unsetCursor(); @@ -467,6 +467,8 @@ KIconViewItem::~KIconViewItem() void KIconViewItem::calcRect( const TQString& text_ ) { + bool drawRoundedRect = KGlobalSettings::iconUseRoundedRect(); + Q_ASSERT( iconView() ); if ( !iconView() ) return; @@ -548,7 +550,10 @@ void KIconViewItem::calcRect( const TQString& text_ ) r = m_wordWrap->boundingRect(); int realWidth = QMAX( QMIN( r.width() + 4, tw ), fm->width( "X" ) ); - itemTextRect.setWidth( realWidth + 2); + if (drawRoundedRect == true) + itemTextRect.setWidth( realWidth + 2); + else + itemTextRect.setWidth( realWidth ); itemTextRect.setHeight( r.height() ); int w = 0; int h = 0; int y = 0; @@ -699,13 +704,23 @@ void KIconViewItem::paintPixmap( TQPainter *p, const TQColorGroup &cg ) void KIconViewItem::paintText( TQPainter *p, const TQColorGroup &cg ) { - int textX = textRect( false ).x() + 4; + bool drawRoundedRect = KGlobalSettings::iconUseRoundedRect(); + int textX; + if (drawRoundedRect == true) + textX = textRect( false ).x() + 4; + else + textX = textRect( false ).x() + 2; int textY = textRect( false ).y(); if ( isSelected() ) { + if (drawRoundedRect == true) { p->setBrush(TQBrush(cg.highlight())); p->setPen(TQPen(cg.highlight())); - p->drawRoundRect( textRect( false ) ,1000/textRect(false).width(),1000/textRect(false).height() ); + p->drawRoundRect( textRect( false ) ,1000/textRect(false).width(),1000/textRect(false).height() ); + } + else { + p->fillRect( textRect( false ), cg.highlight() ); + } p->setPen( TQPen( cg.highlightedText() ) ); } else { if ( iconView()->itemTextBackground() != NoBrush ) |