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

相关推荐
ShineWinsu1 天前
对于Qt:信号与槽的解析
c++·qt·gui·lambda·信号·信号与槽·槽函数
努力实干2 天前
Qt/C++ 模块化设计与工程组织
开发语言·c++·qt
Lhan.zzZ2 天前
Qt:动态库模块框架设计
开发语言·c++·qt
qq_401700412 天前
TCP 长连接、心跳包与断线自动重连设计:工业级通信的“不死鸟”架构
网络·qt·tcp/ip
dyxal3 天前
A2A 协议 v1.0 完全指南:方法名、Agent Card、三种绑定与 FastAPI 实战
开发语言·qt·fastapi
金色熊族3 天前
在Qt中使用asan检测内存泄漏(一)
linux·qt·asan
前行中的小猪3 天前
Qt 5 踩坑实录:多显示器跨屏拖拽导致窗口异常放大与 setGeometry 报错的深度解析与根治
qt·多显示器·高分辨率·多屏幕
想做小南娘,发现自己是女生喵3 天前
QT项目实战第一周(嵌入式)
开发语言·qt
誰能久伴不乏3 天前
【无标题】
c++·qt·机器人
金色熊族3 天前
在Qt中使用asan检测内存泄漏(二)--检查依赖库的内存使用
linux·qt·asan