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

相关推荐
前端市界9 小时前
前端视角: PyQt6+Vue3 跨界开发实战
前端·qt·pyqt
誰能久伴不乏14 小时前
Qt 动态属性(Dynamic Property)详解
开发语言·qt
枫叶丹415 小时前
【Qt开发】常用控件(四)
开发语言·qt
茉莉玫瑰花茶1 天前
Qt 常用控件 - 9
开发语言·qt
sqmeeting2 天前
QT6 如何在Linux Wayland 桌面系统抓屏和分享屏幕
linux·qt
姓刘的哦2 天前
Win10上Qt使用Libcurl库
开发语言·qt
hellokandy2 天前
QT QVersionNumber 比较版本号大小
qt·版本号·qversionnumber
常乐か2 天前
VS2022+QT5.15.2+OCCT7.9.1的开发环境搭建流程
开发语言·qt·opencascade
誰能久伴不乏2 天前
Qt TCP 客户端对象生命周期与连接断开问题解析
网络·qt·tcp/ip
kyle~2 天前
Qt---Qt函数库
开发语言·qt