28 QList < QPair<Qt::BrushStyle, QString> > styles;
29 styles << qMakePair( Qt::SolidPattern,
tr(
"Solid" ) )
30 << qMakePair( Qt::NoBrush,
tr(
"No Brush" ) )
31 << qMakePair( Qt::HorPattern,
tr(
"Horizontal" ) )
32 << qMakePair( Qt::VerPattern,
tr(
"Vertical" ) )
33 << qMakePair( Qt::CrossPattern,
tr(
"Cross" ) )
34 << qMakePair( Qt::BDiagPattern,
tr(
"BDiagonal" ) )
35 << qMakePair( Qt::FDiagPattern,
tr(
"FDiagonal" ) )
36 << qMakePair( Qt::DiagCrossPattern,
tr(
"Diagonal X" ) )
37 << qMakePair( Qt::Dense1Pattern,
tr(
"Dense 1" ) )
38 << qMakePair( Qt::Dense2Pattern,
tr(
"Dense 2" ) )
39 << qMakePair( Qt::Dense3Pattern,
tr(
"Dense 3" ) )
40 << qMakePair( Qt::Dense4Pattern,
tr(
"Dense 4" ) )
41 << qMakePair( Qt::Dense5Pattern,
tr(
"Dense 5" ) )
42 << qMakePair( Qt::Dense6Pattern,
tr(
"Dense 6" ) )
43 << qMakePair( Qt::Dense7Pattern,
tr(
"Dense 7" ) );
45 setIconSize( QSize( 32, 16 ) );
47 for (
int i = 0; i < styles.count(); i++ )
49 Qt::BrushStyle style = styles.at( i ).first;
50 QString name = styles.at( i ).second;
51 addItem(
iconForBrush( style ), name, QVariant((
int )style ) );
61 return ( Qt::BrushStyle ) itemData( currentIndex() ).toInt();
66 int idx = findData( QVariant((
int )style ) );
67 setCurrentIndex( idx == -1 ? 0 : idx );
72 QPixmap pix( iconSize() );
74 pix.fill( Qt::transparent );
77 QBrush brush( QColor( 100, 100, 100 ), style );
79 QPen pen( Qt::NoPen );
81 p.drawRect( QRect( QPoint( 0, 0 ), iconSize() ) );