mainwindow.cpp
cpp
{
QComboBox *comboBox_penStyle = new QComboBox;
QStringList SL_penStyle;
SL_penStyle << "______" << "----------" << ".........." << "-.-.-.-.-." << "-..-..-..-.." << "CustomDashLine";
comboBox_penStyle->addItems(SL_penStyle);
ui->mainToolBar->addWidget(comboBox_penStyle);
connect(comboBox_penStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox_penStyle_changed(int)));
}
void MainWindow::comboBox_penStyle_changed(int index)
{
Qt::PenStyle ps = static_cast<Qt::PenStyle>(index + 1);
imageWidget->pen.setStyle(ps);
}
CustomDashLine还没做