当前位置: 首页 > news >正文

网站体验分享中国建筑行业网

网站体验分享,中国建筑行业网,网站建设公司的业务范围,科技感网页模板qt笔记之qml下拉标签组合框增加发送按钮发送标签内容 code review! 文章目录 qt笔记之qml下拉标签组合框增加发送按钮发送标签内容1.运行2.文件结构3.main.qml4.main.cc5.MyClass.h6.MyClass.cc7.CMakeLists.txt8.ComboBox.pro9.qml.qrc 1.运行 2.文件结构 3.main.qml 代码 …qt笔记之qml下拉标签组合框增加发送按钮发送标签内容 code review! 文章目录 qt笔记之qml下拉标签组合框增加发送按钮发送标签内容1.运行2.文件结构3.main.qml4.main.cc5.MyClass.h6.MyClass.cc7.CMakeLists.txt8.ComboBox.pro9.qml.qrc 1.运行 2.文件结构 3.main.qml 代码 import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.Window 2.2Window {visible: truewidth: 640height: 480title: qsTr(QML ComboBox C signal)property string selectedOptionComboBox {id: comboBoxx: 12y: 58width: 147height: 25model: [选项一, 选项二, 选项三]Component.onCompleted: {selectedOption 选项一}onCurrentIndexChanged: {selectedOption comboBox.currentText;}}Button {id: buttonx: 18y: 134text: qsTr(发送)onClicked: {myClass_rename.setValue(selectedOption);}} }4.main.cc 代码 #include MyClass.h #include QGuiApplication #include QQmlApplicationEngine #include QQmlContextQ_DECLARE_METATYPE(MyClass *)int main(int argc, char *argv[]) {QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);QGuiApplication app(argc, argv);QQmlApplicationEngine engine;MyClass myClass;engine.rootContext()-setContextProperty(myClass_rename, myClass);engine.load(QUrl(QStringLiteral(qrc:/main.qml)));if (engine.rootObjects().isEmpty())return -1;return app.exec(); }5.MyClass.h 代码 #ifndef MYCLASS_H #define MYCLASS_H#include QObject #include QString #include QVector #include iomanip #include iostreamclass MyClass : public QObject {Q_OBJECTpublic:explicit MyClass(QObject *parent nullptr);public slots:void setValue(QString value); };#endif // MYCLASS_H6.MyClass.cc 代码 #include MyClass.h #include QDebugMyClass::MyClass(QObject *parent) : QObject(parent) {}void MyClass::setValue(QString value) {qDebug() value value; }7.CMakeLists.txt 代码 cmake_minimum_required(VERSION 2.8.12)project(ComboBox LANGUAGES CXX) set(Qt5_DIR /home/user/Qt/5.15.2/gcc_64/lib/cmake/Qt5) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON)find_package(Qt5 COMPONENTS Core Quick REQUIRED)include_directories( # src*.h )file (GLOB SRCS # src/cc/*.cc*.cc )file (GLOB INCS # src/inc/*.h*.h )add_executable(${PROJECT_NAME} ${SRCS} ${INCS} main.cc qml.qrc)target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Quick -pthread)8.ComboBox.pro 代码 QT quick qml CONFIG c11INCLUDEPATH ./LIBS -L/usr/lib/x86_64-linux-gnu -lz LIBS /usr/lib/x86_64-linux-gnu/libboost_* #LIBS /usr/lib/aarch64-linux-gnu/libboost_*# The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Refer to the documentation for the # deprecated API to know how to port your code away from it. DEFINES QT_DEPRECATED_WARNINGS# You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES QT_DISABLE_DEPRECATED_BEFORE0x060000 # disables all the APIs deprecated before Qt 6.0.0SOURCES \./main.ccRESOURCES ./qml.qrc \ # image.qrc# Additional import path used to resolve QML modules in Qt Creators code model QML_IMPORT_PATH # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH # Default rules for deployment. qnx: target.path /tmp/$${TARGET}/bin else: unix:!android: target.path /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS target9.qml.qrc 代码 RCCqresource prefix/filemain.qml/file/qresource /RCC
http://www.laogonggong.com/news/127574.html

相关文章:

  • 网站建设的相关知识江西建设厅教育网站
  • 网站建设流程策划书珠海移动网站建设费用
  • soho建设外贸网站抖音营销推广
  • 珠海品牌网站设计关于建设公司网站的建议
  • 做外贸哪个网站比较好菠萝菠萝蜜高清免费视频
  • 免费网站电视剧全免费的app做知识付费哪个平台好做
  • 网站会员注册系统源码使用php做网站
  • 如何做电影网站狼视听辽宁网络推广
  • 政务公开网站开发做团膳有哪些网站
  • 怎样给网站做备案郑州网站建设包括哪些
  • 网站开发与建设个人总结优质的企业网站建设
  • 网站开发需要注意什么天猫店铺申请条件及费用
  • 给别人开发一个网站多少钱织梦网站首页目录在哪
  • 学校网站建设方案模板下载黑龙江网站建设企业
  • 湖南建设监理协会网站网站域名备案需要什么
  • 网站建设营销策略php网站怎么注入
  • 南通网站排名外包合肥网站建设方案咨询
  • 建站公司 网站长春网站建设公司
  • 一个空间做多个网站58同城网站建设思路
  • 京津冀协同发展的首要任务有如何结合搜索检索与seo推广
  • iis怎么配置网站wordpress更新一直下载失败
  • 品牌设计网站公司网络优化大师
  • 推荐个在广州做网站的网站建设一般要提供什么内容
  • 网站网站的建设高端网站建设推广
  • 做网站模板赚钱wordpress用户增加插件
  • 哪个软件傻瓜式做网站沈阳市住房和城乡建设厅网站
  • 汕头网站设计有限公司seo推广淘客
  • 泰州专一做淘宝网站如何逐步提升网站权重
  • 网站 关键词 出现频率wordpress升级php
  • 自己建网站写小说网站开发语言用到