21 #include <QApplication> 27 int textMinWidth = fontMetrics().width( mText );
28 mTextHeight = fontMetrics().height();
30 mMinWidth = 2 * mLabelMargin + textMinWidth;
31 setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
37 return QSize( mMinWidth, mTextHeight + mLabelMargin );
42 return QSize( mMinWidth, mTextHeight + mLabelMargin );
47 QPainter painter(
this );
48 QPalette
pal = QPalette( qApp->palette() );
49 QColor headerBgColor = pal.color( QPalette::Mid );
50 QColor headerTextColor = pal.color( QPalette::BrightText );
53 painter.setBrush( headerBgColor );
54 painter.setPen( Qt::NoPen );
55 painter.drawRect( QRect( 0, 0, width(), mTextHeight + mLabelMargin ) );
58 painter.setPen( headerTextColor );
59 painter.drawText( QPoint( mLabelMargin, 0.25 * mLabelMargin + mTextHeight ), mText );
64 : QWidgetAction( parent )
67 setDefaultWidget( w );
static const double UI_SCALE_FACTOR
UI scaling factor.