Changeset View
Changeset View
Standalone View
Standalone View
ui/sidebar.cpp
Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Line(s) | 174 | { | |||
---|---|---|---|---|---|
180 | QIcon::Mode iconmode = disabled ? QIcon::Disabled : QIcon::Normal; | 180 | QIcon::Mode iconmode = disabled ? QIcon::Disabled : QIcon::Normal; | ||
181 | painter->drawPixmap( iconpos, icon.pixmap( option.decorationSize, iconmode ) ); | 181 | painter->drawPixmap( iconpos, icon.pixmap( option.decorationSize, iconmode ) ); | ||
182 | } | 182 | } | ||
183 | 183 | | |||
184 | if ( m_showText ) | 184 | if ( m_showText ) | ||
185 | { | 185 | { | ||
186 | QString text = index.data( Qt::DisplayRole ).toString(); | 186 | QString text = index.data( Qt::DisplayRole ).toString(); | ||
187 | QRect fontBoundaries = QFontMetrics( option.font ).boundingRect( text ); | 187 | QRect fontBoundaries = QFontMetrics( option.font ).boundingRect( text ); | ||
188 | fontBoundaries.setWidth( fontBoundaries.width() + ITEM_PADDING ); | ||||
188 | QPoint textPos( | 189 | QPoint textPos( | ||
189 | ITEM_MARGIN_LEFT + ( option.rect.width() - ITEM_MARGIN_LEFT - ITEM_MARGIN_RIGHT - fontBoundaries.width() ) / 2, | 190 | ITEM_MARGIN_LEFT + ( option.rect.width() - ITEM_MARGIN_LEFT - ITEM_MARGIN_RIGHT - fontBoundaries.width() ) / 2, | ||
190 | ITEM_MARGIN_TOP + option.decorationSize.height() + ITEM_PADDING | 191 | ITEM_MARGIN_TOP + option.decorationSize.height() + ITEM_PADDING | ||
191 | ); | 192 | ); | ||
192 | fontBoundaries.translate( -fontBoundaries.topLeft() ); | 193 | fontBoundaries.translate( -fontBoundaries.topLeft() ); | ||
193 | fontBoundaries.translate( textPos ); | 194 | fontBoundaries.translate( textPos ); | ||
194 | fontBoundaries.translate( option.rect.topLeft() ); | 195 | fontBoundaries.translate( option.rect.topLeft() ); | ||
195 | painter->setPen( foreColor ); | 196 | painter->setPen( foreColor ); | ||
▲ Show 20 Lines • Show All 624 Lines • Show Last 20 Lines |