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

相关推荐
Larry_Yanan22 分钟前
QML学习笔记(四十八)QML与C++交互:QML中可实例化C++对象
c++·笔记·qt·学习·ui·交互
伐尘5 小时前
【Qt】实现单例程序,禁止程序多开的几种方式
qt
2501_9387802814 小时前
《轨道交通检测系统中 Qt 与数据库交互的优化方案》
数据库·qt·交互
非得登录才能看吗?14 小时前
Qt 外观之Qt样式表(QSS)
qt
LNN202215 小时前
Qt creator +Valgrind检测内存泄漏(linux)
linux·开发语言·qt
奔跑吧 android18 小时前
【Docker】【03.使用docker搭建ubuntu20.04 Qt5.12 开发环境】
qt·docker·ubuntu20.04·qt5.12
扶尔魔ocy1 天前
【QT常用技术讲解】可拖拽文件的Widget--QListWidget
开发语言·qt
枫叶丹41 天前
【Qt开发】布局管理器(一)-> QVBoxLayout垂直布局
开发语言·c++·qt
Larry_Yanan1 天前
QML学习笔记(四十七)QML与C++交互:上下文对象
c++·笔记·qt·学习·ui
上去我就QWER2 天前
深入理解 Qt 信号槽机制
qt