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

相关推荐
小徐不徐说6 小时前
Qt 线程迁移机制完整实战指南(moveToThread)
开发语言·c++·qt·程序设计
Traveler飞6 小时前
Ubuntu20.04 VMware 黑屏无法进入桌面,Ctrl+Alt+F2 可以进入终端,最终发现是磁盘空间满了
qt·ubuntu
m0_587098991 天前
Qt,二进制文件读写建议
开发语言·qt
秋田君1 天前
QT_QT信号与槽机制
开发语言·数据库·qt
辞旧 lekkk1 天前
【Qt】 系统相关:事件与定时器
开发语言·qt·学习·萌新
HAPPY酷1 天前
【ROS2】VMware + Docker 运行 Gazebo 崩溃与“假死”排查实录
qt·docker·容器
初阳7851 天前
【Qt】界面优化(1)——QSS
开发语言·qt
Irissgwe1 天前
第六章 界面优化
qt
必须得开心呀2 天前
QT解决中文乱码问题
开发语言·qt
熊猫_豆豆2 天前
QT6 Android C++ 自制美观闹钟
android·c++·qt·闹钟