29 QList < QPair<Qt::BrushStyle, QString> > styles;
30 styles << qMakePair( Qt::SolidPattern, tr(
"Solid" ) )
31 << qMakePair( Qt::NoBrush, tr(
"No Brush" ) )
32 << qMakePair( Qt::HorPattern, tr(
"Horizontal" ) )
33 << qMakePair( Qt::VerPattern, tr(
"Vertical" ) )
34 << qMakePair( Qt::CrossPattern, tr(
"Cross" ) )
35 << qMakePair( Qt::BDiagPattern, tr(
"BDiagonal" ) )
36 << qMakePair( Qt::FDiagPattern, tr(
"FDiagonal" ) )
37 << qMakePair( Qt::DiagCrossPattern, tr(
"Diagonal X" ) )
38 << qMakePair( Qt::Dense1Pattern, tr(
"Dense 1" ) )
39 << qMakePair( Qt::Dense2Pattern, tr(
"Dense 2" ) )
40 << qMakePair( Qt::Dense3Pattern, tr(
"Dense 3" ) )
41 << qMakePair( Qt::Dense4Pattern, tr(
"Dense 4" ) )
42 << qMakePair( Qt::Dense5Pattern, tr(
"Dense 5" ) )
43 << qMakePair( Qt::Dense6Pattern, tr(
"Dense 6" ) )
44 << qMakePair( Qt::Dense7Pattern, tr(
"Dense 7" ) );
49 for (
int i = 0; i < styles.count(); i++ )
51 const Qt::BrushStyle style = styles.at( i ).first;
52 const QString name = styles.at( i ).second;
53 addItem(
iconForBrush( style ), name, QVariant(
static_cast<int>( style ) ) );
63 return ( Qt::BrushStyle ) currentData().toInt();
68 const int idx = findData( QVariant(
static_cast<int>( style ) ) );
69 setCurrentIndex( idx == -1 ? 0 : idx );
76 pix.fill( Qt::transparent );
79 const QBrush brush( QColor( 100, 100, 100 ), style );
81 const QPen pen( Qt::NoPen );
83 p.drawRect( QRect( QPoint( 0, 0 ),
iconSize() ) );
Qt::BrushStyle brushStyle() const
QIcon iconForBrush(Qt::BrushStyle style)
QgsBrushStyleComboBox(QWidget *parent=nullptr)
void setBrushStyle(Qt::BrushStyle style)
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...