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

相关推荐
IOT-Power1 小时前
QT 对话框(QDialog)中 accept、reject、exec、open的使用
开发语言·qt
_OP_CHEN2 小时前
【从零开始的Qt开发指南】(十九)Qt 文件操作:从 I/O 设备到文件信息,一站式掌握跨平台文件处理
开发语言·c++·qt·前端开发·文件操作·gui开发·qt文件
cn_mengbei3 小时前
鸿蒙PC开发指南:从零配置Qt环境到实战部署完整流程
qt·华为·harmonyos
GREGGXU3 小时前
Could not load the Qt platform plugin “xcb“ in ““ even though it was found.
linux·qt
Summer_Uncle4 小时前
【QT学习】qt项目使用MySQL数据库
数据库·qt·学习
Henry Zhu1234 小时前
Qt样式系统详解(上)
qt
深蓝海拓4 小时前
PySide6从0开始学习的笔记(二十三)使用QRunnable在线程池中执行临时任务
笔记·python·qt·学习·pyqt
嘿嘿潶黑黑5 小时前
关于QButtonGroup 在Qt5和Qt6之间的差异
开发语言·qt
hqwest5 小时前
码上通QT实战09--监控页面01-区域划分
开发语言·qt·layout·qss·qt 布局
mingren_13145 小时前
c++和qml交互
c++·qt·交互