diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-01-06 10:15:34 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-01-06 13:16:45 +0100 |
commit | 7f735c198cd5b5e1d7f205a6cbce44eeb15529eb (patch) | |
tree | 0ce9386c6377d2fd124606467addc4d16554783f /examples | |
parent | 13e5fa4526821cfc7e64efbab44021dc3589b924 (diff) |
Qt Designer: Use raw string literals for domXML functions in plugins
This improves readibility.
Change-Id: Id8cffc15ee7fae9cd4a5f51bbf778849b9774226
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'examples')
4 files changed, 65 insertions, 56 deletions
diff --git a/examples/designer/containerextension/multipagewidgetplugin.cpp b/examples/designer/containerextension/multipagewidgetplugin.cpp index d29043ecf..a5a3272b5 100644 --- a/examples/designer/containerextension/multipagewidgetplugin.cpp +++ b/examples/designer/containerextension/multipagewidgetplugin.cpp @@ -144,19 +144,19 @@ void MultiPageWidgetPlugin::initialize(QDesignerFormEditorInterface *formEditor) //! [7] QString MultiPageWidgetPlugin::domXml() const { - return QLatin1String("\ -<ui language=\"c++\">\ - <widget class=\"MultiPageWidget\" name=\"multipagewidget\">\ - <widget class=\"QWidget\" name=\"page\" />\ - </widget>\ - <customwidgets>\ - <customwidget>\ - <class>MultiPageWidget</class>\ - <extends>QWidget</extends>\ - <addpagemethod>addPage</addpagemethod>\ - </customwidget>\ - </customwidgets>\ -</ui>"); + return QLatin1String(R"( +<ui language="c++"> + <widget class="MultiPageWidget" name="multipagewidget"> + <widget class="QWidget" name="page" /> + </widget> + <customwidgets> + <customwidget> + <class>MultiPageWidget</class> + <extends>QWidget</extends> + <addpagemethod>addPage</addpagemethod> + </customwidget> + </customwidgets> +</ui>)"); } //! [7] diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.cpp b/examples/designer/customwidgetplugin/customwidgetplugin.cpp index a3d75d311..a728a689c 100644 --- a/examples/designer/customwidgetplugin/customwidgetplugin.cpp +++ b/examples/designer/customwidgetplugin/customwidgetplugin.cpp @@ -129,26 +129,32 @@ bool AnalogClockPlugin::isContainer() const //! [10] QString AnalogClockPlugin::domXml() const { - return "<ui language=\"c++\">\n" - " <widget class=\"AnalogClock\" name=\"analogClock\">\n" + return QLatin1String(R"( +<ui language="c++"> + <widget class="AnalogClock" name="analogClock"> +)" //! [11] - " <property name=\"geometry\">\n" - " <rect>\n" - " <x>0</x>\n" - " <y>0</y>\n" - " <width>100</width>\n" - " <height>100</height>\n" - " </rect>\n" - " </property>\n" +R"( + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>100</width> + <height>100</height> + </rect> + </property> +") //! [11] - " <property name=\"toolTip\" >\n" - " <string>The current time</string>\n" - " </property>\n" - " <property name=\"whatsThis\" >\n" - " <string>The analog clock widget displays the current time.</string>\n" - " </property>\n" - " </widget>\n" - "</ui>\n"; +R"( + <property name="toolTip"> + <string>The current time</string> + </property> + <property name="whatsThis"> + <string>The analog clock widget displays the current time.</string> + </property> + </widget> +</ui> +)"); } //! [10] diff --git a/examples/designer/taskmenuextension/tictactoeplugin.cpp b/examples/designer/taskmenuextension/tictactoeplugin.cpp index 724720ad5..45075fe62 100644 --- a/examples/designer/taskmenuextension/tictactoeplugin.cpp +++ b/examples/designer/taskmenuextension/tictactoeplugin.cpp @@ -129,19 +129,20 @@ void TicTacToePlugin::initialize(QDesignerFormEditorInterface *formEditor) QString TicTacToePlugin::domXml() const { - return QLatin1String("\ -<ui language=\"c++\">\ - <widget class=\"TicTacToe\" name=\"ticTacToe\"/>\ - <customwidgets>\ - <customwidget>\ - <class>TicTacToe</class>\ - <propertyspecifications>\ - <tooltip name=\"state\">Tic Tac Toe state</tooltip>\ - <stringpropertyspecification name=\"state\" notr=\"true\" type=\"singleline\"/>\ - </propertyspecifications>\ - </customwidget>\ - </customwidgets>\ -</ui>"); + return QLatin1String(R"( +<ui language="c++"> + <widget class="TicTacToe" name="ticTacToe"/> + <customwidgets> + <customwidget> + <class>TicTacToe</class> + <propertyspecifications> + <tooltip name="state">Tic Tac Toe state</tooltip> + <stringpropertyspecification name="state" notr="true" type="singleline"/> + </propertyspecifications> + </customwidget> + </customwidgets> +</ui> +)"); } //! [3] diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp index 8cd059c56..83223d59f 100644 --- a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp +++ b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp @@ -108,18 +108,20 @@ bool WorldTimeClockPlugin::isContainer() const QString WorldTimeClockPlugin::domXml() const { - return "<ui language=\"c++\">\n" - " <widget class=\"WorldTimeClock\" name=\"worldTimeClock\">\n" - " <property name=\"geometry\">\n" - " <rect>\n" - " <x>0</x>\n" - " <y>0</y>\n" - " <width>100</width>\n" - " <height>100</height>\n" - " </rect>\n" - " </property>\n" - " </widget>\n" - "</ui>"; + return QLatin1String(R"( +<ui language="c++"> + <widget class="WorldTimeClock" name="worldTimeClock"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>100</width> + <height>100</height> + </rect> + </property> + </widget> +</ui> +)"); } QString WorldTimeClockPlugin::includeFile() const |