ZIPQML使用C++定义枚举 5.85KB

shorlly

资源文件列表:

EnumTester.zip 大约有9个文件
  1. EnumTester/
  2. EnumTester/EnumTest.qml 1.95KB
  3. EnumTester/EnumTester.pro 696B
  4. EnumTester/EnumTester.pro.user 19.27KB
  5. EnumTester/EnumTester.qrc 96B
  6. EnumTester/main.cpp 380B
  7. EnumTester/mainwindow.cpp 1.2KB
  8. EnumTester/mainwindow.h 818B
  9. EnumTester/mainwindow.ui 723B

资源介绍:

QML使用C++定义枚举样例代码
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QVBoxLayout> #include <QMessageBox> #include <QObject> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); initQmlWidget(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::initQmlWidget() { m_pQmlView = new QQuickView(); m_pQmlView->setSource(QUrl("qrc:/EnumTest.qml")); m_pQmlPanel = (QQuickWidget*)QWidget::createWindowContainer(m_pQmlView,this); m_pContext = m_pQmlView->rootContext(); m_pQmlPanel->show(); } void MainWindow::resizeEvent(QResizeEvent* e) { m_pQmlPanel->setGeometry(rect()); m_pContext->setContextProperty("appMainWindow", this); } void MainWindow::callFun(FunType funType) { QString strMsg = tr("当前颜色"); switch(funType){ case FunType::RED: strMsg += tr("红色"); break; case FunType::YELLOW: strMsg += tr("黄色"); break; case FunType::BLUE: strMsg += tr("蓝色"); break; default: strMsg += QStringLiteral("无选项"); } QMessageBox::information(this,"info",strMsg); }
100+评论
captcha
    类型标题大小时间
    ZIPpyinstall相关依赖pyinstall相关依赖1.4MB8月前
    ZIP超级终端软件(hypertrm)194.69KB8月前
    ZIP连接器SMA-KD(弯针)带PCB利用HFSS仿真实例10.06MB8月前
    ZIP任务悬赏平台H5源码2024最新会员裂变三级分销,原价3888元现免费送4.5MB8月前
    ZIP手机播放器 (1).zip608B8月前
    ZIP准初三暑期逆袭指南、资料.zip2.94MB8月前
    ZIPMAT(Memory Analyzer Tool)66.65MB8月前
    ZIPwindows版软件开发常用小工具.zip4.62MB8月前