21 #include <QApplication>
27 const int textMinWidth = fontMetrics().boundingRect( mText ).width();
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 const QPalette
pal = QPalette( qApp->palette() );
49 const QColor headerBgColor =
pal.color( QPalette::Mid );
50 const 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.