diff --git a/src/core/qtuidocument.cpp b/src/core/qtuidocument.cpp index 5cf6be39..adfd8401 100644 --- a/src/core/qtuidocument.cpp +++ b/src/core/qtuidocument.cpp @@ -263,8 +263,8 @@ QVariant QtUiWidget::getProperty(const QString &name) const } /*! - * \qmlmethod QtUiWidget::addProperty(string name, var value, object attributes = {}) - * Adds a new property with the given `name`, `value` and `attributes`. + * \qmlmethod QtUiWidget::addProperty(string name, var value, object attributes = {}, bool userProperty = false) + * Adds a new property with the given `name`, `value`, `attributes` and `userProperty`. * * Attributes is a has object, where the key is the attribute name and the value is the attribute value. * For example: @@ -272,13 +272,15 @@ QVariant QtUiWidget::getProperty(const QString &name) const * ``` * widget.setProperty("text", "My text", { "comment": "some comment for translation" }); * ``` + * Set userProperty to true if you doesn't want to generate property. */ -void QtUiWidget::addProperty(const QString &name, const QVariant &value, const QHash &attributes) +void QtUiWidget::addProperty(const QString &name, const QVariant &value, const QHash &attributes, + bool userProperty) { LOG("QtUiWidget::addProperty", name, value); - const auto result = - qobject_cast(parent())->uiWriter()->addWidgetProperty(m_widget, name, value, attributes); + const auto result = qobject_cast(parent())->uiWriter()->addWidgetProperty(m_widget, name, value, + attributes, userProperty); switch (result) { case Utils::QtUiWriter::Success: diff --git a/src/core/qtuidocument.h b/src/core/qtuidocument.h index 5adfc0c6..0b921fc5 100644 --- a/src/core/qtuidocument.h +++ b/src/core/qtuidocument.h @@ -40,7 +40,7 @@ class QtUiWidget : public QObject Q_INVOKABLE QVariant getProperty(const QString &name) const; Q_INVOKABLE void addProperty(const QString &name, const QVariant &value, - const QHash &attributes = {}); + const QHash &attributes = {}, bool userProperty = false); public slots: void setName(const QString &newName); diff --git a/src/rccore/rc_write.cpp b/src/rccore/rc_write.cpp index 4ac7ab8e..31e4df5a 100644 --- a/src/rccore/rc_write.cpp +++ b/src/rccore/rc_write.cpp @@ -125,7 +125,7 @@ static void writeWidget(Utils::QtUiWriter &writer, const Widget &widget, pugi::x { auto widgetNode = writer.addWidget(widget.className, widget.id, parent); - writer.addWidgetProperty(widgetNode, "mfc_id", widget.id, {{"notr", "true"}}); + writer.addWidgetProperty(widgetNode, "mfc_id", widget.id, {{"notr", "true"}}, true); writer.addWidgetProperty(widgetNode, "geometry", widget.geometry); for (const auto &property : widget.properties.asKeyValueRange()) { diff --git a/src/utils/qtuiwriter.cpp b/src/utils/qtuiwriter.cpp index 361da968..ac0f3131 100644 --- a/src/utils/qtuiwriter.cpp +++ b/src/utils/qtuiwriter.cpp @@ -85,7 +85,7 @@ QtUiWriter::Status QtUiWriter::addCustomWidget(const QString &className, const Q } QtUiWriter::Status QtUiWriter::addWidgetProperty(pugi::xml_node widget, const QString &name, const QVariant &value, - const QHash &attributes) + const QHash &attributes, bool userProperty) { // Special case for stringlist if (static_cast(value.typeId()) == QMetaType::QStringList) { @@ -98,9 +98,12 @@ QtUiWriter::Status QtUiWriter::addWidgetProperty(pugi::xml_node widget, const QS return Success; } - auto createPropertyNode = [&widget, name]() { + auto createPropertyNode = [&widget, name, userProperty]() { auto propertyNode = widget.append_child("property"); propertyNode.append_attribute("name").set_value(name.toLatin1().constData()); + if (userProperty) { + propertyNode.append_attribute("stdset").set_value("0"); + } return propertyNode; }; diff --git a/src/utils/qtuiwriter.h b/src/utils/qtuiwriter.h index bd4bf6ee..92b17df8 100644 --- a/src/utils/qtuiwriter.h +++ b/src/utils/qtuiwriter.h @@ -28,7 +28,7 @@ class QtUiWriter bool isContainer = false); Status addWidgetProperty(pugi::xml_node widget, const QString &name, const QVariant &value, - const QHash &attributes = {}); + const QHash &attributes = {}, bool userProperty = false); Status setWidgetName(pugi::xml_node widget, const QString &name, bool isRoot = false); Status setWidgetClassName(pugi::xml_node widget, const QString &className); diff --git a/test_data/tst_rcwriter/IDD_ABCCOMPILE.ui b/test_data/tst_rcwriter/IDD_ABCCOMPILE.ui index 83853bba..9d92dc14 100644 --- a/test_data/tst_rcwriter/IDD_ABCCOMPILE.ui +++ b/test_data/tst_rcwriter/IDD_ABCCOMPILE.ui @@ -2,7 +2,7 @@ IDD_ABCCOMPILE - + IDD_ABCCOMPILE @@ -17,7 +17,7 @@ Compile Alembic - + IDOK @@ -36,7 +36,7 @@ - + IDCANCEL @@ -52,7 +52,7 @@ - + IDC_PLAYBACKFROMMEMORY @@ -68,7 +68,7 @@ - + IDC_STATIC @@ -83,7 +83,7 @@ Compilation Settings - + IDC_RADIO_YUP @@ -99,7 +99,7 @@ - + IDC_RADIO_ZUP @@ -116,7 +116,7 @@ - + IDC_STATIC_5 @@ -132,7 +132,7 @@ - + IDC_STATIC_7 @@ -147,7 +147,7 @@ Preset - + IDC_PRESET @@ -161,7 +161,7 @@ - + IDC_STATIC_2 @@ -176,7 +176,7 @@ Compression Settings - + IDC_STATIC_8 @@ -192,7 +192,7 @@ - + IDC_INDEXFRAMEDISTANCE @@ -208,7 +208,7 @@ - + IDC_STATIC_6 @@ -224,7 +224,7 @@ - + IDC_STATIC_4 @@ -240,7 +240,7 @@ - + IDC_PRECISION @@ -256,7 +256,7 @@ - + IDC_STATIC_3 @@ -272,7 +272,7 @@ - + IDC_BLOCKCOMPRESSION @@ -285,7 +285,7 @@ - + IDC_UV_MAX @@ -301,7 +301,7 @@ - + IDC_MESHPREDICTION @@ -317,7 +317,7 @@ - + IDC_USEBFRAMES diff --git a/test_data/tst_rcwriter/IDD_CHARACTER_EDITOR_AUTO_EVENTS.ui b/test_data/tst_rcwriter/IDD_CHARACTER_EDITOR_AUTO_EVENTS.ui index 0f8b8af1..41e8a17d 100644 --- a/test_data/tst_rcwriter/IDD_CHARACTER_EDITOR_AUTO_EVENTS.ui +++ b/test_data/tst_rcwriter/IDD_CHARACTER_EDITOR_AUTO_EVENTS.ui @@ -2,7 +2,7 @@ IDD_CHARACTER_EDITOR_AUTO_EVENTS - + IDD_CHARACTER_EDITOR_AUTO_EVENTS @@ -17,7 +17,7 @@ Auto Populate Events - + IDOK @@ -36,7 +36,7 @@ - + IDC_GENERATE_EVENTS @@ -52,7 +52,7 @@ - + IDC_STATIC_3 @@ -67,7 +67,7 @@ Audio - + IDC_STATIC_6 @@ -83,7 +83,7 @@ - + IDC_STATIC_7 @@ -99,7 +99,7 @@ - + IDC_STATIC_4 @@ -115,7 +115,7 @@ - + IDC_STATIC_8 @@ -131,7 +131,7 @@ - + IDC_STATIC_5 @@ -147,7 +147,7 @@ - + IDC_STATIC @@ -163,7 +163,7 @@ - + IDC_STATIC_2 @@ -179,7 +179,7 @@ - + IDC_FOLEYS_CHECK @@ -195,7 +195,7 @@ - + IDC_FOLEY_DELAY_TXT @@ -211,7 +211,7 @@ - + IDC_FOOTSTEP_HEIGHT @@ -227,7 +227,7 @@ - + IDC_LEFT_FOOT_EVENT @@ -243,7 +243,7 @@ - + IDC_RIGHT_FOOT_EVENT @@ -259,7 +259,7 @@ - + IDC_FOLEY_EVENT @@ -275,7 +275,7 @@ - + IDC_LEFT_FOOT_PARAM @@ -291,7 +291,7 @@ - + IDC_RIGHT_FOOT_PARAM @@ -307,7 +307,7 @@ - + IDC_FOLEY_PARAM @@ -323,7 +323,7 @@ - + IDC_LEFT_BONE_COMBO @@ -342,7 +342,7 @@ - + IDC_RIGHT_BONE_COMBO @@ -361,7 +361,7 @@ - + IDC_FOLEY_BONE_COMBO @@ -380,7 +380,7 @@ - + IDC_FOLEY_DELAY_SLIDER @@ -399,7 +399,7 @@ - + IDC_FOOT_HEIGHT_SLIDER diff --git a/test_data/tst_rcwriter/IDD_CHARPANEL_ANIMATION.ui b/test_data/tst_rcwriter/IDD_CHARPANEL_ANIMATION.ui index 429a0ca1..1ff4b37d 100644 --- a/test_data/tst_rcwriter/IDD_CHARPANEL_ANIMATION.ui +++ b/test_data/tst_rcwriter/IDD_CHARPANEL_ANIMATION.ui @@ -2,7 +2,7 @@ IDD_CHARPANEL_ANIMATION - + IDD_CHARPANEL_ANIMATION @@ -14,7 +14,7 @@ - + IDC_PLAYBACK_SCALE_NUMBER @@ -30,7 +30,7 @@ - + IDC_POLARX_NUMBER @@ -46,7 +46,7 @@ - + IDC_POLARY_NUMBER @@ -62,7 +62,7 @@ - + IDC_ANIMATION_DRIVEN_MOTION @@ -78,7 +78,7 @@ - + IDC_VERTICAL_MOVEMENT @@ -94,7 +94,7 @@ - + IDC_RESETANIMATIONS @@ -110,7 +110,7 @@ - + IDC_RELOAD_ANIMATIONS @@ -126,7 +126,7 @@ - + IDC_MATERIAL @@ -142,7 +142,7 @@ - + IDC_STOP_ANIMATION_LAYER @@ -158,7 +158,7 @@ - + IDC_CHOOSE_BASE_CHARACTER @@ -174,7 +174,7 @@ - + IDC_START_SELECTED_ANIMATIONS @@ -190,7 +190,7 @@ - + IDC_RESET_MODEL @@ -206,7 +206,7 @@ - + IDC_SPEED_MULTIPLYER @@ -222,7 +222,7 @@ - + IDC_LAYER @@ -315,7 +315,7 @@ - + IDC_USE_GAMEPAD @@ -331,7 +331,7 @@ - + IDC_USE_MORPHTARGETS @@ -347,7 +347,7 @@ - + IDC_POLARX_SLIDER @@ -366,7 +366,7 @@ - + IDC_POLARY_SLIDER @@ -385,7 +385,7 @@ - + IDC_PLAYBACK_SCALE_SLIDER @@ -404,7 +404,7 @@ - + IDC_FILE @@ -420,7 +420,7 @@ - + IDC_RELOAD_FILE @@ -436,7 +436,7 @@ - + IDC_STATIC_4 @@ -451,7 +451,7 @@ Unit Test for Humans - + IDC_IDLE2MOVE @@ -467,7 +467,7 @@ - + IDC_PLAYER_CONTROL @@ -483,7 +483,7 @@ - + IDC_FIXED_CAMERA @@ -499,7 +499,7 @@ - + IDC_IDLESTEP @@ -515,7 +515,7 @@ - + IDC_PATH_FOLLOWING @@ -531,7 +531,7 @@ - + IDC_ATTACHED_CAM @@ -548,7 +548,7 @@ - + IDC_STATIC_2 @@ -563,7 +563,7 @@ Post Processing - + IDC_RFOOTIK @@ -579,7 +579,7 @@ - + IDC_LARMIK @@ -595,7 +595,7 @@ - + IDC_RARMIK @@ -611,7 +611,7 @@ - + IDC_LOOKIK @@ -627,7 +627,7 @@ - + IDC_AIMIK @@ -643,7 +643,7 @@ - + IDC_LFOOTIK @@ -659,7 +659,7 @@ - + IDC_GROUNDALIGN @@ -675,7 +675,7 @@ - + IDC_FOOT_ANCHORING @@ -692,7 +692,7 @@ - + IDC_STATIC_3 @@ -707,7 +707,7 @@ Animation Flags - + IDC_ADDITIVE_WEIGHT @@ -723,7 +723,7 @@ - + IDC_AIMIK_LAYER @@ -739,7 +739,7 @@ - + IDC_LOOKIK_LAYER @@ -755,7 +755,7 @@ - + IDC_TRANSITION_TIME @@ -771,7 +771,7 @@ - + IDC_LOOP_ANIMATION @@ -787,7 +787,7 @@ - + IDC_REPEAT_LAST_KEY @@ -803,7 +803,7 @@ - + IDC_ALLOW_ANIMATION_RESTART @@ -819,7 +819,7 @@ - + IDC_LAYERBLENDWEIGHT_TEXT @@ -835,7 +835,7 @@ - + IDC_AIMIK_LAYER_TEXT @@ -851,7 +851,7 @@ - + IDC_LOOKIK_LAYER_TEXT @@ -867,7 +867,7 @@ - + IDC_TRANSITION @@ -883,7 +883,7 @@ - + IDC_DISABLE_MULTILAYER_ANIMATION @@ -899,7 +899,7 @@ - + IDC_VTIME_WARPING @@ -916,7 +916,7 @@ - + IDC_STATIC @@ -931,7 +931,7 @@ Blend-Space Control - + IDC_BLENDSPACENUMBER_Para3 @@ -947,7 +947,7 @@ - + IDC_BLENDSPACENUMBER_Para2 @@ -963,7 +963,7 @@ - + IDC_BLENDSPACENUMBER_Para1 @@ -979,7 +979,7 @@ - + IDC_BLENDSPACENUMBER_Para4 @@ -995,7 +995,7 @@ - + IDC_BLENDSPACENUMBER_Para5 @@ -1011,7 +1011,7 @@ - + IDC_BLENDSPACENUMBER_Para6 @@ -1027,7 +1027,7 @@ - + IDC_BLENDSPACENUMBER_Para7 @@ -1043,7 +1043,7 @@ - + IDC_P1_MoveSpeed @@ -1059,7 +1059,7 @@ - + IDC_P2_TurnSpeed @@ -1075,7 +1075,7 @@ - + IDC_P3_TravelAngle @@ -1091,7 +1091,7 @@ - + IDC_P4_Slope @@ -1107,7 +1107,7 @@ - + IDC_P5_TurnAngle @@ -1123,7 +1123,7 @@ - + IDC_P6_TravelDistance @@ -1139,7 +1139,7 @@ - + IDC_P7_BlendWeight @@ -1155,7 +1155,7 @@ - + IDC_BLENDSPACESLIDER_Para3 @@ -1174,7 +1174,7 @@ - + IDC_BLENDSPACESLIDER_Para2 @@ -1193,7 +1193,7 @@ - + IDC_BLENDSPACESLIDER_Para1 @@ -1212,7 +1212,7 @@ - + IDC_BLENDSPACESLIDER_Para4 @@ -1231,7 +1231,7 @@ - + IDC_BLENDSPACESLIDER_Para5 @@ -1250,7 +1250,7 @@ - + IDC_BLENDSPACESLIDER_Para6 @@ -1269,7 +1269,7 @@ - + IDC_BLENDSPACESLIDER_Para7 diff --git a/test_data/tst_rcwriter/IDD_LIGHTING.ui b/test_data/tst_rcwriter/IDD_LIGHTING.ui index d01911c7..9d8e61f6 100644 --- a/test_data/tst_rcwriter/IDD_LIGHTING.ui +++ b/test_data/tst_rcwriter/IDD_LIGHTING.ui @@ -4,7 +4,7 @@ - + IDC_LIGHTING_IMPORT_BTN @@ -20,7 +20,7 @@ - + IDC_LIGHTING_EXPORT_BTN @@ -36,7 +36,7 @@ - + IDC_FORCE_SKY_UPDATE @@ -52,7 +52,7 @@ - + IDC_STATIC_24 @@ -67,7 +67,7 @@ Light Type - + IDC_LIGHTING_TYPE_PRECISE @@ -83,7 +83,7 @@ - + IDC_LIGHTING_TYPE_DYNAMIC_SUN @@ -100,7 +100,7 @@ - + IDC_STATIC_25 @@ -115,7 +115,7 @@ Time of Day - + IDC_STATIC_26 @@ -131,7 +131,7 @@ - + IDC_TIME_OF_DAY_EDIT @@ -147,7 +147,7 @@ - + IDC_LIGHTING_TIME_OF_DAY @@ -167,7 +167,7 @@ - + IDC_STATIC @@ -182,7 +182,7 @@ Sun Settings - + IDC_LIGHTING_SUNDIR_EDIT @@ -198,7 +198,7 @@ - + IDC_LIGHTING_POLE_EDIT @@ -214,7 +214,7 @@ - + IDC_STATIC_3 @@ -233,7 +233,7 @@ - + IDC_STATIC_2 @@ -252,7 +252,7 @@ - + IDC_SUNMAPLONGITUDE @@ -271,7 +271,7 @@ - + IDC_SUN_DIRECTION @@ -291,7 +291,7 @@ - + IDC_STATIC_9 @@ -306,7 +306,7 @@ Terrain Occlusion - + IDC_STATIC_10 @@ -322,7 +322,7 @@ - + IDC_HEMISAMPLEQ @@ -341,7 +341,7 @@ - + IDC_OBJECTTERRAINOCCL @@ -358,7 +358,7 @@ - + IDC_STATIC_4 @@ -373,7 +373,7 @@ Moon/Sun Shadow Transition - + IDC_STATIC_19 @@ -389,7 +389,7 @@ - + IDC_STATIC_20 @@ -405,7 +405,7 @@ - + IDC_STATIC_21 @@ -421,7 +421,7 @@ - + IDC_STATIC_22 @@ -437,7 +437,7 @@ - + IDC_STATIC_23 @@ -453,7 +453,7 @@ - + IDC_STATIC_6 @@ -469,7 +469,7 @@ - + IDC_STATIC_7 @@ -485,7 +485,7 @@ - + IDC_STATIC_17 @@ -501,7 +501,7 @@ - + IDC_STATIC_8 @@ -517,7 +517,7 @@ - + IDC_STATIC_18 @@ -533,7 +533,7 @@ - + IDC_STATIC_16 @@ -549,7 +549,7 @@ - + IDC_STATIC_5 @@ -565,7 +565,7 @@ - + IDC_STATIC_15 @@ -581,7 +581,7 @@ - + IDC_DAWN_INFO @@ -597,7 +597,7 @@ - + IDC_DUSK_INFO @@ -613,7 +613,7 @@ - + IDC_STATIC_13 @@ -629,7 +629,7 @@ - + IDC_STATIC_11 @@ -645,7 +645,7 @@ - + IDC_DAWN_DUR_INFO @@ -661,7 +661,7 @@ - + IDC_DUSK_DUR_INFO @@ -677,7 +677,7 @@ - + IDC_STATIC_14 @@ -693,7 +693,7 @@ - + IDC_STATIC_12 @@ -709,7 +709,7 @@ - + IDC_DAWN_SLIDER @@ -728,7 +728,7 @@ - + IDC_DAWN_DUR_SLIDER @@ -747,7 +747,7 @@ - + IDC_DUSK_SLIDER @@ -766,7 +766,7 @@ - + IDC_DUSK_DUR_SLIDER @@ -786,7 +786,7 @@ - + IDC_HEIGHTMAP_BORDER @@ -802,7 +802,7 @@ - + IDD_LIGHTING diff --git a/test_data/tst_rcwriter/IDD_PANEL_DISPLAY_STEREO.ui b/test_data/tst_rcwriter/IDD_PANEL_DISPLAY_STEREO.ui index 1b9361ed..c6868157 100644 --- a/test_data/tst_rcwriter/IDD_PANEL_DISPLAY_STEREO.ui +++ b/test_data/tst_rcwriter/IDD_PANEL_DISPLAY_STEREO.ui @@ -2,7 +2,7 @@ IDD_PANEL_DISPLAY_STEREO - + IDD_PANEL_DISPLAY_STEREO @@ -14,7 +14,7 @@ - + IDC_STEREO_EYEDIST_EDIT @@ -30,7 +30,7 @@ - + IDC_STEREO_SCREENDIST_EDIT @@ -46,7 +46,7 @@ - + IDC_STATIC @@ -62,7 +62,7 @@ - + IDC_STATIC_2 @@ -78,7 +78,7 @@ - + IDC_STATIC_3 @@ -94,7 +94,7 @@ - + IDC_STATIC_5 @@ -110,7 +110,7 @@ - + IDC_STEREO_FLIPEYES_RADIO @@ -126,7 +126,7 @@ - + IDC_STEREO_FLIPEYES_RADIO2 @@ -142,7 +142,7 @@ - + IDC_STATIC_4 @@ -158,7 +158,7 @@ - + IDC_STEREO_MODE_COMBO @@ -186,7 +186,7 @@ - + IDC_STEREO_OUTPUT_COMBO @@ -239,7 +239,7 @@ - + IDC_STEREO_EYEDIST_SLIDER @@ -258,7 +258,7 @@ - + IDC_STEREO_SCREENDIST_SLIDER diff --git a/test_data/tst_rcwriter/IDD_PANEL_TERRAIN_MODIFY.ui b/test_data/tst_rcwriter/IDD_PANEL_TERRAIN_MODIFY.ui index 885b6d37..9b61bee7 100644 --- a/test_data/tst_rcwriter/IDD_PANEL_TERRAIN_MODIFY.ui +++ b/test_data/tst_rcwriter/IDD_PANEL_TERRAIN_MODIFY.ui @@ -2,7 +2,7 @@ IDD_PANEL_TERRAIN_MODIFY - + IDD_PANEL_TERRAIN_MODIFY @@ -14,7 +14,7 @@ - + IDC_REPOSITION_OBJECTS @@ -30,7 +30,7 @@ - + IDC_REPOSITION_VEGETATION @@ -46,7 +46,7 @@ - + IDC_STATIC2 @@ -61,7 +61,7 @@ Noise Settings - + IDC_STATIC_5 @@ -77,7 +77,7 @@ - + IDC_STATIC_6 @@ -93,7 +93,7 @@ - + IDC_NOISE_SCALE @@ -109,7 +109,7 @@ - + IDC_NOISE_FREQ @@ -125,7 +125,7 @@ - + IDC_BRUSH_NOISE @@ -141,7 +141,7 @@ - + IDC_NOISE_SCALE_SLIDER @@ -160,7 +160,7 @@ - + IDC_NOISE_FREQ_SLIDER @@ -180,7 +180,7 @@ - + IDC_STATIC1 @@ -195,7 +195,7 @@ Brush Settings - + IDC_STATIC_3 @@ -211,7 +211,7 @@ - + IDC_STATIC_2 @@ -227,7 +227,7 @@ - + IDC_STATIC_4 @@ -243,7 +243,7 @@ - + IDC_STATIC_7 @@ -259,7 +259,7 @@ - + IDC_STATIC @@ -275,7 +275,7 @@ - + IDC_BRUSH_RADIUS @@ -291,7 +291,7 @@ - + IDC_BRUSH_HEIGHT @@ -307,7 +307,7 @@ - + IDC_BRUSH_HARDNESS @@ -323,7 +323,7 @@ - + IDC_BRUSH_RADIUS2 @@ -339,7 +339,7 @@ - + IDC_SYNC_RADIUS @@ -355,7 +355,7 @@ - + IDC_BRUSH_TYPE @@ -368,7 +368,7 @@ - + IDC_BRUSH_RADIUS_SLIDER @@ -387,7 +387,7 @@ - + IDC_BRUSH_HEIGHT_SLIDER @@ -406,7 +406,7 @@ - + IDC_BRUSH_HARDNESS_SLIDER @@ -425,7 +425,7 @@ - + IDC_BRUSH_RADIUS_SLIDER2 @@ -444,7 +444,7 @@ - + IDC_BRUSH_PREVIEW