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

相关推荐
水煎包V:YEDIYYDS88814 小时前
QT QML 实现的摇杆按钮,类似王者荣耀 左边方向导航键
qt·qml·摇杆按钮·导航键
winfield82115 小时前
MCP 协议详解
开发语言·网络·qt
秦jh_17 小时前
【Qt】常用控件(上)
服务器·数据库·qt
刃神太酷啦17 小时前
C++ list 容器全解析:从构造到模拟实现的深度探索----《Hello C++ Wrold!》(16)--(C/C++)
java·c语言·c++·qt·算法·leetcode·list
水煎包V:YEDIYYDS88817 小时前
QT modbus 通信教程,把modbus封装到线程单例中,在线程内完成数据收发,解析。把重要数据以信号方式通知到qml层展示,解决UI卡顿
qt·modbus·线程服务
东哥很忙XH18 小时前
python使用PyQt5开发桌面端串口通信
开发语言·驱动开发·python·qt
汪宁宇19 小时前
如何在QT5+MinGW环境中编译使用QGIS开发地图应用
c++·qt·qgis·mingw·地图库
刺客xs20 小时前
Qt-----QSS样式表
开发语言·javascript·qt
qq_4017004120 小时前
QProgressBar+QSS 进度条
qt
小灰灰搞电子1 天前
Qt PDF模块详解
数据库·qt·pdf