Qt画虚线

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还没做

相关推荐
Quz5 小时前
QML Page:把 Page 装进切换容器里
qt
秋田君5 小时前
Qt_串口编程
开发语言·qt
励志不掉头发的内向程序员7 小时前
【LibreCAD 2D架构】从两个坐标到图形实体:RS_ActionDrawLine如何创建RS_Line
开发语言·c++·qt·学习·系统架构
似水এ᭄往昔7 小时前
【Qt】--常用控件(按钮类控件)
开发语言·qt
_林枭_18 小时前
ZW3D二次开发_原生表单_如何设置表单左上角图标
qt·zw3d
Quz1 天前
QML 快捷键篇:基础快捷键与组合键序列
qt·qml
≮傷£≯√1 天前
Qt 面试(一)
qt·ffmpeg·音视频
西西弗Sisyphus1 天前
Qt 分类导航区的实现
开发语言·qt
galaxy_strive1 天前
Qt C++插件化编写项目(1)
开发语言·c++·qt
kaixin_learn_qt_ing2 天前
Qt Model/View
qt