23 connect( mAddButton, &QPushButton::clicked,
this, &QgsDashSpaceDialog::mAddButton_clicked );
24 connect( mRemoveButton, &QPushButton::clicked,
this, &QgsDashSpaceDialog::mRemoveButton_clicked );
31 for (
int i = 0; i < ( v.size() - 1 ); ++i )
36 QTreeWidgetItem *entry =
new QTreeWidgetItem();
37 entry->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled );
38 entry->setText( 0, QString::number( dash ) );
39 entry->setText( 1, QString::number( space ) );
40 mDashSpaceTreeWidget->addTopLevelItem( entry );
44 void QgsDashSpaceDialog::mAddButton_clicked()
47 QTreeWidgetItem *entry =
new QTreeWidgetItem();
48 entry->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled );
49 entry->setText( 0, QStringLiteral(
"5" ) );
50 entry->setText( 1, QStringLiteral(
"2" ) );
51 mDashSpaceTreeWidget->addTopLevelItem( entry );
54 void QgsDashSpaceDialog::mRemoveButton_clicked()
57 QTreeWidgetItem *currentItem = mDashSpaceTreeWidget->currentItem();
60 mDashSpaceTreeWidget->takeTopLevelItem( mDashSpaceTreeWidget->indexOfTopLevelItem( currentItem ) );
66 QVector<qreal> dashVector;
67 int nTopLevelItems = mDashSpaceTreeWidget->topLevelItemCount();
68 for (
int i = 0; i < nTopLevelItems; ++i )
70 QTreeWidgetItem *currentItem = mDashSpaceTreeWidget->topLevelItem( i );
73 dashVector << currentItem->text( 0 ).toDouble() << currentItem->text( 1 ).toDouble();
QVector< qreal > dashDotVector() const
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
QgsDashSpaceDialog(const QVector< qreal > &v, QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
Constructor for QgsDashSpaceDialog.