29 QList < QPair<Qt::PenStyle, QString> > styles;
30 styles << qMakePair( Qt::SolidLine,
tr(
"Solid Line" ) )
31 << qMakePair( Qt::NoPen,
tr(
"No Pen" ) )
32 << qMakePair( Qt::DashLine,
tr(
"Dash Line" ) )
33 << qMakePair( Qt::DotLine,
tr(
"Dot Line" ) )
34 << qMakePair( Qt::DashDotLine,
tr(
"Dash Dot Line" ) )
35 << qMakePair( Qt::DashDotDotLine,
tr(
"Dash Dot Dot Line" ) );
37 setIconSize( QSize( 32, 12 ) );
39 for (
int i = 0; i < styles.count(); i++ )
41 Qt::PenStyle style = styles.at( i ).first;
42 QString name = styles.at( i ).second;
43 addItem(
iconForPen( style ), name, QVariant((
int ) style ) );
49 return ( Qt::PenStyle ) itemData( currentIndex() ).toInt();
54 int idx = findData( QVariant((
int ) style ) );
55 setCurrentIndex( idx == -1 ? 0 : idx );
60 QPixmap pix( iconSize() );
62 pix.fill( Qt::transparent );
68 double mid = iconSize().height() / 2.0;
69 p.drawLine( 0, mid, iconSize().width(), mid );
83 addItem( QIcon( path +
"/join_bevel.png" ),
tr(
"Bevel" ), QVariant( Qt::BevelJoin ) );
84 addItem( QIcon( path +
"/join_miter.png" ),
tr(
"Miter" ), QVariant( Qt::MiterJoin ) );
85 addItem( QIcon( path +
"/join_round.png" ),
tr(
"Round" ), QVariant( Qt::RoundJoin ) );
90 return ( Qt::PenJoinStyle ) itemData( currentIndex() ).toInt();
95 int idx = findData( QVariant( style ) );
96 setCurrentIndex( idx == -1 ? 0 : idx );
104 : QComboBox( parent )
107 addItem( QIcon( path +
"/cap_square.png" ),
tr(
"Square" ), QVariant( Qt::SquareCap ) );
108 addItem( QIcon( path +
"/cap_flat.png" ),
tr(
"Flat" ), QVariant( Qt::FlatCap ) );
109 addItem( QIcon( path +
"/cap_round.png" ),
tr(
"Round" ), QVariant( Qt::RoundCap ) );
114 return ( Qt::PenCapStyle ) itemData( currentIndex() ).toInt();
119 int idx = findData( QVariant( style ) );
120 setCurrentIndex( idx == -1 ? 0 : idx );