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

相关推荐
天涯路s12 分钟前
qt怎么自定义日志
开发语言·qt
四维碎片2 小时前
【Qt】QTimer 学习笔记总结
笔记·qt·学习
qq_401700414 小时前
理解与优化Qt信号槽机制提高性能优化
qt
蚂蚁取经4 小时前
Qt C++ 小部件 QCustomPlot 的使用
c++·qt·信息可视化
龚建波4 小时前
《QDebug 2025年11月》
qt
Source.Liu4 小时前
【LibreCAD】RS2 模块完整解析
qt·cad
Source.Liu5 小时前
【学写LibreCAD】单位转换系统 Rust 实现
qt·rust·cad
一只小bit5 小时前
Qt 信号与槽:信号产生与处理之间的重要函数
前端·c++·qt·cpp·页面
偶像你挑的噻5 小时前
1.Qt-编译器基本知识介绍
开发语言·qt
透明的玻璃杯6 小时前
VS2015 +QT5.9.9 环境问题注意事项
开发语言·qt