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

相关推荐
奇树谦1 天前
Qt Quick 图片加载与 GPU 纹理机制详解:QImage、QQuickTextureFactory、QSGTexture 与异步加载
开发语言·qt·系统架构
BroNekoX2 天前
我将基于 QtQuick 框架开发的音乐播放器性能做到顶级
qt
小小晓.2 天前
Qt 对话框、QLineEdit 与布局管理实战详解
开发语言·qt
扶尔魔ocy3 天前
【QT入门到晋级】用开源的自定义控件开发
c++·qt·自定义控件
lhbweilai3 天前
QT项目(串口助手)
开发语言·qt
小鱼仙官4 天前
Qt 主界面弹出分界面
开发语言·qt
誰能久伴不乏4 天前
用 UDP 做一条“可靠“的控制通道
c++·qt·网络协议·udp
Bczheng14 天前
VS2022 安装MFC和QT
c++·qt·mfc
会编程的小孩4 天前
8.19号函数
qt
蓝祁子yoky5 天前
Qt学习日记 Day15:网络编程(二)- UDP基础
网络·qt·学习