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_Yanan1 天前
Qt线程使用(一)直接继承QThread类
开发语言·c++·qt·ui
宠..1 天前
Qt 6 详细介绍
开发语言·qt
xxp43211 天前
Qt 多线程
开发语言·qt
一叶之秋14121 天前
Qt中的信号与槽
qt
开始了码1 天前
QT::键盘事件简单介绍
qt
lijiatu100861 天前
[C++ ]qt槽函数及其线程机制
c++·qt
i***17181 天前
使用 Qt 插件和 SQLCipher 实现 SQLite 数据库加密与解密
数据库·qt·sqlite
遇到困难睡大觉哈哈1 天前
HarmonyOS IPC/RPC 实战:用 ArkTS 跑通 Proxy–Stub 整条链路
qt·rpc·harmonyos·鸿蒙
寻找华年的锦瑟1 天前
Qt-视频九宫格布局
开发语言·qt
雨田哥1 天前
Qt AFSim雷达探测显示
qt·afsim·qt雷达·qt仿真·雷达显控端·qt雷达模拟器