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

相关推荐
韭菜炒鸡肝天11 小时前
VTK开发笔记(一):VTK介绍,Qt..+VSx+VTK.编译
开发语言·笔记·qt
刀法孜然13 小时前
QT5.12.8开发中使用触摸屏,配置的环境变量,imx6ullpro开发板qt开发
qt
回眸不遇18 小时前
详谈 QT 布局 QLayout::SizeConstraint 和 QSizePolicy 对 QWidget 尺寸的影响
数据库·qt·系统架构
Richard.Wong1 天前
qt生成dll供C#调用
开发语言·qt
Infedium2 天前
Qt嵌入式开发核心亮点:线程安全硬件交互技术
开发语言·qt
秋田君2 天前
QT_QInputDialog类输入对话框
开发语言·qt
秋田君2 天前
QT_QFontDialog类字体对话框
开发语言·qt
mabing9933 天前
Qt QMessageBox、QDialogButtonBox中英文翻译动态切换
开发语言·qt
秋田君3 天前
QT_QColorDialog颜色对话框
java·数据库·qt
秋田君3 天前
QT_QT布局常用类QSplitter窗口分割类与QDockWidget窗口停靠类
开发语言·数据库·qt