Qt Quick custom styles and qtquick custom styles

Source: Internet
Author: User

Qt Quick custom styles and qtquick custom styles

After a few months of Qt development, I mainly write the host computer program and some tools used by the factory. The boss's requirement is fast, stable, and no problem, but he thinks too much. net installation and upgrade (due to this small problem at the beginning), it is really hard to develop the MFC, so let me find a lightweight, easy-to-use and convenient deployment framework, if you can't find it, you can simply use Qt. At least this is much more convenient than MFC development. Before that, it took some time to write a set of UI and complete some code that can be copied. With the basic code accumulation, writing tools now saves a lot of trouble, basically copying, modifying, and writing logic. Here we will release the UI. Whoever wants to use it, even though it will be modified, I don't have time and energy to maintain it.

The following is a Demo diagram. There may be problems with the border shadow on XP. It took some time but it didn't solve it. Later, the boss said it didn't matter. You can use win7, so you don't have to pay for it, after all, it takes effort and time to solve the problem, and it is impossible to solve other problems.

Import QtQuick 2.3 import QtQuick. controls 1.2 import QtQuick. window 2.0 import QtQuick. layouts 1.1 import QtGraphicalEffects 1.0 import XA. controls 1.0 import QtQuick. controls. styles 1.2 import "theme" as MyThemeFussWindow {id: mainWin MyTheme. versionDialog {id: versionDialog;} visible: true width: 800 height: 600 title: qsTr ("a set of common controls for QtQuick") titleMenu: Menu {style: MyTheme. menuStyle {}_ _ yOffset: 4 MenuItem {text: "updated"} MenuItem {text: "about" onTriggered: {versionDialog. show () ;}} layoutComponent: Rectangle {id: rectangle_root color: "transparent" anchors. fill: parent

MyTheme. HeaderItem {
Title: "CheckBox"
Content: Column {
Spacing: 10
ExclusiveGroup {id: checkBoxGroup}
CheckBox {
Style: MyTheme. CheckBoxStyle {}
Width: 120
Text: "check box 1"
ExclusiveGroup: checkBoxGroup
}
CheckBox {
Style: MyTheme. CheckBoxStyle {}
Width: 120
Text: "check box 2"
ExclusiveGroup: checkBoxGroup
}
CheckBox {
Style: MyTheme. CheckBoxStyle {}
Width: 120
Text: "check box 3"
}
}
}
}}

Import QtQuick 2.0 import QtQuick. window 2.0 import XA. controls 1.0 import QtQuick. layouts 1.1 FussWindow {visible: false width: 300 height: 180 minimumWidth: 300 maximumWidth: 300 minimumHeight: 180 maximumHeight: 180 title: qsTr ("") modality: Qt. windowModal showMaxButton: false property color textColor: "#202020" layoutComponent: Rectangle {color: "transparent" anchors. fill: parent GridLayout {anchors. centerIn: parent columns: 2 rows: 2 rowSpacing: 10 Text {text: qsTr ("product:") color: textColor} Text {Layout. column: 1 text: qsTr ("QtQuick style Demo 1.0.0.0") color: textColor} Text {Layout. row: 1 text: qsTr ("Copyright:") color: textColor} Text {Layout. row: 1 Layout. column: 1 text: qsTr ("(c) XAircraft. all right reserved. ") color: textColor }}}}

Demo code structure. Note that the plug-in and the exe program must be put together during runtime.

 

The following figure shows the deployment structure of the previous PC program.

The content in qmldir is

Module XA. Controls
Plugin Controls

UI style source code: Download

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.