20 #include <QApplication> 26 int textMinWidth = fontMetrics().width( mText );
27 mTextHeight = fontMetrics().height();
29 mMinWidth = 2 * mLabelMargin + textMinWidth;
30 setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
36 return QSize( mMinWidth, mTextHeight + mLabelMargin );
41 return QSize( mMinWidth, mTextHeight + mLabelMargin );
46 QPainter painter(
this );
47 QPalette
pal = QPalette( qApp->palette() );
48 QColor headerBgColor = pal.color( QPalette::Mid );
49 QColor headerTextColor = pal.color( QPalette::BrightText );
52 painter.setBrush( headerBgColor );
53 painter.setPen( Qt::NoPen );
54 painter.drawRect( QRect( 0, 0, width(), mTextHeight + mLabelMargin ) );
57 painter.setPen( headerTextColor );
58 painter.drawText( QPoint( mLabelMargin, 0.25 * mLabelMargin + mTextHeight ), mText );
63 : QWidgetAction( parent )
66 setDefaultWidget( w );
static const double UI_SCALE_FACTOR
UI scaling factor.