1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

QQtDictionary使用节点多类型方法支持fromXML

This commit is contained in:
tianduanrui 2020-03-01 20:50:46 +08:00
parent 845bfd6762
commit 581c8c3e2b
19 changed files with 447 additions and 0 deletions

View File

@ -0,0 +1,91 @@
<PRPM_IN301010UV01 xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ITSVersion="XML_1.0" xsi:schemaLocation="urn:hl7-org:v3 ../multicacheschemas/PRPM_IN301010UV01.xsd">
<id root="040CD76A-ED0E-400B-9FD3-60387BCDE0EB" extension="8bdb804f-b490-45ae-b145-2c897aedff74"/>
<creationTime value="20170921101317"/>
<interactionId root="2.16.840.1.113883.1.6" extension="PRPM_IN301010UV01"/>
<processingCode code="P"/>
<processingModeCode code="I"/>
<acceptAckCode code="AL"/>
<receiver typeCode="RCV">
<telecom/>
<device classCode="DEV" determinerCode="INSTANCE">
<id root="1.2.840.114350.1.13.999.567"/>
</device>
</receiver>
<sender typeCode="SND">
<telecom/>
<device classCode="DEV" determinerCode="INSTANCE">
<id root="1.2.840.114350.1.13.999.234"/>
</device>
</sender>
<controlActProcess classCode="CACT" moodCode="EVN">
<code code="PRPM_TE301010UV01" codeSystem="2.16.840.1.113883.1.6"/>
<subject typeCode="SUBJ">
<registrationRequest classCode="REG" moodCode="RQO">
<statusCode code="active"/>
<subject1 typeCode="SBJ">
<healthCareProvider classCode="PROV">
<!--医务人员ID-->
<id root="2.16.156.10011.1.4" extension="02020"/>
<!--专业技术职务代码-->
<code code="231" displayName="主任医师" codeSystem="2.16.156.10011.2.3.3.10" codeSystemName="专业技术职务代码(GB/T 8561)" codeSystemVersion="GB/T 8561-1988"/>
<!--工作地址-->
<addr>XXXXXXXXX</addr>
<!--工作联系方式:电话、邮箱地址等-->
<telecom value="13800000"/>
<!--角色状态RoleStatus-->
<statusCode code="active"/>
<!--角色有效期间-->
<effectiveTime>
<low value="20170921"/>
<high value="20300921"/>
</effectiveTime>
<healthCarePrincipalPerson classCode="PSN" determinerCode="INSTANCE">
<!--身份证号-->
<id root="2.16.156.10011.1.3" extension="000001010101010101"/>
<!--姓名-->
<name use="L">张三</name>
<!--性别-->
<administrativeGenderCode code="1" codeSystem="2.16.156.10011.2.3.3.4" displayName="男性" codeSystemName="生理性别代码表(GB/T 2261.1)"/>
<!--出生日期-->
<birthTime value="19550727"/>
<!--隶属-->
<asAffiliate classCode="AFFL">
<code/>
<effectiveTime/>
<affiliatedPrincipalOrganization classCode="ORG" determinerCode="INSTANCE">
<!--科室号标识-->
<id root="2.16.156.10011.1.26" extension="0110"/>
<name>重症医学科</name>
</affiliatedPrincipalOrganization>
</asAffiliate>
<!--出生地-->
<birthplace classCode="BIRTHPL">
<addr/>
</birthplace>
</healthCarePrincipalPerson>
</healthCareProvider>
</subject1>
<!--申请者-->
<author typeCode="AUT">
<assignedEntity classCode="ASSIGNED">
<!--医务人员ID-->
<id root="2.16.156.10011.1.4" extension="0058"/>
<assignedPerson classCode="PSN" determinerCode="INSTANCE">
<name>陈维</name>
</assignedPerson>
<representedOrganization classCode="ORG" determinerCode="INSTANCE">
<!--科室号标识-->
<id root="2.16.156.10011.1.26" extension="0508"/>
<name>人事培训科</name>
<contactParty classCode="CON">
<contactPerson classCode="PSN" determinerCode="INSTANCE">
<name>陈维</name>
</contactPerson>
</contactParty>
</representedOrganization>
</assignedEntity>
</author>
</registrationRequest>
</subject>
</controlActProcess>
</PRPM_IN301010UV01>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<person a="1">
<username name="first-name">王哥</username>
<phone-number name="tel-number" type="private">111122211</phone-number>
<phone-number name="tel-number" type="public">22222222</phone-number>
<address key="working_location">北京-xxxx</address>
<sex>M</sex>
<weight>75kg</weight>
</person>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book category="children">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="web">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
<book category="web" gg="good game">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
</bookstore>

View File

@ -0,0 +1,24 @@
/*spinbox 抬起样式*/
QTimeEdit::up-button,QDoubleSpinBox::up-button,QSpinBox::up-button {
subcontrol-origin:border;
subcontrol-position:right;
width: 12px;
}
QTimeEdit::down-button,QDoubleSpinBox::down-button,QSpinBox::down-button {
subcontrol-origin:border;
subcontrol-position:left;
width: 12px;
}
/*按钮按下样式*/
QTimeEdit::up-button:pressed,QDoubleSpinBox::up-button:pressed,QSpinBox::up-button:pressed{
subcontrol-origin:border;
subcontrol-position:right;
width: 12px;
}
QTimeEdit::down-button:pressed,QDoubleSpinBox::down-button:pressed,QSpinBox::down-button:pressed,QSpinBox::down-button:pressed{
subcontrol-position:left;
width: 12px;
}

