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

相关推荐
ae_zr3 小时前
QT动态编译应用后,如何快速获取依赖
开发语言·qt
LYOBOYI1234 小时前
qml的对象树机制
c++·qt
菜鸟小芯4 小时前
Qt Creator 集成开发环境下载安装
开发语言·qt
牵牛老人8 小时前
Qt中集成 MQTT 来实现物联网通信:从原理到实战全解析
开发语言·qt·物联网
LYOBOYI1238 小时前
qml的布局策略
c++·qt
小小码农Come on10 小时前
QT常用控件:QListWidget
开发语言·qt
侯孟禹10 小时前
Gemini写的抠图工具
qt·opencv
空空空空空空空空空空空空如也11 小时前
QT通过编译宏区分x86 linux arm的方法
linux·开发语言·qt
四维碎片21 小时前
【Qt】UDP跨平台调试工具
qt·学习·udp
踏过山河,踏过海1 天前
【用ui文件做个简单工具的开发,为什么修改完ui后,程序重新编译运行后,GUI界面还是不变呢?】
qt·ui