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

相关推荐
C++ 老炮儿的技术栈13 小时前
main函数之后的调用
c语言·c++·人工智能·qt·mfc·c
沫璃染墨18 小时前
《Qt从零入门系列(十二):Qt文件操作详解——从QFile读写到QFileInfo与记事本实战》
开发语言·网络·c++·qt·交互·信号处理·文件
时间的拾荒人19 小时前
Qt 界面布局与容器控件详解:从分组框到布局管理器
开发语言·qt·面试
王铭诗21 小时前
QT界面安装
qt
程序员老陆21 小时前
嵌入式 Qt:QWidgets 还是 QML / Qt Quick?
开发语言·qt
待什么青丝1 天前
【外设】之大彩串口显示屏
单片机·qt·显示器
Frank_refuel1 天前
深入理解RpcRouter(远端调用模块)
开发语言·qt
Quz2 天前
QML 分隔线:Rectangle、菜单与工具栏分隔线用法
qt
Quz2 天前
QML PathView 入门:直线路径与曲线路径
qt
实心儿儿2 天前
Qt — 音视频文件
qt·音视频