View File

@ -0,0 +1,89 @@
<?xml version="1.0"?>
<manifest package="org.qtproject.example.qqtdicttest4" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="qqtdicttest4" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="qqtdicttest4" android:screenOrientation="unspecified" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Application arguments -->
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
<!-- Application arguments -->
<meta-data android:name="android.app.lib_name" android:value="qqtdicttest4"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
<!-- Deploy Qt libs as part of package -->
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/>
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
<!-- Run with local libs -->
<meta-data android:name="android.app.use_local_qt_libs" android:value="1"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs" android:value="plugins/platforms/android/libqtforandroid.so"/>
<meta-data android:name="android.app.load_local_jars" android:value="jar/QtAndroid.jar:jar/QtAndroid-bundled.jar"/>
<meta-data android:name="android.app.static_init_classes" android:value=""/>
<!-- Messages maps -->
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<!-- Messages maps -->
<!-- Splash screen -->
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
<!-- Splash screen -->
<!-- Background running -->
<!-- Warning: changing this value to true may cause unexpected crashes if the
application still try to draw after
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<!-- Background running -->
<!-- auto screen scale factor -->
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
<!-- auto screen scale factor -->
<!-- extract android style -->
<!-- available android:values :
* full - useful QWidget & Quick Controls 1 apps
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
* none - useful for apps that don't use any of the above Qt modules
-->
<meta-data android:name="android.app.extract_android_style" android:value="full"/>
<!-- extract android style -->
</activity>
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features. -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- %%INSERT_PERMISSIONS -->
<!-- %%INSERT_FEATURES -->
<uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -0,0 +1,11 @@
#include "mainwindow.h"
#include <QQtApplication>
int main ( int argc, char* argv[] )
{
QQtApplication a ( argc, argv );
MainWindow w;
w.show();
return a.exec();
}

View File

@ -0,0 +1,51 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFile>
#include <qqtdictionary.h>
#define p3line() qDebug().space()
MainWindow::MainWindow ( QWidget* parent ) :
QMainWindow ( parent ),
ui ( new Ui::MainWindow )
{
ui->setupUi ( this );
QFile file ( "b.xml" );
file.open ( QFile::ReadOnly );
QByteArray bytes = file.readAll();
file.close();;
QQtDictionary dict;
dict.fromXML ( bytes );
p3line() << "root:" << dict;
#if 1
p3line() << "xml:" << dict["xml"];
p3line() << "person:" << dict["person"];
p3line() << "phone-number:" << dict["person"]["phone-number"];
p3line() << "address:" << dict["person"]["address"];
p3line() << "username:" << dict["person"]["username"];
//节点多类型!
dict["person"]["phone-number"].setType ( QQtDictionary::DictMap );
p3line() << "phone-number:" << dict["person"]["phone-number"]["__attributes__"];
dict["person"]["phone-number"].setType ( QQtDictionary::DictValue );
p3line() << "phone-number:" << dict["person"]["phone-number"];
#elif 1
p3line() << "xml:" << dict["xml"];
p3line() << "book:" << dict["bookstore"]["book"];
p3line() << "book:" << dict["bookstore"]["book"]["__attributes__"];
#else
p3line() << "PRPM_IN301010UV01:" << dict["PRPM_IN301010UV01"];
p3line() << "PRPM_IN301010UV01:" << dict["PRPM_IN301010UV01"]["id"];
p3line() << "PRPM_IN301010UV01:" << dict["PRPM_IN301010UV01"]["controlActProcess"];
#endif
}
MainWindow::~MainWindow()
{
delete ui;
}

View File

@ -0,0 +1,22 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>qqtdicttest4</string>
</property>
<widget class="QWidget" name="centralWidget"/>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>17</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,73 @@
#-------------------------------------------------
#
# Project created by QtCreator 2018-10-06T08:16:10
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = qqtdicttest4
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use 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_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
include($${PWD}/../../multi-link/add_base_manager.pri)
#-------------------------------------------------
#用户工程配置
#-------------------------------------------------
add_version(1,0,0,0)
add_deploy()
add_deploy_config($${PWD}/AppRoot)
add_dependent_manager(QQt)
system(touch main.cpp)
#-------------------------------------------------
#用户工程配置
#-------------------------------------------------
equals(QSYS_PRIVATE, macOS) {
CONFIG += app_bundle
}
contains(QSYS_PRIVATE, Android|AndroidX86) {
CONFIG += mobility
MOBILITY =
DISTFILES += \
android/AndroidManifest.xml
ANDROID_PACKAGE_SOURCE_DIR = $${PWD}/android
}
message ($${TARGET} config $${CONFIG})
message ($${TARGET} DEFINE $${DEFINES})
message ($${TARGET} prelink $${QMAKE_PRE_LINK})
message ($${TARGET} postlink $${QMAKE_POST_LINK})
add_file(AppRoot/a.xml)
add_file(AppRoot/b.xml)
add_file(AppRoot/c.xml)
OTHER_FILES += AppRoot/a.xml
OTHER_FILES += AppRoot/b.xml
OTHER_FILES += AppRoot/c.xml