diff --git a/README.md b/README.md index f5567748de7..ef348fb758b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ macOS 10.8 or later Prerequisites: * Qt 5.6.0 or later +* Qt WebEngine module for QtWebEngine based help viewer * On Windows: * ActiveState Active Perl * MinGW with g++ 4.8 or Visual Studio 2015 or later diff --git a/dist/changes-4.2.0.md b/dist/changes-4.2.0.md index d44ae8a81fa..0f01dd61e54 100644 --- a/dist/changes-4.2.0.md +++ b/dist/changes-4.2.0.md @@ -65,12 +65,12 @@ C++ Support * Added preview of images to tool tip on Qt resource URLs * Added option to skip big files when indexing (QTCREATORBUG-16712) -* Added notification for parsing errors in headers * Fixed `Move Definition to Class` for functions in template class and template member functions (QTCREATORBUG-14354) * Fixed issues with `Add Declaration`, `Add Definition`, and `Move Definition Outside Class` for template functions * Clang Code Model + * Added notification for parsing errors in headers * Improved responsiveness of completion and highlighting Debugging @@ -91,7 +91,7 @@ QML Profiler Qt Quick Designer -* Added completion expression editor +* Added completion to expression editor * Added menu for editing `when` condition of states * Added editor for managing C++ backend objects * Added reformatting of `.ui.qml` files on save @@ -106,9 +106,11 @@ Qt Quick Designer Diff Viewer -* Added local diff for modified files in Qt Creator (`Diff` > - `Diff Current File`, `Diff` > `Diff All Modified Files`) +* Added local diff for modified files in Qt Creator (`Tools` > `Diff` > + `Diff Current File`, `Tools` > `Diff` > `Diff Open Files`) (QTCREATORBUG-9732) +* Added option to diff files when they changed on disk + (QTCREATORBUG-1531) * Fixed that reload prompt was shown when reverting change Version Control Systems @@ -140,3 +142,45 @@ Android * Fixed handling of minimum required API level (QTCREATORBUG-16740) Credits for these changes go to: +Aaron Barany +Alessandro Portale +Alexander Drozdov +Andre Hartmann +André Pönitz +Arnold Dumas +Christian Kandeler +Christian Stenger +Daniel Langner +Daniel Trevitz +David Schulz +Eike Ziller +Florian Apolloner +Francois Ferrand +Friedemann Kleint +Giuseppe D'Angelo +Jake Petroules +Jaroslaw Kobus +Jochen Becher +Konstantin Shtepa +Kudryavtsev Alexander +Leena Miettinen +Louai Al-Khanji +Marc Reilly +Marco Benelli +Marco Bubke +Mitch Curtis +Nazar Gerasymchuk +Nikita Baryshnikov +Nikolai Kosjar +Orgad Shaneh +Oswald Buddenhagen +Øystein Walle +Robert Löhning +Serhii Moroz +Takumi ASAKI +Tasuku Suzuki +Thomas Hartmann +Tim Jenssen +Tobias Hunger +Ulf Hermann +Vikas Pachdha diff --git a/doc/images/qtcreator-kits.png b/doc/images/qtcreator-kits.png index f31acca4ca9..0eaf814d07d 100644 Binary files a/doc/images/qtcreator-kits.png and b/doc/images/qtcreator-kits.png differ diff --git a/doc/images/qtcreator-toolchains.png b/doc/images/qtcreator-toolchains.png index cf4cf05cdec..0b573f034a7 100644 Binary files a/doc/images/qtcreator-toolchains.png and b/doc/images/qtcreator-toolchains.png differ diff --git a/doc/images/qtcreator-welcome-session.png b/doc/images/qtcreator-welcome-session.png index 9675d867693..e5590826152 100644 Binary files a/doc/images/qtcreator-welcome-session.png and b/doc/images/qtcreator-welcome-session.png differ diff --git a/doc/src/debugger/creator-debugger.qdoc b/doc/src/debugger/creator-debugger.qdoc index ec6571f64f9..4ae778d7c03 100644 --- a/doc/src/debugger/creator-debugger.qdoc +++ b/doc/src/debugger/creator-debugger.qdoc @@ -417,6 +417,9 @@ \uicontrol Window > \uicontrol Views > \uicontrol {Reset to Default Layout} to reset the views to their original sizes and positions. + To save space on the screen, select \uicontrol Window > \uicontrol Views > + \uicontrol {Automatically Hide View Titlebars}. + Once the program starts running under the control of the debugger, it behaves and performs as usual. You can interrupt a running C++ program by selecting \uicontrol Debug > \uicontrol Interrupt. The program is diff --git a/doc/src/editors/creator-editors.qdoc b/doc/src/editors/creator-editors.qdoc index bc631612aa7..3ccaaf3eb88 100644 --- a/doc/src/editors/creator-editors.qdoc +++ b/doc/src/editors/creator-editors.qdoc @@ -554,6 +554,12 @@ \row \li M208 \li Error + \li This id might be ambiguous and is not supported in the \QMLD. + \li + + \row + \li M209 + \li Error \li This type (type name) is not supported as a root element by \QMLD. \li diff --git a/doc/src/howto/creator-keyboard-shortcuts.qdoc b/doc/src/howto/creator-keyboard-shortcuts.qdoc index c8fab9e4474..cb4dcca5fe2 100644 --- a/doc/src/howto/creator-keyboard-shortcuts.qdoc +++ b/doc/src/howto/creator-keyboard-shortcuts.qdoc @@ -38,9 +38,13 @@ \title Keyboard Shortcuts \QC provides various keyboard shortcuts to speed up your development - process. + process. In addition, you can specify your own keyboard shortcuts for some + functions that can be easily performed with a mouse, and therefore do not + appear in menus or have default keyboard shortcuts. For example, selecting + and deleting words or lines in an editor. - To view all keyboard shortcuts defined in \QC, and to change them, select + To view all functions available in \QC and the keyboard shortcuts defined + for them, select \uicontrol {Tools > Options > Environment > Keyboard}. The shortcuts are listed by category. To find a keyboard shortcut in the list, enter a function name or shortcut in the \uicontrol Filter diff --git a/doc/src/howto/creator-sessions.qdoc b/doc/src/howto/creator-sessions.qdoc index b1c547b431d..744a7f40e29 100644 --- a/doc/src/howto/creator-sessions.qdoc +++ b/doc/src/howto/creator-sessions.qdoc @@ -80,10 +80,16 @@ \uicontrol {Switch to}. When you launch \QC, a list of existing sessions is displayed in the - \uicontrol Welcome mode. + \uicontrol Welcome mode. To open a session, select it or press + \key Ctrl+Alt+, where \e is the number of the session to + open (available for the first nine sessions). \image qtcreator-welcome-session.png + To view more information about a session, select the down arrow icon that + appears when you move the mouse cursor over the session name. Select actions + to clone, rename, and delete sessions. + When you start \QC from the command line, you can give the name of a session as argument and \QC will start with this session. diff --git a/doc/src/projects/creator-projects-compilers.qdoc b/doc/src/projects/creator-projects-compilers.qdoc index b4ca89d266a..5647027a9a3 100644 --- a/doc/src/projects/creator-projects-compilers.qdoc +++ b/doc/src/projects/creator-projects-compilers.qdoc @@ -82,8 +82,9 @@ \list 1 \li Select \uicontrol Tools > \uicontrol Options > - \uicontrol {Build & Run} > \uicontrol Compilers > \uicontrol Add - and select a compiler in the list. + \uicontrol {Build & Run} > \uicontrol Compilers > \uicontrol Add, + then select a compiler in the list, and then select \uicontrol C or + \uicontrol C++ to add a C or C++ compiler. \image qtcreator-toolchains.png @@ -124,7 +125,8 @@ \list 1 \li Select \uicontrol Tools > \uicontrol Options > \uicontrol {Build & Run} > - \uicontrol Compilers > \uicontrol Add > \uicontrol Custom. + \uicontrol Compilers > \uicontrol Add > \uicontrol Custom > + \uicontrol C or \uicontrol C++. \li In the \uicontrol Name field, enter a name for the compiler. diff --git a/doc/src/projects/creator-projects-opening.qdoc b/doc/src/projects/creator-projects-opening.qdoc index 774f875b621..7c880d64482 100644 --- a/doc/src/projects/creator-projects-opening.qdoc +++ b/doc/src/projects/creator-projects-opening.qdoc @@ -75,14 +75,36 @@ \list 1 - \li Select \uicontrol File > \uicontrol{Open File or Project} and select the project - to open. + \li Select \uicontrol File > \uicontrol {Open File or Project} + (\key Ctrl+O or \key Cmd+O on \macos) and select the project to + open. \li In the \uicontrol {Configure Project} tab, select kits for building and running your project, and click \uicontrol {Configure Project}. \endlist + You can use the following keyboard shortcuts to open projects, depending on + the mode you are currently in: + + \list + + \li In all modes, select \key Ctrl+O (\key Cmd+O on \macos) to open the + \uicontrol {Open File} dialog, where you can select a project file + to open a project. + + \li In all modes, except the \uicontrol Help mode, select + \key Ctrl+Shift+O (\key Cmd+Shift+O on \macos) to open the + \uicontrol {Load Project} dialog, where you can select a project + file to open a project. + + \li In the \uicontrol Welcome mode, \uicontrol Projects tab, select + \key Ctrl+Shift+number (\key Cmd+Shift+number on \macos), where + the number is the number of a project in the list of recently opened + projects. + + \endlist + \QC parses all the source files in the project and performs a semantic analysis to build up the information that it needs for functions such as navigation and finding usages. A progress bar is displayed during parsing. diff --git a/doc/src/projects/creator-projects-settings-build.qdoc b/doc/src/projects/creator-projects-settings-build.qdoc index ca38fa89d54..dfe29d5cc14 100644 --- a/doc/src/projects/creator-projects-settings-build.qdoc +++ b/doc/src/projects/creator-projects-settings-build.qdoc @@ -111,6 +111,33 @@ (\uicontrol {Variables}) button in a field to select from a list of variables that are available in a particular context. + The following syntax enables you to use environment variables as \QC + variables: %{Env:VARNAME}. + + \QC uses pattern substitution when expanding variable names. To replace the + first match of \e pattern within \e variable with \e replacement, use: + + \badcode + %{variable/pattern/replacement} + \endcode + + To replace all matches of \e pattern within \e variable with \e replacement, + use: + + \badcode + %{variable//pattern/replacement} + \endcode + + The pattern can be a regular expression and the replacement can contain + backreferences. For example, if \c %{variable} is \c my123var, then + \c %{variable/(..)(\d+)/\2\1} is expanded to \c {123myvar}. + + To use the default value if the variable is not set, use: + + \badcode + %{variable:-default} + \endcode + \section1 Build Steps The build system of \QC is built on qmake and make. In \uicontrol{Build Steps} you diff --git a/doc/src/projects/creator-projects-settings-overview.qdoc b/doc/src/projects/creator-projects-settings-overview.qdoc index df2b6a61a5f..cd8e785adf3 100644 --- a/doc/src/projects/creator-projects-settings-overview.qdoc +++ b/doc/src/projects/creator-projects-settings-overview.qdoc @@ -99,6 +99,8 @@ \li \l{Specifying Dependencies}{Dependencies} + \li \l{Parsing C++ Files}{Clang Code Model} (experimental) + \li \l{Using Clang Static Analyzer}{Clang Static Analyzer} \li \l{To-Do Entries}{To-Do} (experimental) diff --git a/doc/src/projects/creator-projects-targets.qdoc b/doc/src/projects/creator-projects-targets.qdoc index 2871f3a8695..9617b8addcd 100644 --- a/doc/src/projects/creator-projects-targets.qdoc +++ b/doc/src/projects/creator-projects-targets.qdoc @@ -91,8 +91,8 @@ image is located. If you are not cross-compiling, leave this field empty. - \li In the \uicontrol {Compiler} field, select the compiler required - to build the project. You can add compilers to the list + \li In the \uicontrol {Compiler} field, select the C or C++ compiler + used to build the project. You can add compilers to the list if they are installed on the development PC, but were not detected automatically. For more information, see \l{Adding Compilers}. diff --git a/doc/src/qtquick/qtquick-modules-with-plugins.qdoc b/doc/src/qtquick/qtquick-modules-with-plugins.qdoc index c2def1cdc7a..f336a6163da 100644 --- a/doc/src/qtquick/qtquick-modules-with-plugins.qdoc +++ b/doc/src/qtquick/qtquick-modules-with-plugins.qdoc @@ -55,6 +55,11 @@ Classes registered with \c qmlRegisterType() can be used as backend objects in the \QMLD. For more information, see \l {Adding Connections}. + By default, \QC will look in the QML import path of Qt for QML modules. + If your applications adds additional import paths that \QC should use, + then you can specify those using \c{QML_IMPORT_PATH} in the \c{.pro} file of your + application. + Ideally, QML modules have a \c{plugins.qmltypes} file in the same directory as the \c qmldir file. The \c qmltypes file contains a description of the types exported by the module's plugins and is loaded by \QC when the @@ -117,4 +122,9 @@ environment variable to check whether the plugin is currently being run by an application or edited in the \uicontrol Design mode. + If you want to use a different module in \QMLD than in your actual + application for example to mockup C++ items, then you can use \c{QML_DESIGNER_IMPORT_PATH} + in the \c{.pro} file. + Modules in the import paths defined in \c{QML_DESIGNER_IMPORT_PATH} will be used only in \QMLD. + */ diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index 5ce5531c682..6e8cb59892e 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -1275,6 +1275,12 @@ def qdump__QStaticStringData(d, value): d.putValue(d.hexencode(data), 'utf16') d.putPlainChildren(value) +def qdump__QTypedArrayData(d, value): + if value.type[0].name == 'unsigned short': + qdump__QStringData(d, value) + else: + qdump__QArrayData(d, value) + def qdump__QStringData(d, value): (ref, size, alloc, pad, offset) = value.split('III@p') elided, shown = d.computeLimit(size, d.displayStringLimit) diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py index 8e1f198a7e6..2733253bf45 100644 --- a/share/qtcreator/debugger/stdtypes.py +++ b/share/qtcreator/debugger/stdtypes.py @@ -56,7 +56,7 @@ def qdump__std____1__complex(d, value): def qdump__std__deque(d, value): - if d.isQnxTarget(): + if d.isQnxTarget() or d.isMsvcTarget(): qdump__std__deque__QNX(d, value) return @@ -117,15 +117,20 @@ def qdump__std__deque__QNX(d, value): else: bufsize = 1 - myoff = value['_Myoff'] - mysize = value['_Mysize'] - mapsize = value['_Mapsize'] + try: + val = value['_Mypair']['_Myval2'] + except: + val = value + + myoff = val['_Myoff'].integer() + mysize = val['_Mysize'].integer() + mapsize = val['_Mapsize'].integer() d.check(0 <= mapsize and mapsize <= 1000 * 1000 * 1000) d.putItemCount(mysize) if d.isExpanded(): with Children(d, mysize, maxNumChild=2000, childType=innerType): - map = value['_Map'] + map = val['_Map'] for i in d.childRange(): block = myoff / bufsize offset = myoff - (block * bufsize) @@ -139,7 +144,7 @@ def qdump__std____debug__deque(d, value): def qdump__std__list(d, value): - if d.isQnxTarget(): + if d.isQnxTarget() or d.isMsvcTarget(): qdump__std__list__QNX(d, value) return @@ -167,7 +172,7 @@ def qdump__std__list(d, value): def qdump__std__list__QNX(d, value): node = value["_Myhead"] - size = value["_Mysize"] + size = value["_Mysize"].integer() d.putItemCount(size, 1000) @@ -607,16 +612,25 @@ def qdump__std____1__wstring(d, value): def qdump__std__shared_ptr(d, value): - i = value["_M_ptr"] + if d.isMsvcTarget: + i = value["_Ptr"] + else: + i = value["_M_ptr"] + if i.integer() == 0: d.putValue("(null)") d.putNumChild(0) return with Children(d): short = d.putSubItem("data", i) - refcount = value["_M_refcount"]["_M_pi"] - d.putIntItem("usecount", refcount["_M_use_count"]) - d.putIntItem("weakcount", refcount["_M_weak_count"]) + if d.isMsvcTarget: + refcount = value["_Rep"] + d.putIntItem("usecount", refcount["_Uses"]) + d.putIntItem("weakcount", refcount["_Weaks"]) + else: + refcount = value["_M_refcount"]["_M_pi"] + d.putIntItem("usecount", refcount["_M_use_count"]) + d.putIntItem("weakcount", refcount["_M_weak_count"]) d.putValue(short.value, short.encoding) def qdump__std____1__shared_ptr(d, value): @@ -767,7 +781,10 @@ def qform__std__valarray(): return arrayForms() def qdump__std__valarray(d, value): - (size, data) = value.split('pp') + if d.isMsvcTarget(): + (data, size) = value.split('pp') + else: + (size, data) = value.split('pp') d.putItemCount(size) d.putPlotData(data, size, value.type[0]) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp index ab31bda00dc..149db2a501f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp @@ -685,16 +685,36 @@ void NodeInstanceServer::setupDummysForContext(QQmlContext *context) } } +static bool isTypeAvailable(const MockupTypeContainer &mockupType, QQmlEngine *engine) +{ + QString qmlSource; + qmlSource.append("import " + + mockupType.importUri() + + " " + + QString::number(mockupType.majorVersion()) + + "." + QString::number(mockupType.minorVersion()) + + "\n"); + + qmlSource.append(QString::fromUtf8(mockupType.typeName()) + "{\n}\n"); + + QQmlComponent component(engine); + component.setData(qmlSource.toUtf8(), QUrl()); + + return !component.isError(); +} + void NodeInstanceServer::setupMockupTypes(const QVector &container) { for (const MockupTypeContainer &mockupType : container) { + if (!isTypeAvailable(mockupType, engine())) #if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) - QQuickDesignerSupportMetaInfo::registerMockupObject(mockupType.importUri().toUtf8(), + + QQuickDesignerSupportMetaInfo::registerMockupObject(mockupType.importUri().toUtf8(), mockupType.majorVersion(), mockupType.minorVersion(), mockupType.typeName()); #else - qmlRegisterType(QUrl("qrc:/qtquickplugin/mockfiles/GenericBackend.qml"), + qmlRegisterType(QUrl("qrc:/qtquickplugin/mockfiles/GenericBackend.qml"), mockupType.importUri().toUtf8(), mockupType.majorVersion(), mockupType.minorVersion(), diff --git a/share/qtcreator/templates/wizards/classes/cpp/wizard.json b/share/qtcreator/templates/wizards/classes/cpp/wizard.json index 781b6471424..6ac5bf21d6c 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/wizard.json +++ b/share/qtcreator/templates/wizards/classes/cpp/wizard.json @@ -17,7 +17,7 @@ { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }, { "key": "Base", "value": "%{JS: ( '%{BaseCB}' === '' ) ? '%{BaseEdit}' : '%{BaseCB}'}" }, { "key": "isQObject", "value": "%{JS: [ 'QObject', 'QWidget', 'QMainWindow', 'QDeclarativeItem', 'QQuickItem'].indexOf('%{Base}') >= 0 }" }, - { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" }, + { "key": "GUARD", "value": "%{JS: Cpp.headerGuard('%{HdrFileName}')}" }, { "key": "SharedDataInit", "value": "%{JS: ('%{IncludeQSharedData}') ? 'data(new %{CN}Data)' : '' }" } ], diff --git a/share/qtcreator/templates/wizards/projects/qmake/consoleapp/file.pro b/share/qtcreator/templates/wizards/projects/qmake/consoleapp/file.pro index ad2b74f6490..9df9214a845 100644 --- a/share/qtcreator/templates/wizards/projects/qmake/consoleapp/file.pro +++ b/share/qtcreator/templates/wizards/projects/qmake/consoleapp/file.pro @@ -10,3 +10,14 @@ CONFIG -= app_bundle TEMPLATE = app SOURCES += %{MainCppName} + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked 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 diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtcanvas3dapplication/app.pro b/share/qtcreator/templates/wizards/projects/qmake/qtcanvas3dapplication/app.pro index 91b0337e7b8..e211b30bfa6 100644 --- a/share/qtcreator/templates/wizards/projects/qmake/qtcanvas3dapplication/app.pro +++ b/share/qtcreator/templates/wizards/projects/qmake/qtcanvas3dapplication/app.pro @@ -11,6 +11,17 @@ RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked 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 + # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/app.pro b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/app.pro index 68acc52a40a..cef1a05e987 100644 --- a/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/app.pro +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/app.pro @@ -10,6 +10,20 @@ RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked 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 + # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/app.pro b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/app.pro index f15dcb65f46..190b79c9e5b 100644 --- a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/app.pro +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrols2application/app.pro @@ -9,6 +9,20 @@ RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked 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 + # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/app.pro b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/app.pro index 9b50176b3a2..7c8a5e31d5a 100644 --- a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/app.pro +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/app.pro @@ -15,6 +15,20 @@ RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked 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 + # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin diff --git a/share/qtcreator/themes/dark.creatortheme b/share/qtcreator/themes/dark.creatortheme index 2e7f5f7000f..ff8a66cf1c3 100644 --- a/share/qtcreator/themes/dark.creatortheme +++ b/share/qtcreator/themes/dark.creatortheme @@ -244,7 +244,3 @@ IconOverlayPri=:/qtsupport/images/dark_qt_project.png IconOverlayPro=:/qtsupport/images/dark_qt_project.png StandardPixmapFileIcon=:/core/images/dark_fileicon.png StandardPixmapDirIcon=:/core/images/dark_foldericon.png -BuildStepDisable=:/projectexplorer/images/lightdisabledbuildstep.png -BuildStepRemove=:/core/images/lightclose.png -BuildStepMoveDown=:/core/images/lightarrowdown.png -BuildStepMoveUp=:/core/images/lightarrowup.png diff --git a/src/libs/cplusplus/Icons.cpp b/src/libs/cplusplus/Icons.cpp index 7a539c67eb8..27e4b92d09f 100644 --- a/src/libs/cplusplus/Icons.cpp +++ b/src/libs/cplusplus/Icons.cpp @@ -215,7 +215,7 @@ QIcon Icons::iconForType(IconType type) } case NamespaceIconType: { const static QIcon icon(Icon({ - {QLatin1String(":/codemodel/images/namespace.png"), Theme::IconsCodeModelKeywordColor} + {QLatin1String(":/utils/images/namespace.png"), Theme::IconsCodeModelKeywordColor} }, Icon::Tint).icon()); return icon; } diff --git a/src/libs/cplusplus/cplusplus.qrc b/src/libs/cplusplus/cplusplus.qrc index d0135fdee80..32d9a712495 100644 --- a/src/libs/cplusplus/cplusplus.qrc +++ b/src/libs/cplusplus/cplusplus.qrc @@ -8,8 +8,6 @@ images/keyword@2x.png images/macro.png images/macro@2x.png - images/namespace.png - images/namespace@2x.png images/signal.png images/signal@2x.png images/slot.png diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 9610a95f72d..c9c136d1781 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -489,6 +489,42 @@ private: bool _seenNonDeclarationStatement; }; +class IdsThatShouldNotBeUsedInDesigner : public QStringList +{ +public: + IdsThatShouldNotBeUsedInDesigner() : QStringList({ "top", + "bottom", + "left", + "right", + "width", + "height", + "x", + "y", + "opacity", + "parent", + "item", + "flow", + "color", + "margin", + "padding", + "border", + "font", + "text", + "source", + "state", + "visible", + "focus", + "data", + "clip", + "layer", + "scale", + "enabled", + "anchors"}) + { + } + +}; + class VisualAspectsPropertyBlackList : public QStringList { public: @@ -563,6 +599,7 @@ public: } // end of anonymous namespace +Q_GLOBAL_STATIC(IdsThatShouldNotBeUsedInDesigner, idsThatShouldNotBeUsedInDesigner) Q_GLOBAL_STATIC(VisualAspectsPropertyBlackList, visualAspectsPropertyBlackList) Q_GLOBAL_STATIC(UnsupportedTypesByVisualDesigner, unsupportedTypesByVisualDesigner) Q_GLOBAL_STATIC(UnsupportedRootObjectTypesByVisualDesigner, unsupportedRootObjectTypesByVisualDesigner) @@ -634,6 +671,7 @@ void Check::enableQmlDesignerChecks() enableMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner); enableMessage(WarnAboutQtQuick1InsteadQtQuick2); enableMessage(ErrUnsupportedRootTypeInVisualDesigner); + enableMessage(ErrInvalidIdeInVisualDesigner); //## triggers too often ## check.enableMessage(StaticAnalysis::WarnUndefinedValueForVisualDesigner); } @@ -645,6 +683,7 @@ void Check::disableQmlDesignerChecks() disableMessage(WarnUndefinedValueForVisualDesigner); disableMessage(WarnStatesOnlyInRootItemForVisualDesigner); disableMessage(ErrUnsupportedRootTypeInVisualDesigner); + disableMessage(ErrInvalidIdeInVisualDesigner); } void Check::enableQmlDesignerUiFileChecks() @@ -927,6 +966,10 @@ bool Check::visit(UiScriptBinding *ast) return false; } + if (idsThatShouldNotBeUsedInDesigner->contains(id)) { + addMessage(ErrInvalidIdeInVisualDesigner, loc); + } + if (m_idStack.top().contains(id)) { addMessage(ErrDuplicateId, loc); return false; diff --git a/src/libs/qmljs/qmljsqrcparser.cpp b/src/libs/qmljs/qmljsqrcparser.cpp index dd9d0892905..d4e0d2c40ff 100644 --- a/src/libs/qmljs/qmljsqrcparser.cpp +++ b/src/libs/qmljs/qmljsqrcparser.cpp @@ -271,6 +271,7 @@ QrcParserPrivate::QrcParserPrivate(QrcParser *) bool QrcParserPrivate::parseFile(const QString &path) { + QDir baseDir(QFileInfo(path).path()); QFile file(path); if (!file.open(QIODevice::ReadOnly)) { m_errorMessages.append(file.errorString()); @@ -304,9 +305,8 @@ bool QrcParserPrivate::parseFile(const QString &path) QDomElement felt = relt.firstChildElement(QLatin1String("file")); for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) { const QString fileName = felt.text(); - QTC_CHECK(!QDir::isAbsolutePath(fileName)); const QString alias = felt.attribute(QLatin1String("alias")); - QString filePath = QFileInfo(path).path() + QLatin1Char('/') + fileName; + QString filePath = baseDir.absoluteFilePath(fileName); QString accessPath; if (!alias.isEmpty()) accessPath = language + prefix + alias; diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.cpp b/src/libs/qmljs/qmljsstaticanalysismessage.cpp index fe5213b6bc5..34929ab3b64 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.cpp +++ b/src/libs/qmljs/qmljsstaticanalysismessage.cpp @@ -220,6 +220,8 @@ StaticAnalysisMessages::StaticAnalysisMessages() "and might not show up in Qt Quick Designer as expected.")); newMsg(WarnStatesOnlyInRootItemForVisualDesigner, Warning, tr("Qt Quick Designer only supports states in the root item.")); + newMsg(ErrInvalidIdeInVisualDesigner, Error, + tr("This id might be ambiguous and is not supported in the Qt Quick Designer.")); newMsg(WarnAboutQtQuick1InsteadQtQuick2, Warning, tr("Using Qt Quick 1 code model instead of Qt Quick 2.")); newMsg(ErrUnsupportedRootTypeInVisualDesigner, Error, diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.h b/src/libs/qmljs/qmljsstaticanalysismessage.h index ced78ee686a..4d07614c8d5 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.h +++ b/src/libs/qmljs/qmljsstaticanalysismessage.h @@ -97,6 +97,7 @@ enum Type WarnUndefinedValueForVisualDesigner = 206, WarnStatesOnlyInRootItemForVisualDesigner = 207, ErrUnsupportedRootTypeInVisualDesigner = 208, + ErrInvalidIdeInVisualDesigner = 209, ErrUnsupportedRootTypeInQmlUi = 220, ErrUnsupportedTypeInQmlUi = 221, ErrFunctionsNotSupportedInQmlUi = 222, diff --git a/src/libs/qtcreatorcdbext/extensioncontext.cpp b/src/libs/qtcreatorcdbext/extensioncontext.cpp index 5fba498dee9..0d8864ee972 100644 --- a/src/libs/qtcreatorcdbext/extensioncontext.cpp +++ b/src/libs/qtcreatorcdbext/extensioncontext.cpp @@ -202,14 +202,22 @@ static std::string findModule(CIDebugSymbols *syms, } // Try to find a JS execution context passed as parameter in a complete stack dump (kp) -static ULONG64 jsExecutionContextFromStackTrace(const std::wstring &stack) +static ULONG64 jsExecutionEngineFromStackTrace(const std::wstring &stack) { - // Search for "QV4::ExecutionContext * - varying variable names - 0x...[,)]" - const wchar_t needle[] = L"struct QV4::ExecutionContext * "; // .. varying variable names .. 0x... - const std::string::size_type varPos = stack.find(needle); - if (varPos == std::string::npos) + // Search for "QV4::ExecutionEngine * - varying variable names - 0x...[,)]" + const wchar_t needle[] = L"struct QV4::ExecutionEngine * "; // Qt 5.7 onwards + std::string::size_type varEnd = std::string::npos; + std::string::size_type varPos = stack.find(needle); + if (varPos != std::string::npos) { + varEnd = varPos + sizeof(needle) / sizeof(wchar_t) - 1; + } else { + const wchar_t needle56[] = L"struct QV4::ExecutionContext * "; // up to Qt 5.6 + varPos = stack.find(needle56); + if (varPos != std::string::npos) + varEnd = varPos + sizeof(needle56) / sizeof(wchar_t) - 1; + } + if (varEnd == std::string::npos) return 0; - const std::string::size_type varEnd = varPos + sizeof(needle) / sizeof(wchar_t) - 1; std::string::size_type numPos = stack.find(L"0x", varEnd); if (numPos == std::string::npos || numPos > (varEnd + 20)) return 0; @@ -227,10 +235,10 @@ static ULONG64 jsExecutionContextFromStackTrace(const std::wstring &stack) return str.fail() ? 0 : result; } -// Try to find address of jsExecutionContext by looking at the +// Try to find address of jsExecutionEngine by looking at the // stack trace in case QML is loaded. -ULONG64 ExtensionContext::jsExecutionContext(ExtensionCommandContext &exc, - std::string *errorMessage) +ULONG64 ExtensionContext::jsExecutionEngine(ExtensionCommandContext &exc, + std::string *errorMessage) { const QtInfo &qtInfo = QtInfo::get(SymbolGroupValueContext(exc.dataSpaces(), exc.symbols())); @@ -241,10 +249,10 @@ ULONG64 ExtensionContext::jsExecutionContext(ExtensionCommandContext &exc, *errorMessage = "QML not loaded"; return 0; } - // Retrieve full stack (costly) and try to find a JS execution context passed as parameter + // Retrieve top frames of stack and try to find a JS execution engine passed as parameter startRecordingOutput(); StateNotificationBlocker blocker(this); - const HRESULT hr = m_control->Execute(DEBUG_OUTCTL_ALL_CLIENTS, "kp", DEBUG_EXECUTE_ECHO); + const HRESULT hr = m_control->Execute(DEBUG_OUTCTL_ALL_CLIENTS, "kp 15", DEBUG_EXECUTE_ECHO); if (FAILED(hr)) { stopRecordingOutput(); *errorMessage = msgDebugEngineComFailed("Execute", hr); @@ -255,9 +263,9 @@ ULONG64 ExtensionContext::jsExecutionContext(ExtensionCommandContext &exc, *errorMessage = "Unable to obtain stack (output redirection in place?)"; return 0; } - const ULONG64 result = jsExecutionContextFromStackTrace(fullStackTrace); + const ULONG64 result = jsExecutionEngineFromStackTrace(fullStackTrace); if (!result) - *errorMessage = "JS ExecutionContext address not found in stack"; + *errorMessage = "JS ExecutionEngine address not found in stack"; return result; } diff --git a/src/libs/qtcreatorcdbext/extensioncontext.h b/src/libs/qtcreatorcdbext/extensioncontext.h index f1b08cce694..687cadffaaf 100644 --- a/src/libs/qtcreatorcdbext/extensioncontext.h +++ b/src/libs/qtcreatorcdbext/extensioncontext.h @@ -115,7 +115,7 @@ public: const Parameters ¶meters() const { return m_parameters; } Parameters ¶meters() { return m_parameters; } - ULONG64 jsExecutionContext(ExtensionCommandContext &exc, std::string *errorMessage); + ULONG64 jsExecutionEngine(ExtensionCommandContext &exc, std::string *errorMessage); bool stateNotification() const { return m_stateNotification; } void setStateNotification(bool s) { m_stateNotification = s; } diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp index 5cf04d9441b..63e79777fd0 100644 --- a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp +++ b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp @@ -1091,7 +1091,7 @@ extern "C" HRESULT CALLBACK qmlstack(CIDebugClient *client, PCSTR argsIn) int token = 0; bool humanReadable = false; - ULONG64 jsExecutionContext = 0; + ULONG64 jsExecutionEngine = 0; std::string stackDump; do { @@ -1101,16 +1101,16 @@ extern "C" HRESULT CALLBACK qmlstack(CIDebugClient *client, PCSTR argsIn) tokens.pop_front(); } if (!tokens.empty()) { - if (!integerFromString(tokens.front(), &jsExecutionContext)) { + if (!integerFromString(tokens.front(), &jsExecutionEngine)) { errorMessage = "Invalid address " + tokens.front(); break; } tokens.pop_front(); } ExtensionCommandContext exc(client); - if (!jsExecutionContext) { // Try to find execution context unless it was given. - jsExecutionContext = ExtensionContext::instance().jsExecutionContext(exc, &errorMessage); - if (!jsExecutionContext) + if (!jsExecutionEngine) { // Try to find execution engine unless it was given. + jsExecutionEngine = ExtensionContext::instance().jsExecutionEngine(exc, &errorMessage); + if (!jsExecutionEngine) break; } // call function to get stack trace. Call with exceptions handled right from @@ -1118,7 +1118,7 @@ extern "C" HRESULT CALLBACK qmlstack(CIDebugClient *client, PCSTR argsIn) std::ostringstream callStr; const QtInfo &qtInfo = QtInfo::get(SymbolGroupValueContext(exc.dataSpaces(), exc.symbols())); callStr << qtInfo.prependQtModule("qt_v4StackTrace(", QtInfo::Qml) << std::showbase << std::hex - << jsExecutionContext << std::dec << std::noshowbase << ')'; + << jsExecutionEngine << std::dec << std::noshowbase << ')'; std::wstring wOutput; if (!ExtensionContext::instance().call(callStr.str(), ExtensionContext::CallWithExceptionsHandled, &wOutput, &errorMessage)) break; diff --git a/src/libs/utils/guard.cpp b/src/libs/utils/guard.cpp index 925bdb226f9..69f872db00e 100644 --- a/src/libs/utils/guard.cpp +++ b/src/libs/utils/guard.cpp @@ -54,8 +54,8 @@ void MyClass::updateOtherObject() { - GuardLocker updatelocker(updateGuard); - otherObject->update(); // this may trigger a signal + GuardLocker updatelocker(updateGuard); + otherObject->update(); // this may trigger a signal } \endcode @@ -66,16 +66,16 @@ \code void MyClass::otherObjectUpdated() { - if (updateGuard.isLocked) - return; + if (updateGuard.isLocked()) + return; - // we didn't trigger the update - // so do update now - \dots + // we didn't trigger the update + // so do update now + \dots } \endcode - The GuardLock unlocks the Guard in it's destructor. + The GuardLocker unlocks the Guard in its destructor. The Guard object is recursive, you may declare many GuardLocker objects for the same Guard instance and the Guard will be locked diff --git a/src/libs/utils/images/fittoview.png b/src/libs/utils/images/fittoview.png new file mode 100644 index 00000000000..6b9d1329f74 Binary files /dev/null and b/src/libs/utils/images/fittoview.png differ diff --git a/src/libs/utils/images/fittoview@2x.png b/src/libs/utils/images/fittoview@2x.png new file mode 100644 index 00000000000..e98dce6536f Binary files /dev/null and b/src/libs/utils/images/fittoview@2x.png differ diff --git a/src/libs/cplusplus/images/namespace.png b/src/libs/utils/images/namespace.png similarity index 100% rename from src/libs/cplusplus/images/namespace.png rename to src/libs/utils/images/namespace.png diff --git a/src/libs/cplusplus/images/namespace@2x.png b/src/libs/utils/images/namespace@2x.png similarity index 100% rename from src/libs/cplusplus/images/namespace@2x.png rename to src/libs/utils/images/namespace@2x.png diff --git a/src/libs/utils/images/zoomin_overlay.png b/src/libs/utils/images/zoomin_overlay.png new file mode 100644 index 00000000000..051f9246ed3 Binary files /dev/null and b/src/libs/utils/images/zoomin_overlay.png differ diff --git a/src/libs/utils/images/zoomin_overlay@2x.png b/src/libs/utils/images/zoomin_overlay@2x.png new file mode 100644 index 00000000000..f022c80cbe1 Binary files /dev/null and b/src/libs/utils/images/zoomin_overlay@2x.png differ diff --git a/src/libs/utils/images/zoomout_overlay.png b/src/libs/utils/images/zoomout_overlay.png new file mode 100644 index 00000000000..b1ee112fcd0 Binary files /dev/null and b/src/libs/utils/images/zoomout_overlay.png differ diff --git a/src/libs/utils/images/zoomout_overlay@2x.png b/src/libs/utils/images/zoomout_overlay@2x.png new file mode 100644 index 00000000000..d721c11a525 Binary files /dev/null and b/src/libs/utils/images/zoomout_overlay@2x.png differ diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h index 5980bf16718..0b8970423b6 100644 --- a/src/libs/utils/theme/theme.h +++ b/src/libs/utils/theme/theme.h @@ -318,11 +318,7 @@ public: IconOverlayPrf, IconOverlayPro, StandardPixmapFileIcon, - StandardPixmapDirIcon, - BuildStepDisable, - BuildStepRemove, - BuildStepMoveDown, - BuildStepMoveUp + StandardPixmapDirIcon }; enum Flag { diff --git a/src/libs/utils/utils.qrc b/src/libs/utils/utils.qrc index 6378073fc12..9c6e7c6a08a 100644 --- a/src/libs/utils/utils.qrc +++ b/src/libs/utils/utils.qrc @@ -31,7 +31,6 @@ images/notloaded@2x.png images/ok.png images/ok@2x.png - images/clean_pane_small.png images/clean_pane_small@2x.png images/compile_error_taskbar.png @@ -161,5 +160,13 @@ images/bookmark@2x.png images/snapshot.png images/snapshot@2x.png + images/zoomin_overlay.png + images/zoomin_overlay@2x.png + images/zoomout_overlay.png + images/zoomout_overlay@2x.png + images/fittoview.png + images/fittoview@2x.png + images/namespace.png + images/namespace@2x.png diff --git a/src/libs/utils/utilsicons.cpp b/src/libs/utils/utilsicons.cpp index e81aa34af7f..94a32467b64 100644 --- a/src/libs/utils/utilsicons.cpp +++ b/src/libs/utils/utilsicons.cpp @@ -48,6 +48,14 @@ const Icon ZOOM({ {QLatin1String(":/utils/images/zoom.png"), Theme::PanelTextColorMid}}, Icon::Tint); const Icon ZOOM_TOOLBAR({ {QLatin1String(":/utils/images/zoom.png"), Theme::IconsBaseColor}}); +const Icon ZOOMIN_TOOLBAR({ + {QLatin1String(":/utils/images/zoom.png"), Theme::IconsBaseColor}, + {QLatin1String(":/utils/images/zoomin_overlay.png"), Theme::IconsBaseColor}}); +const Icon ZOOMOUT_TOOLBAR({ + {QLatin1String(":/utils/images/zoom.png"), Theme::IconsBaseColor}, + {QLatin1String(":/utils/images/zoomout_overlay.png"), Theme::IconsBaseColor}}); +const Icon FITTOVIEW_TOOLBAR({ + {QLatin1String(":/utils/images/fittoview.png"), Theme::IconsBaseColor}}); const Icon OK({ {QLatin1String(":/utils/images/ok.png"), Theme::IconsRunToolBarColor}}, Icon::Tint); const Icon NOTLOADED({ diff --git a/src/libs/utils/utilsicons.h b/src/libs/utils/utilsicons.h index 8a1dc4ed04c..747ebc3a36f 100644 --- a/src/libs/utils/utilsicons.h +++ b/src/libs/utils/utilsicons.h @@ -41,6 +41,9 @@ QTCREATOR_UTILS_EXPORT extern const Icon PREV; QTCREATOR_UTILS_EXPORT extern const Icon PREV_TOOLBAR; QTCREATOR_UTILS_EXPORT extern const Icon ZOOM; QTCREATOR_UTILS_EXPORT extern const Icon ZOOM_TOOLBAR; +QTCREATOR_UTILS_EXPORT extern const Icon ZOOMIN_TOOLBAR; +QTCREATOR_UTILS_EXPORT extern const Icon ZOOMOUT_TOOLBAR; +QTCREATOR_UTILS_EXPORT extern const Icon FITTOVIEW_TOOLBAR; QTCREATOR_UTILS_EXPORT extern const Icon OK; QTCREATOR_UTILS_EXPORT extern const Icon NOTLOADED; QTCREATOR_UTILS_EXPORT extern const Icon BROKEN; diff --git a/src/plugins/autotest/autotest.pro b/src/plugins/autotest/autotest.pro index 07d38fdab3a..9cf411299d4 100644 --- a/src/plugins/autotest/autotest.pro +++ b/src/plugins/autotest/autotest.pro @@ -102,7 +102,8 @@ HEADERS += \ quick/quicktestvisitors.h \ quick/quicktestframework.h \ testframeworkmanager.h \ - testrunconfiguration.h + testrunconfiguration.h \ + itestsettingspage.h RESOURCES += \ autotest.qrc diff --git a/src/plugins/autotest/autotest.qbs b/src/plugins/autotest/autotest.qbs index fcef33b454c..9552909ed7d 100644 --- a/src/plugins/autotest/autotest.qbs +++ b/src/plugins/autotest/autotest.qbs @@ -72,6 +72,7 @@ QtcPlugin { "itestparser.h", "itestframework.h", "iframeworksettings.h", + "itestsettingspage.h", "testframeworkmanager.cpp", "testframeworkmanager.h", "testrunconfiguration.h" diff --git a/src/plugins/autotest/autotestconstants.h b/src/plugins/autotest/autotestconstants.h index b4bef1400c1..7c1aaa0dac2 100644 --- a/src/plugins/autotest/autotestconstants.h +++ b/src/plugins/autotest/autotestconstants.h @@ -42,7 +42,7 @@ const char AUTOTEST_SETTINGS_CATEGORY[] = "ZY.Tests"; const char AUTOTEST_SETTINGS_TR[] = QT_TRANSLATE_NOOP("AutoTest", "Test Settings"); const char FRAMEWORK_PREFIX[] = "AutoTest.Framework."; - +const char SETTINGSPAGE_PREFIX[] = "A.AutoTest."; const char SETTINGSGROUP[] = "Autotest"; } // namespace Constants } // namespace Autotest diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp index abde0d4d69a..976bee11c85 100644 --- a/src/plugins/autotest/autotestplugin.cpp +++ b/src/plugins/autotest/autotestplugin.cpp @@ -95,6 +95,7 @@ void AutotestPlugin::initializeMenuEntries() { ActionContainer *menu = ActionManager::createMenu(Constants::MENU_ID); menu->menu()->setTitle(tr("&Tests")); + menu->setOnAllDisabledBehavior(ActionContainer::Show); QAction *action = new QAction(tr("Run &All Tests"), this); Command *command = ActionManager::registerAction(action, Constants::ACTION_RUN_ALL_ID); diff --git a/src/plugins/autotest/gtest/gtestframework.cpp b/src/plugins/autotest/gtest/gtestframework.cpp index 4ec6cd9962d..3117e9d3f1b 100644 --- a/src/plugins/autotest/gtest/gtestframework.cpp +++ b/src/plugins/autotest/gtest/gtestframework.cpp @@ -61,9 +61,9 @@ IFrameworkSettings *GTestFramework::createFrameworkSettings() const return new GTestSettings; } -Core::IOptionsPage *GTestFramework::createSettingsPage(QSharedPointer settings) const +ITestSettingsPage *GTestFramework::createSettingsPage(QSharedPointer settings) const { - return new GTestSettingsPage(settings); + return new GTestSettingsPage(settings, this); } bool GTestFramework::hasFrameworkSettings() const diff --git a/src/plugins/autotest/gtest/gtestframework.h b/src/plugins/autotest/gtest/gtestframework.h index 6645da15336..42c91118f52 100644 --- a/src/plugins/autotest/gtest/gtestframework.h +++ b/src/plugins/autotest/gtest/gtestframework.h @@ -37,7 +37,7 @@ public: const char *name() const override; unsigned priority() const override; IFrameworkSettings *createFrameworkSettings() const override; - Core::IOptionsPage *createSettingsPage(QSharedPointer settings) const override; + ITestSettingsPage *createSettingsPage(QSharedPointer settings) const override; bool hasFrameworkSettings() const override; protected: ITestParser *createTestParser() const override; diff --git a/src/plugins/autotest/gtest/gtestsettingspage.cpp b/src/plugins/autotest/gtest/gtestsettingspage.cpp index 77b34d0d45d..932fc947dea 100644 --- a/src/plugins/autotest/gtest/gtestsettingspage.cpp +++ b/src/plugins/autotest/gtest/gtestsettingspage.cpp @@ -65,18 +65,14 @@ GTestSettings GTestSettingsWidget::settings() const return result; } -GTestSettingsPage::GTestSettingsPage(QSharedPointer settings) - : m_settings(qSharedPointerCast(settings)), m_widget(0) +GTestSettingsPage::GTestSettingsPage(QSharedPointer settings, + const ITestFramework *framework) + : ITestSettingsPage(framework), + m_settings(qSharedPointerCast(settings)), + m_widget(0) { - setId("A.AutoTest.10.GTest"); // FIXME setDisplayName(QCoreApplication::translate("GTestFramework", GTest::Constants::FRAMEWORK_SETTINGS_CATEGORY)); - setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY); - setDisplayCategory(QCoreApplication::translate("AutoTest", Constants::AUTOTEST_SETTINGS_TR)); -} - -GTestSettingsPage::~GTestSettingsPage() -{ } QWidget *GTestSettingsPage::widget() diff --git a/src/plugins/autotest/gtest/gtestsettingspage.h b/src/plugins/autotest/gtest/gtestsettingspage.h index cdef183de09..c17753be4b5 100644 --- a/src/plugins/autotest/gtest/gtestsettingspage.h +++ b/src/plugins/autotest/gtest/gtestsettingspage.h @@ -27,7 +27,7 @@ #include "ui_gtestsettingspage.h" -#include +#include "../itestsettingspage.h" #include @@ -50,12 +50,11 @@ private: Ui::GTestSettingsPage m_ui; }; -class GTestSettingsPage : public Core::IOptionsPage +class GTestSettingsPage : public ITestSettingsPage { Q_OBJECT public: - explicit GTestSettingsPage(QSharedPointer settings); - ~GTestSettingsPage(); + GTestSettingsPage(QSharedPointer settings, const ITestFramework *framework); QWidget *widget() override; void apply() override; diff --git a/src/plugins/autotest/itestframework.h b/src/plugins/autotest/itestframework.h index d752da02506..ae6e0ec437c 100644 --- a/src/plugins/autotest/itestframework.h +++ b/src/plugins/autotest/itestframework.h @@ -28,12 +28,11 @@ #include "testtreeitem.h" #include "itestparser.h" -namespace Core { class IOptionsPage; } - namespace Autotest { namespace Internal { class IFrameworkSettings; +class ITestSettingsPage; class ITestFramework { @@ -49,7 +48,7 @@ public: virtual unsigned priority() const = 0; // should this be modifyable? virtual bool hasFrameworkSettings() const { return false; } virtual IFrameworkSettings *createFrameworkSettings() const { return 0; } - virtual Core::IOptionsPage *createSettingsPage(QSharedPointer settings) const + virtual ITestSettingsPage *createSettingsPage(QSharedPointer settings) const { Q_UNUSED(settings); return 0; diff --git a/src/plugins/qbsprojectmanager/qbsconstants.h b/src/plugins/autotest/itestsettingspage.h similarity index 50% rename from src/plugins/qbsprojectmanager/qbsconstants.h rename to src/plugins/autotest/itestsettingspage.h index 8ed4ace4a61..cce44e8bc3f 100644 --- a/src/plugins/qbsprojectmanager/qbsconstants.h +++ b/src/plugins/autotest/itestsettingspage.h @@ -25,30 +25,46 @@ #pragma once -namespace QbsProjectManager { -namespace Constants { +#include "autotestconstants.h" +#include "itestframework.h" -// Toolchain related settings: -const char QBS_TARGETOS[] = "qbs.targetOS"; -const char QBS_SYSROOT[] = "qbs.sysroot"; -const char QBS_ARCHITECTURE[] = "qbs.architecture"; -const char QBS_TOOLCHAIN[] = "qbs.toolchain"; -const char CPP_TOOLCHAINPATH[] = "cpp.toolchainInstallPath"; -const char CPP_TOOLCHAINPREFIX[] = "cpp.toolchainPrefix"; -const char CPP_COMPILERNAME[] = "cpp.compilerName"; -const char CPP_CXXCOMPILERNAME[] = "cpp.cxxCompilerName"; -const char CPP_PLATFORMCOMMONCOMPILERFLAGS[] = "cpp.platformCommonCompilerFlags"; -const char CPP_PLATFORMLINKERFLAGS[] = "cpp.platformLinkerFlags"; -const char CPP_PLATFORMPATH[] = "cpp.platformPath"; -const char CPP_XCODESDKNAME[] = "cpp.xcodeSdkName"; -const char CPP_XCODESDKVERSION[] = "cpp.xcodeSdkVersion"; +#include -// Settings page -const char QBS_SETTINGS_CATEGORY[] = "YM.qbs"; -const char QBS_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("QbsProjectManager", "Qbs"); -const char QBS_SETTINGS_CATEGORY_ICON[] = ":/projectexplorer/images/build.png"; +namespace Autotest { +namespace Internal { -const char QBS_PROPERTIES_KEY_FOR_KITS[] = "QbsProjectManager.qbs-properties"; +class IFrameworkSettings; -} // namespace Constants -} // namespace QbsProjectManager +class ITestSettingsPage : public Core::IOptionsPage +{ +public: + explicit ITestSettingsPage(const ITestFramework *framework) + { + setId(Core::Id(Constants::SETTINGSPAGE_PREFIX).withSuffix( + QString("%1.%2").arg(framework->priority()).arg(QLatin1String(framework->name())))); + setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY); + setDisplayCategory(QCoreApplication::translate("AutoTest", + Constants::AUTOTEST_SETTINGS_TR)); + } + + virtual ~ITestSettingsPage() {} + +private: + void setId(Core::Id id) + { + Core::IOptionsPage::setId(id); + } + + void setCategory(Core::Id category) + { + Core::IOptionsPage::setCategory(category); + } + + void setDisplayCategory(const QString &displayCategory) + { + Core::IOptionsPage::setDisplayCategory(displayCategory); + } +}; + +} // namespace Internal +} // namespace Autotest diff --git a/src/plugins/autotest/qtest/qttestframework.cpp b/src/plugins/autotest/qtest/qttestframework.cpp index 8bcefb248b0..25250e83bc6 100644 --- a/src/plugins/autotest/qtest/qttestframework.cpp +++ b/src/plugins/autotest/qtest/qttestframework.cpp @@ -51,9 +51,9 @@ IFrameworkSettings *QtTestFramework::createFrameworkSettings() const return new QtTestSettings; } -Core::IOptionsPage *QtTestFramework::createSettingsPage(QSharedPointer settings) const +ITestSettingsPage *QtTestFramework::createSettingsPage(QSharedPointer settings) const { - return new QtTestSettingsPage(settings); + return new QtTestSettingsPage(settings, this); } bool QtTestFramework::hasFrameworkSettings() const diff --git a/src/plugins/autotest/qtest/qttestframework.h b/src/plugins/autotest/qtest/qttestframework.h index a6cfcb9f2a5..e9a181591ff 100644 --- a/src/plugins/autotest/qtest/qttestframework.h +++ b/src/plugins/autotest/qtest/qttestframework.h @@ -37,7 +37,7 @@ public: const char *name() const override; unsigned priority() const override; IFrameworkSettings *createFrameworkSettings() const override; - Core::IOptionsPage *createSettingsPage(QSharedPointer settings) const override; + ITestSettingsPage *createSettingsPage(QSharedPointer settings) const override; bool hasFrameworkSettings() const override; protected: diff --git a/src/plugins/autotest/qtest/qttestsettingspage.cpp b/src/plugins/autotest/qtest/qttestsettingspage.cpp index fbaf252fdaf..54e081a02d3 100644 --- a/src/plugins/autotest/qtest/qttestsettingspage.cpp +++ b/src/plugins/autotest/qtest/qttestsettingspage.cpp @@ -86,18 +86,14 @@ QtTestSettings QtTestSettingsWidget::settings() const return result; } -QtTestSettingsPage::QtTestSettingsPage(QSharedPointer settings) - : m_settings(qSharedPointerCast(settings)), m_widget(0) +QtTestSettingsPage::QtTestSettingsPage(QSharedPointer settings, + const ITestFramework *framework) + : ITestSettingsPage(framework), + m_settings(qSharedPointerCast(settings)), + m_widget(0) { - setId("A.AutoTest.1.QtTest"); // FIXME setDisplayName(QCoreApplication::translate("QtTestFramework", QtTest::Constants::FRAMEWORK_SETTINGS_CATEGORY)); - setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY); - setDisplayCategory(QCoreApplication::translate("AutoTest", Constants::AUTOTEST_SETTINGS_TR)); -} - -QtTestSettingsPage::~QtTestSettingsPage() -{ } QWidget *QtTestSettingsPage::widget() diff --git a/src/plugins/autotest/qtest/qttestsettingspage.h b/src/plugins/autotest/qtest/qttestsettingspage.h index 2b5c64d5340..abfca142c96 100644 --- a/src/plugins/autotest/qtest/qttestsettingspage.h +++ b/src/plugins/autotest/qtest/qttestsettingspage.h @@ -27,7 +27,7 @@ #include "ui_qttestsettingspage.h" -#include +#include "../itestsettingspage.h" #include @@ -50,12 +50,11 @@ private: Ui::QtTestSettingsPage m_ui; }; -class QtTestSettingsPage : public Core::IOptionsPage +class QtTestSettingsPage : public ITestSettingsPage { Q_OBJECT public: - explicit QtTestSettingsPage(QSharedPointer settings); - ~QtTestSettingsPage(); + QtTestSettingsPage(QSharedPointer settings, const ITestFramework *framework); QWidget *widget() override; void apply() override; diff --git a/src/plugins/autotest/testcodeparser.cpp b/src/plugins/autotest/testcodeparser.cpp index a30cd608a51..2cbf9f703e5 100644 --- a/src/plugins/autotest/testcodeparser.cpp +++ b/src/plugins/autotest/testcodeparser.cpp @@ -45,7 +45,6 @@ #include #include #include -#include static Q_LOGGING_CATEGORY(LOG, "qtc.autotest.testcodeparser") @@ -54,13 +53,7 @@ namespace Internal { TestCodeParser::TestCodeParser(TestTreeModel *parent) : QObject(parent), - m_model(parent), - m_codeModelParsing(false), - m_fullUpdatePostponed(false), - m_partialUpdatePostponed(false), - m_dirty(false), - m_singleShotScheduled(false), - m_parserState(Disabled) + m_model(parent) { // connect to ProgressManager to postpone test parsing when CppModelManager is parsing auto progressManager = qobject_cast(Core::ProgressManager::instance()); @@ -77,6 +70,8 @@ TestCodeParser::TestCodeParser(TestTreeModel *parent) emit testParseResultReady(m_futureWatcher.resultAt(index)); }); connect(this, &TestCodeParser::parsingFinished, this, &TestCodeParser::releaseParserInternals); + m_reparseTimer.setSingleShot(true); + connect(&m_reparseTimer, &QTimer::timeout, this, &TestCodeParser::parsePostponedFiles); } TestCodeParser::~TestCodeParser() @@ -111,7 +106,8 @@ void TestCodeParser::setState(State state) } else if (m_partialUpdatePostponed) { m_partialUpdatePostponed = false; qCDebug(LOG) << "calling scanForTests with postponed files (setState)"; - scanForTests(m_postponedFiles.toList()); + if (!m_reparseTimer.isActive()) + scanForTests(m_postponedFiles.toList()); } } } @@ -267,6 +263,30 @@ bool TestCodeParser::postponed(const QStringList &fileList) { switch (m_parserState) { case Idle: + if (fileList.size() == 1) { + if (m_reparseTimerTimedOut) + return false; + switch (m_postponedFiles.size()) { + case 0: + m_postponedFiles.insert(fileList.first()); + m_reparseTimer.setInterval(1000); + m_reparseTimer.start(); + return true; + case 1: + if (m_postponedFiles.contains(fileList.first())) { + m_reparseTimer.start(); + return true; + } + // intentional fall-through + default: + m_postponedFiles.insert(fileList.first()); + m_reparseTimer.stop(); + m_reparseTimer.setInterval(0); + m_reparseTimerTimedOut = false; + m_reparseTimer.start(); + return true; + } + } return false; case PartialParse: case FullParse: @@ -313,6 +333,8 @@ void TestCodeParser::scanForTests(const QStringList &fileList) if (postponed(fileList)) return; + m_reparseTimer.stop(); + m_reparseTimerTimedOut = false; m_postponedFiles.clear(); bool isFullParse = fileList.isEmpty(); QStringList list; @@ -436,7 +458,8 @@ void TestCodeParser::onPartialParsingFinished() } else if (m_partialUpdatePostponed) { m_partialUpdatePostponed = false; qCDebug(LOG) << "calling scanForTests with postponed files (onPartialParsingFinished)"; - scanForTests(m_postponedFiles.toList()); + if (!m_reparseTimer.isActive()) + scanForTests(m_postponedFiles.toList()); } else { m_dirty |= m_codeModelParsing; if (m_dirty) { @@ -454,6 +477,12 @@ void TestCodeParser::onPartialParsingFinished() } } +void TestCodeParser::parsePostponedFiles() +{ + m_reparseTimerTimedOut = true; + scanForTests(m_postponedFiles.toList()); +} + void TestCodeParser::releaseParserInternals() { for (ITestParser *parser : m_testCodeParsers) diff --git a/src/plugins/autotest/testcodeparser.h b/src/plugins/autotest/testcodeparser.h index ac095c14aac..9967c3d08b8 100644 --- a/src/plugins/autotest/testcodeparser.h +++ b/src/plugins/autotest/testcodeparser.h @@ -32,6 +32,7 @@ #include #include #include +#include namespace Core { class Id; @@ -89,19 +90,22 @@ private: void onAllTasksFinished(Core::Id type); void onFinished(); void onPartialParsingFinished(); + void parsePostponedFiles(); void releaseParserInternals(); TestTreeModel *m_model; - bool m_codeModelParsing; - bool m_fullUpdatePostponed; - bool m_partialUpdatePostponed; - bool m_dirty; - bool m_singleShotScheduled; + bool m_codeModelParsing = false; + bool m_fullUpdatePostponed = false; + bool m_partialUpdatePostponed = false; + bool m_dirty = false; + bool m_singleShotScheduled = false; + bool m_reparseTimerTimedOut = false; QSet m_postponedFiles; - State m_parserState; + State m_parserState = Disabled; QFutureWatcher m_futureWatcher; QVector m_testCodeParsers; // ptrs are still owned by TestFrameworkManager + QTimer m_reparseTimer; }; } // namespace Internal diff --git a/src/plugins/autotest/testframeworkmanager.cpp b/src/plugins/autotest/testframeworkmanager.cpp index 0b65a79e179..16a33d74251 100644 --- a/src/plugins/autotest/testframeworkmanager.cpp +++ b/src/plugins/autotest/testframeworkmanager.cpp @@ -29,12 +29,12 @@ #include "iframeworksettings.h" #include "itestframework.h" #include "itestparser.h" +#include "itestsettingspage.h" #include "testrunner.h" #include "testsettings.h" #include "testtreeitem.h" #include "testtreemodel.h" -#include #include #include diff --git a/src/plugins/autotest/testresultdelegate.cpp b/src/plugins/autotest/testresultdelegate.cpp index 66365c8780a..b39f232fb5c 100644 --- a/src/plugins/autotest/testresultdelegate.cpp +++ b/src/plugins/autotest/testresultdelegate.cpp @@ -130,7 +130,7 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op } painter->setClipRect(opt.rect); - painter->setPen(opt.palette.midlight().color()); + painter->setPen(opt.palette.mid().color()); painter->drawLine(0, opt.rect.bottom(), opt.rect.right(), opt.rect.bottom()); painter->restore(); } diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 0f4b6c9c241..d2a8781bcf5 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -208,8 +208,6 @@ void TestResultsPane::addTestResult(const TestResultPtr &result) m_atEnd = scrollBar ? scrollBar->value() == scrollBar->maximum() : true; m_model->addTestResult(result, m_expandCollapse->isChecked()); - if (!m_treeView->isVisible()) - popup(Core::IOutputPane::NoModeSwitch); setIconBadgeNumber(m_model->resultTypeCount(Result::Fail) + m_model->resultTypeCount(Result::UnexpectedPass)); flash(); @@ -498,6 +496,8 @@ void TestResultsPane::onTestRunFinished() m_model->removeCurrentTestMessage(); disconnect(m_treeView->verticalScrollBar(), &QScrollBar::rangeChanged, this, &TestResultsPane::onScrollBarRangeChanged); + if (!m_treeView->isVisible()) + popup(Core::IOutputPane::NoModeSwitch); } void TestResultsPane::onScrollBarRangeChanged(int, int max) diff --git a/src/plugins/baremetal/baremetal.pro b/src/plugins/baremetal/baremetal.pro index b79db4aac5c..f77ad11412a 100644 --- a/src/plugins/baremetal/baremetal.pro +++ b/src/plugins/baremetal/baremetal.pro @@ -47,3 +47,6 @@ HEADERS += baremetalplugin.h \ openocdgdbserverprovider.h \ defaultgdbserverprovider.h \ stlinkutilgdbserverprovider.h + +RESOURCES += \ + baremetal.qrc diff --git a/src/plugins/baremetal/baremetal.qbs b/src/plugins/baremetal/baremetal.qbs index 81b4503f7d7..0474e562d13 100644 --- a/src/plugins/baremetal/baremetal.qbs +++ b/src/plugins/baremetal/baremetal.qbs @@ -13,6 +13,7 @@ QtcPlugin { Depends { name: "QtSupport" } files: [ + "baremetal.qrc", "baremetalconstants.h", "baremetalcustomrunconfiguration.cpp", "baremetalcustomrunconfiguration.h", "baremetaldevice.cpp", "baremetaldevice.h", diff --git a/src/plugins/baremetal/baremetal.qrc b/src/plugins/baremetal/baremetal.qrc new file mode 100644 index 00000000000..8badc224d0d --- /dev/null +++ b/src/plugins/baremetal/baremetal.qrc @@ -0,0 +1,8 @@ + + + images/baremetaldevice.png + images/baremetaldevice@2x.png + images/baremetaldevicesmall.png + images/baremetaldevicesmall@2x.png + + diff --git a/src/plugins/baremetal/baremetaldevice.cpp b/src/plugins/baremetal/baremetaldevice.cpp index 67c80b7c410..643355c06a8 100644 --- a/src/plugins/baremetal/baremetaldevice.cpp +++ b/src/plugins/baremetal/baremetaldevice.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -152,16 +153,28 @@ DeviceProcess *BareMetalDevice::createProcess(QObject *parent) const return new GdbServerProviderProcess(sharedFromThis(), parent); } +static const QList &bareMetalDeviceIcon() +{ + static const QList icon = { + Utils::Icon({{":/baremetal/images/baremetaldevicesmall.png", + Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint), + Utils::Icon({{":/baremetal/images/baremetaldevice.png", + Utils::Theme::IconsBaseColor}})}; + return icon; +} + BareMetalDevice::BareMetalDevice(const QString &name, Core::Id type, MachineType machineType, Origin origin, Core::Id id) : IDevice(type, origin, machineType, id) { setDisplayName(name); + setDeviceIcon(bareMetalDeviceIcon()); } BareMetalDevice::BareMetalDevice(const BareMetalDevice &other) : IDevice(other) { setGdbServerProviderId(other.gdbServerProviderId()); + setDeviceIcon(bareMetalDeviceIcon()); } } //namespace Internal diff --git a/src/plugins/baremetal/images/baremetaldevice.png b/src/plugins/baremetal/images/baremetaldevice.png new file mode 100644 index 00000000000..34ac48c118a Binary files /dev/null and b/src/plugins/baremetal/images/baremetaldevice.png differ diff --git a/src/plugins/baremetal/images/baremetaldevice@2x.png b/src/plugins/baremetal/images/baremetaldevice@2x.png new file mode 100644 index 00000000000..d1341f90ee6 Binary files /dev/null and b/src/plugins/baremetal/images/baremetaldevice@2x.png differ diff --git a/src/plugins/baremetal/images/baremetaldevicesmall.png b/src/plugins/baremetal/images/baremetaldevicesmall.png new file mode 100644 index 00000000000..19aeca1b357 Binary files /dev/null and b/src/plugins/baremetal/images/baremetaldevicesmall.png differ diff --git a/src/plugins/baremetal/images/baremetaldevicesmall@2x.png b/src/plugins/baremetal/images/baremetaldevicesmall@2x.png new file mode 100644 index 00000000000..633f0d847a8 Binary files /dev/null and b/src/plugins/baremetal/images/baremetaldevicesmall@2x.png differ diff --git a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp index 1275ab81cd3..265069ec7f7 100644 --- a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp +++ b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp @@ -190,7 +190,7 @@ private: const QString text = QString::fromLatin1( "" " " - " " + " " " " " " "
%1: %1: %2
") diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp index fc02e1b21fb..4e5a05d68e3 100644 --- a/src/plugins/coreplugin/variablechooser.cpp +++ b/src/plugins/coreplugin/variablechooser.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -257,7 +258,10 @@ VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent) m_variableTree = new VariableTreeView(q, this); m_variableDescription = new QLabel(q); - m_variableTree->setModel(&m_model); + auto sorter = new QSortFilterProxyModel(this); + sorter->setSourceModel(&m_model); + sorter->sort(0); + m_variableTree->setModel(sorter); m_variableDescription->setText(m_defaultDescription); m_variableDescription->setMinimumSize(QSize(0, 60)); m_variableDescription->setAlignment(Qt::AlignLeft|Qt::AlignTop); diff --git a/src/plugins/imageviewer/imageviewer.cpp b/src/plugins/imageviewer/imageviewer.cpp index 02a6c9dca24..b891524d1c7 100644 --- a/src/plugins/imageviewer/imageviewer.cpp +++ b/src/plugins/imageviewer/imageviewer.cpp @@ -107,9 +107,9 @@ void ImageViewer::ctor() {QLatin1String(":/utils/images/desktopdevicesmall.png"), Utils::Theme::IconsBaseColor}}); d->ui_toolbar.toolButtonBackground->setIcon(backgroundIcon.icon()); d->ui_toolbar.toolButtonOutline->setIcon(Utils::Icons::BOUNDING_RECT.icon()); - d->ui_toolbar.toolButtonZoomIn->setIcon(Utils::Icons::PLUS_TOOLBAR.icon()); - d->ui_toolbar.toolButtonZoomOut->setIcon(Utils::Icons::MINUS.icon()); - d->ui_toolbar.toolButtonFitToScreen->setIcon(Utils::Icons::ZOOM_TOOLBAR.icon()); + d->ui_toolbar.toolButtonZoomIn->setIcon(Utils::Icons::ZOOMIN_TOOLBAR.icon()); + d->ui_toolbar.toolButtonZoomOut->setIcon(Utils::Icons::ZOOMOUT_TOOLBAR.icon()); + d->ui_toolbar.toolButtonFitToScreen->setIcon(Utils::Icons::FITTOVIEW_TOOLBAR.icon()); d->ui_toolbar.toolButtonOriginalSize->setIcon(Utils::Icons::EYE_OPEN_TOOLBAR.icon()); // icons update - try to use system theme updateButtonIconByTheme(d->ui_toolbar.toolButtonZoomIn, QLatin1String("zoom-in")); diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index 49ebd5e8564..c62d9aa60f6 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -280,7 +280,7 @@ class TargetItem : public TypedTreeItem Q_DECLARE_TR_FUNCTIONS(TargetSettingsPanelWidget) public: - enum { DefaultPage = 1 }; // Run page. + enum { DefaultPage = 0 }; // Build page. TargetItem(Project *project, Id kitId) : m_project(project), m_kitId(kitId) @@ -802,7 +802,7 @@ void TargetGroupItemPrivate::handleAddedKit(Kit *kit) void TargetItem::updateSubItems() { if (children().isEmpty() && isEnabled()) - m_currentChild = 1; // We will add children below. Use 'Run' item by default. + m_currentChild = DefaultPage; // We will add children below. removeChildren(); if (isEnabled()) { appendChild(new BuildOrRunItem(m_project, m_kitId, BuildOrRunItem::BuildPage)); diff --git a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp index a83e814a300..703f41305b5 100644 --- a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp +++ b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp @@ -24,7 +24,7 @@ ****************************************************************************/ #include "defaultpropertyprovider.h" -#include "qbsconstants.h" +#include "qbsprojectmanagerconstants.h" #include #include diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 9c20578393e..fddbade83b0 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -62,6 +62,42 @@ static const char QBS_CLEAN_INSTALL_ROOT[] = "Qbs.CleanInstallRoot"; namespace QbsProjectManager { namespace Internal { +class QbsBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget +{ + Q_OBJECT +public: + QbsBuildStepConfigWidget(QbsBuildStep *step); + ~QbsBuildStepConfigWidget(); + QString summaryText() const; + QString displayName() const; + +private: + void updateState(); + void updateQmlDebuggingOption(); + void updatePropertyEdit(const QVariantMap &data); + + void changeBuildVariant(int); + void changeShowCommandLines(bool show); + void changeKeepGoing(bool kg); + void changeJobCount(int count); + void changeInstall(bool install); + void changeCleanInstallRoot(bool clean); + void changeForceProbes(bool forceProbes); + void applyCachedProperties(); + + // QML debugging: + void linkQmlDebuggingLibraryChecked(bool checked); + + bool validateProperties(Utils::FancyLineEdit *edit, QString *errorMessage); + + Ui::QbsBuildStepConfigWidget *m_ui; + + QList > m_propertyCache; + QbsBuildStep *m_step; + QString m_summary; + bool m_ignoreChange; +}; + // -------------------------------------------------------------------- // QbsBuildStep: // -------------------------------------------------------------------- @@ -752,3 +788,5 @@ ProjectExplorer::BuildStep *QbsBuildStepFactory::clone(ProjectExplorer::BuildSte } // namespace Internal } // namespace QbsProjectManager + +#include "qbsbuildstep.moc" diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.h b/src/plugins/qbsprojectmanager/qbsbuildstep.h index 5264b2fa35b..365507ac4f9 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.h +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.h @@ -125,44 +125,6 @@ private: friend class QbsBuildStepConfigWidget; }; -namespace Ui { class QbsBuildStepConfigWidget; } - -class QbsBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget -{ - Q_OBJECT -public: - QbsBuildStepConfigWidget(QbsBuildStep *step); - ~QbsBuildStepConfigWidget(); - QString summaryText() const; - QString displayName() const; - -private: - void updateState(); - void updateQmlDebuggingOption(); - void updatePropertyEdit(const QVariantMap &data); - - void changeBuildVariant(int); - void changeShowCommandLines(bool show); - void changeKeepGoing(bool kg); - void changeJobCount(int count); - void changeInstall(bool install); - void changeCleanInstallRoot(bool clean); - void changeForceProbes(bool forceProbes); - void applyCachedProperties(); - - // QML debugging: - void linkQmlDebuggingLibraryChecked(bool checked); - - bool validateProperties(Utils::FancyLineEdit *edit, QString *errorMessage); - - Ui::QbsBuildStepConfigWidget *m_ui; - - QList > m_propertyCache; - QbsBuildStep *m_step; - QString m_summary; - bool m_ignoreChange; -}; - class QbsBuildStepFactory : public ProjectExplorer::IBuildStepFactory { Q_OBJECT diff --git a/src/plugins/qbsprojectmanager/qbsinfopage.cpp b/src/plugins/qbsprojectmanager/qbsinfopage.cpp index af65f9e5be6..794d984a613 100644 --- a/src/plugins/qbsprojectmanager/qbsinfopage.cpp +++ b/src/plugins/qbsprojectmanager/qbsinfopage.cpp @@ -26,7 +26,7 @@ #include "qbsinfopage.h" #include "ui_qbsinfowidget.h" -#include "qbsconstants.h" +#include "qbsprojectmanagerconstants.h" #include diff --git a/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp index e576f52778f..112572b73e1 100644 --- a/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp +++ b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp @@ -27,8 +27,8 @@ #include "ui_qbsprofilessettingswidget.h" #include "customqbspropertiesdialog.h" -#include "qbsconstants.h" #include "qbsprojectmanager.h" +#include "qbsprojectmanagerconstants.h" #include "qbsprojectmanagersettings.h" #include diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro index cd2e5d16d83..94afeae5a76 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro @@ -41,8 +41,7 @@ HEADERS = \ qbsprojectmanagerplugin.h \ qbsprojectmanagersettings.h \ qbsprojectparser.h \ - qbsrunconfiguration.h \ - qbsconstants.h + qbsrunconfiguration.h SOURCES = \ customqbspropertiesdialog.cpp \ diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs index 7b0434920e2..98ce172aa13 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs @@ -75,7 +75,6 @@ QtcPlugin { "qbscleanstep.cpp", "qbscleanstep.h", "qbscleanstepconfigwidget.ui", - "qbsconstants.h", "qbsdeployconfigurationfactory.cpp", "qbsdeployconfigurationfactory.h", "qbsinfopage.cpp", diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerconstants.h b/src/plugins/qbsprojectmanager/qbsprojectmanagerconstants.h index 05667062f53..36fd3cfb28e 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerconstants.h +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerconstants.h @@ -65,6 +65,28 @@ const char QBS_FORCE_PROBES_KEY[] = "qbspm.forceProbes"; static const char QBS_GROUP_ICON[] = ":/qbsprojectmanager/images/groups.png"; static const char QBS_PRODUCT_OVERLAY_ICON[] = ":/qbsprojectmanager/images/productgear.png"; +// Toolchain related settings: +const char QBS_TARGETOS[] = "qbs.targetOS"; +const char QBS_SYSROOT[] = "qbs.sysroot"; +const char QBS_ARCHITECTURE[] = "qbs.architecture"; +const char QBS_TOOLCHAIN[] = "qbs.toolchain"; +const char CPP_TOOLCHAINPATH[] = "cpp.toolchainInstallPath"; +const char CPP_TOOLCHAINPREFIX[] = "cpp.toolchainPrefix"; +const char CPP_COMPILERNAME[] = "cpp.compilerName"; +const char CPP_CXXCOMPILERNAME[] = "cpp.cxxCompilerName"; +const char CPP_PLATFORMCOMMONCOMPILERFLAGS[] = "cpp.platformCommonCompilerFlags"; +const char CPP_PLATFORMLINKERFLAGS[] = "cpp.platformLinkerFlags"; +const char CPP_PLATFORMPATH[] = "cpp.platformPath"; +const char CPP_XCODESDKNAME[] = "cpp.xcodeSdkName"; +const char CPP_XCODESDKVERSION[] = "cpp.xcodeSdkVersion"; + +// Settings page +const char QBS_SETTINGS_CATEGORY[] = "YM.qbs"; +const char QBS_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("QbsProjectManager", "Qbs"); +const char QBS_SETTINGS_CATEGORY_ICON[] = ":/projectexplorer/images/build.png"; + +const char QBS_PROPERTIES_KEY_FOR_KITS[] = "QbsProjectManager.qbs-properties"; + const char QBS_PROFILING_ENV[] = "QTC_QBS_PROFILING"; } // namespace Constants diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 616f14a0026..e194c73882e 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -622,19 +622,13 @@ QStringList QmakePriFileNode::fullVPaths(const QStringList &baseVPaths, QtSuppor QSet QmakePriFileNode::recursiveEnumerate(const QString &folder) { QSet result; - QFileInfo fi(folder); - if (fi.isDir()) { - QDir dir(folder); - dir.setFilter(dir.filter() | QDir::NoDotAndDotDot); - - foreach (const QFileInfo &file, dir.entryInfoList()) { - if (file.isDir() && !file.isSymLink()) - result += recursiveEnumerate(file.absoluteFilePath()); - else if (!Core::EditorManager::isAutoSaveFile(file.fileName())) - result += FileName(file); - } - } else if (fi.exists()) { - result << FileName(fi); + QDir dir(folder); + dir.setFilter(dir.filter() | QDir::NoDotAndDotDot); + foreach (const QFileInfo &file, dir.entryInfoList()) { + if (file.isDir() && !file.isSymLink()) + result += recursiveEnumerate(file.absoluteFilePath()); + else if (!Core::EditorManager::isAutoSaveFile(file.fileName())) + result += FileName(file); } return result; } @@ -646,17 +640,15 @@ PriFileEvalResult QmakePriFileNode::extractValues(const EvalInput &input, { PriFileEvalResult result; - // Figure out DEPLOYMENT and INSTALL folders - QStringList dynamicVariables = dynamicVarNames(input.readerExact, input.readerCumulative, input.isQt5); + // Figure out DEPLOYMENT and INSTALL folders. + // Ignore stuff from cumulative parse, as we are recursively enumerating + // all the files from those folders and add watchers for them. That's too + // dangerous if we get the folders wrong and enumerate the whole project + // tree multiple times. + QStringList dynamicVariables = dynamicVarNames(input.readerExact, input.isQt5); foreach (ProFile *includeFileExact, includeFilesExact) - foreach (const QString &dynamicVar, dynamicVariables) { + foreach (const QString &dynamicVar, dynamicVariables) result.folders += input.readerExact->values(dynamicVar, includeFileExact); - // Ignore stuff from cumulative parse - // we are recursively enumerating all the files from those folders - // and add watchers for them, that's too dangerous if we get the folders - // wrong and enumerate the whole project tree multiple times - } - for (int i=0; i < result.folders.size(); ++i) { const QFileInfo fi(result.folders.at(i)); @@ -1376,10 +1368,11 @@ QStringList QmakePriFileNode::varNames(FileType type, QtSupport::ProFileReader * foreach (const QString &var, listOfExtraCompilers) { QStringList inputs = readerExact->values(var + QLatin1String(".input")); foreach (const QString &input, inputs) - // FORMS, RESOURCES, and STATECHARTS are handled below, HEADERS above + // FORMS, RESOURCES, and STATECHARTS are handled below, HEADERS and SOURCES above if (input != QLatin1String("FORMS") && input != QLatin1String("STATECHARTS") && input != QLatin1String("RESOURCES") + && input != QLatin1String("SOURCES") && input != QLatin1String("HEADERS")) vars << input; } @@ -1474,7 +1467,7 @@ QStringList QmakePriFileNode::varNamesForRemoving() return vars; } -QStringList QmakePriFileNode::dynamicVarNames(QtSupport::ProFileReader *readerExact, QtSupport::ProFileReader *readerCumulative, +QStringList QmakePriFileNode::dynamicVarNames(QtSupport::ProFileReader *readerExact, bool isQt5) { QStringList result; @@ -1486,12 +1479,6 @@ QStringList QmakePriFileNode::dynamicVarNames(QtSupport::ProFileReader *readerEx foreach (const QString &var, listOfVars) { result << (var + sources); } - if (readerCumulative) { - QStringList listOfVars = readerCumulative->values(deployment); - foreach (const QString &var, listOfVars) { - result << (var + sources); - } - } const QString installs = QLatin1String("INSTALLS"); const QString files = QLatin1String(".files"); @@ -1499,12 +1486,6 @@ QStringList QmakePriFileNode::dynamicVarNames(QtSupport::ProFileReader *readerEx foreach (const QString &var, listOfVars) { result << (var + files); } - if (readerCumulative) { - QStringList listOfVars = readerCumulative->values(installs); - foreach (const QString &var, listOfVars) { - result << (var + files); - } - } result.removeDuplicates(); return result; } @@ -1858,8 +1839,8 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input) if (result->state == EvalResult::EvalOk) { if (result->projectType == SubDirsTemplate) { QStringList errors; - result->errors.append(errors); FileNameList subDirs = subDirsPaths(input.readerExact, input.projectDir, &result->subProjectsNotToDeploy, &errors); + result->errors.append(errors); foreach (const Utils::FileName &subDirName, subDirs) { IncludedPriFile *subDir = new IncludedPriFile; diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.h b/src/plugins/qmakeprojectmanager/qmakenodes.h index 8d8d651c3fe..1bb881f482a 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.h +++ b/src/plugins/qmakeprojectmanager/qmakenodes.h @@ -180,7 +180,7 @@ protected: static QStringList varNames(ProjectExplorer::FileType type, QtSupport::ProFileReader *readerExact); static QStringList varNamesForRemoving(); static QString varNameForAdding(const QString &mimeType); - static QStringList dynamicVarNames(QtSupport::ProFileReader *readerExact, QtSupport::ProFileReader *readerCumulative, bool isQt5); + static QStringList dynamicVarNames(QtSupport::ProFileReader *readerExact, bool isQt5); static QSet filterFilesProVariables(ProjectExplorer::FileType fileType, const QSet &files); static QSet filterFilesRecursiveEnumerata(ProjectExplorer::FileType fileType, const QSet &files); diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index f2a433b06e0..db652823cc1 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -423,7 +423,6 @@ void QmakeProject::updateCppCodeModel() } QList generators; - QStringList allFiles; foreach (QmakeProFileNode *pro, proFiles) { warnOnToolChainMismatch(pro); @@ -465,11 +464,9 @@ void QmakeProject::updateCppCodeModel() { // C++ files: // part->files foreach (const QString &file, pro->variableValue(CppSourceVar)) { - allFiles << file; cppPart->files << ProjectFile(file, ProjectFile::CXXSource); } foreach (const QString &file, pro->variableValue(CppHeaderVar)) { - allFiles << file; cppPart->files << ProjectFile(file, ProjectFile::CXXHeader); } } @@ -477,13 +474,11 @@ void QmakeProject::updateCppCodeModel() ProjectPart::Ptr objcppPart = templatePart->copy(); { // ObjC++ files: foreach (const QString &file, pro->variableValue(ObjCSourceVar)) { - allFiles << file; // Although the enum constant is called ObjCSourceVar, it actually is ObjC++ source // code, as qmake does not handle C (and ObjC). objcppPart->files << ProjectFile(file, ProjectFile::ObjCXXSource); } foreach (const QString &file, pro->variableValue(ObjCHeaderVar)) { - allFiles << file; objcppPart->files << ProjectFile(file, ProjectFile::ObjCXXHeader); } @@ -505,7 +500,6 @@ void QmakeProject::updateCppCodeModel() foreach (ProjectExplorer::ExtraCompiler *ec, proGenerators) { ec->forEachTarget([&](const Utils::FileName &generatedFile) { QString name = generatedFile.toString(); - allFiles << name; ProjectFile::Kind kind = ProjectFile::classify(name); switch (kind) { case ProjectFile::CHeader: diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp index c2f52f6284f..7ba94adea81 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp @@ -31,6 +31,7 @@ #include "ui_qmakeprojectconfigwidget.h" #include +#include #include #include @@ -82,6 +83,9 @@ QmakeProjectConfigWidget::QmakeProjectConfigWidget(QmakeBuildConfiguration *bc) m_ui->inSourceBuildDirEdit->setReadOnly(true); m_ui->inSourceBuildDirEdit->setEnabled(false); + auto chooser = new Core::VariableChooser(this); + chooser->addSupportedWidget(m_ui->shadowBuildDirEdit->lineEdit()); + m_ui->shadowBuildCheckBox->setChecked(isShadowBuild); connect(m_ui->shadowBuildCheckBox, &QAbstractButton::clicked, diff --git a/src/plugins/qmakeprojectmanager/wizards/qtprojectparameters.cpp b/src/plugins/qmakeprojectmanager/wizards/qtprojectparameters.cpp index ed71f55b5ab..e97a4d1ab50 100644 --- a/src/plugins/qmakeprojectmanager/wizards/qtprojectparameters.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/qtprojectparameters.cpp @@ -112,6 +112,19 @@ void QtProjectParameters::writeProFile(QTextStream &str) const if (!targetDirectory.isEmpty()) str << "\nDESTDIR = " << targetDirectory << '\n'; + + if (qtVersionSupport != SupportQt4Only) { + str << "\n" + "# The following define makes your compiler emit warnings if you use\n" + "# any feature of Qt which as been marked as deprecated (the exact warnings\n" + "# depend on your compiler). Please consult the documentation of the\n" + "# deprecated API in order to know how to port your code away from it.\n" + "DEFINES += QT_DEPRECATED_WARNINGS\n\n" + "# You can also make your code fail to compile if you use deprecated APIs.\n" + "# In order to do so, uncomment the following line.\n" + "# You can also select to disable deprecated APIs only up to a certain version of Qt.\n" + "#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0\n"; + } } void QtProjectParameters::writeProFileHeader(QTextStream &str) diff --git a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp index a43c1985d00..bc5645ae24a 100644 --- a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp @@ -134,7 +134,6 @@ bool AbstractFormEditorTool::topSelectedItemIsMovable(const QList &/*itemList*/) { return false; @@ -149,6 +148,7 @@ QGraphicsItem *AbstractFormEditorTool::topMovableGraphicsItem(const QList &itemList, bool selectOnlyContentItems) { foreach (QGraphicsItem *item, itemList) { diff --git a/src/plugins/qmldesigner/components/resources/centerwidget.css b/src/plugins/qmldesigner/components/resources/centerwidget.css new file mode 100644 index 00000000000..fd2b8f6d1b1 --- /dev/null +++ b/src/plugins/qmldesigner/components/resources/centerwidget.css @@ -0,0 +1,33 @@ +QWidget#backgroundWidget { + background-color: creatorTheme.QmlDesignerTabDark +} + +QTabWidget#centralTabWidget::pane { + border: 0px; + background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate; +} + +QTabWidget#centralTabWidget::tab-bar { alignment: right; } + +QTabBar::tab:selected { + border: none; + background-color: creatorTheme.QmlDesignerTabLight; + color: creatorTheme.QmlDesignerTabDark; +} + +QTabBar#centralTabBar::tab { + width: 16px; + height: 80px; + + border-image: none; + background-color: creatorTheme.QmlDesignerTabDark; + color: creatorTheme.QmlDesignerTabLight; + + margin-top: 0x; + margin-bottom: 0px; + margin-left: 0px; + margin-right: 0px; + font: bold; + font-size: 11px; +} + diff --git a/src/plugins/qmldesigner/components/resources/resources.qrc b/src/plugins/qmldesigner/components/resources/resources.qrc index 8adecdd5db1..aeb286a4143 100644 --- a/src/plugins/qmldesigner/components/resources/resources.qrc +++ b/src/plugins/qmldesigner/components/resources/resources.qrc @@ -4,5 +4,6 @@ stylesheet.css scrollbar.css formeditorstylesheet.css + centerwidget.css diff --git a/src/plugins/qmldesigner/components/resources/stylesheet.css b/src/plugins/qmldesigner/components/resources/stylesheet.css index 126ac51b29e..2992e0e7fa2 100644 --- a/src/plugins/qmldesigner/components/resources/stylesheet.css +++ b/src/plugins/qmldesigner/components/resources/stylesheet.css @@ -21,22 +21,11 @@ QStackedWidget { background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate; } - QGraphicsView { border: 0px; background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate; } -QTabWidget { - border: 0px; - background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate; -} - -QTabWidget::pane { /* The tab widget frame */ - border: 0px; - background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate; -} - QLineEdit#itemLibrarySearchInput { color: creatorTheme.PanelTextColorLight; @@ -70,21 +59,30 @@ QLineEdit#itemLibrarySearchInput selection-color: #404040; } +QTabWidget { + border: 0px; + background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate; +} + +QTabWidget::pane { /* The tab widget frame */ + border: 0px; + background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate; +} + QTabBar::tab { - border-image: none; - width: 80px; - height: 22px; + + border-image: none; + background-color: creatorTheme.QmlDesignerTabDark; + color: creatorTheme.QmlDesignerTabLight; + margin-top: 0x; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; font: bold; - font-size: 11px; - background-color: creatorTheme.QmlDesignerTabDark; - - color: creatorTheme.QmlDesignerTabLight; + font-size: 11px; } QTabBar::tab:selected { diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index 819f39e8240..f507fb83619 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -141,16 +141,18 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV SLOT(processFinished(int,QProcess::ExitStatus))); } - if (m_qmlPuppetEditorProcess->waitForStarted(10000)) { + const int second = 1000; + const int waitConstant = 8 * second; + if (m_qmlPuppetEditorProcess->waitForStarted(waitConstant)) { connect(m_qmlPuppetEditorProcess.data(), static_cast(&QProcess::finished), m_qmlPuppetEditorProcess.data(), &QProcess::deleteLater); if (runModus == NormalModus) { - m_qmlPuppetPreviewProcess->waitForStarted(); + m_qmlPuppetPreviewProcess->waitForStarted(waitConstant / 2); connect(m_qmlPuppetPreviewProcess.data(), static_cast(&QProcess::finished), m_qmlPuppetPreviewProcess.data(), &QProcess::deleteLater); - m_qmlPuppetRenderProcess->waitForStarted(); + m_qmlPuppetRenderProcess->waitForStarted(waitConstant / 2); connect(m_qmlPuppetRenderProcess.data(), static_cast(&QProcess::finished), m_qmlPuppetRenderProcess.data(), &QProcess::deleteLater); } @@ -158,7 +160,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV bool connectedToPuppet = true; if (!m_localServer->hasPendingConnections()) - connectedToPuppet = m_localServer->waitForNewConnection(3000); + connectedToPuppet = m_localServer->waitForNewConnection(waitConstant / 4); if (connectedToPuppet) { m_firstSocket = m_localServer->nextPendingConnection(); @@ -166,14 +168,14 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV if (runModus == NormalModus) { if (!m_localServer->hasPendingConnections()) - connectedToPuppet = m_localServer->waitForNewConnection(3000); + connectedToPuppet = m_localServer->waitForNewConnection(waitConstant / 4); if (connectedToPuppet) { m_secondSocket = m_localServer->nextPendingConnection(); connect(m_secondSocket.data(), SIGNAL(readyRead()), this, SLOT(readSecondDataStream())); if (!m_localServer->hasPendingConnections()) - connectedToPuppet = m_localServer->waitForNewConnection(3000); + connectedToPuppet = m_localServer->waitForNewConnection(waitConstant / 4); if (connectedToPuppet) { m_thirdSocket = m_localServer->nextPendingConnection(); diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp index eafc521815e..2614ca939ca 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp @@ -179,6 +179,42 @@ static bool idIsQmlKeyWord(const QString& id) return keywords.contains(id); } +static bool isIdToAvoid(const QString& id) +{ + static const QSet ids = { + "top", + "bottom", + "left", + "right", + "width", + "height", + "x", + "y", + "opacity", + "parent", + "item", + "flow", + "color", + "margin", + "padding", + "border", + "font", + "text", + "source", + "state", + "visible", + "focus", + "data", + "clip", + "layer", + "scale", + "enabled", + "anchors" + }; + + return ids.contains(id); +} + static bool idContainsWrongLetter(const QString& id) { static QRegExp idExpr(QStringLiteral("[a-z_][a-zA-Z0-9_]*")); @@ -187,7 +223,7 @@ static bool idContainsWrongLetter(const QString& id) bool ModelNode::isValidId(const QString &id) { - return id.isEmpty() || (!idContainsWrongLetter(id) && !idIsQmlKeyWord(id)); + return id.isEmpty() || (!idContainsWrongLetter(id) && !idIsQmlKeyWord(id)) && !isIdToAvoid(id); } bool ModelNode::hasId() const diff --git a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp index b9b12934f20..bddfcf9b986 100644 --- a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp @@ -85,7 +85,7 @@ void ModelToTextMerger::propertiesChanged(const QList& propert ModelNode containedModelNode; const int indentDepth = m_rewriterView->textModifier()->indentDepth(); - const QString propertyTextValue = QmlTextGenerator(getPropertyOrder(), + const QString propertyTextValue = QmlTextGenerator(propertyOrder(), indentDepth)(property); switch (propertyChange) { @@ -162,14 +162,14 @@ void ModelToTextMerger::nodeReparented(const ModelNode &node, const NodeAbstract switch (propertyChange) { case AbstractView::PropertiesAdded: schedule(new AddPropertyRewriteAction(newPropertyParent, - QmlTextGenerator(getPropertyOrder())(node), + QmlTextGenerator(propertyOrder())(node), propertyType(newPropertyParent), node)); break; case AbstractView::NoAdditionalChanges: schedule(new ChangePropertyRewriteAction(newPropertyParent, - QmlTextGenerator(getPropertyOrder())(node), + QmlTextGenerator(propertyOrder())(node), propertyType(newPropertyParent), node)); break; @@ -212,7 +212,7 @@ void ModelToTextMerger::applyChanges() return; dumpRewriteActions(QStringLiteral("Before compression")); - RewriteActionCompressor compress(getPropertyOrder()); + RewriteActionCompressor compress(propertyOrder()); compress(m_rewriteActions); dumpRewriteActions(QStringLiteral("After compression")); @@ -241,7 +241,7 @@ void ModelToTextMerger::applyChanges() ModelNodePositionRecalculator positionRecalculator(m_rewriterView->positionStorage(), m_rewriterView->positionStorage()->modelNodes()); positionRecalculator.connectTo(textModifier); - QmlRefactoring refactoring(tmpDocument, *textModifier, getPropertyOrder()); + QmlRefactoring refactoring(tmpDocument, *textModifier, propertyOrder()); textModifier->deactivateChangeSignals(); textModifier->startGroup(); @@ -348,31 +348,27 @@ QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractPrope return (QmlRefactoring::PropertyType) -1; } -PropertyNameList ModelToTextMerger::m_propertyOrder; - -PropertyNameList ModelToTextMerger::getPropertyOrder() +PropertyNameList ModelToTextMerger::propertyOrder() { - if (m_propertyOrder.isEmpty()) { - m_propertyOrder - << PropertyName("id") - << PropertyName("name") - << PropertyName("target") - << PropertyName("property") - << PropertyName("x") - << PropertyName("y") - << PropertyName("width") - << PropertyName("height") - << PropertyName("position") - << PropertyName("color") - << PropertyName("radius") - << PropertyName("text") - << PropertyName() - << PropertyName("states") - << PropertyName("transitions") - ; - } + static const PropertyNameList properties = { + PropertyName("id"), + PropertyName("name"), + PropertyName("target"), + PropertyName("property"), + PropertyName("x"), + PropertyName("y"), + PropertyName("width"), + PropertyName("height"), + PropertyName("position"), + PropertyName("color"), + PropertyName("radius"), + PropertyName("text"), + PropertyName(), + PropertyName("states"), + PropertyName("transitions") + }; - return m_propertyOrder; + return properties; } bool ModelToTextMerger::isInHierarchy(const AbstractProperty &property) { diff --git a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.h b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.h index e51bb8084bd..582a78542fe 100644 --- a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.h +++ b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.h @@ -37,7 +37,6 @@ namespace Internal { class ModelToTextMerger { typedef AbstractView::PropertyChangeFlags PropertyChangeFlags; - static PropertyNameList m_propertyOrder; public: ModelToTextMerger(RewriterView *reWriterView); @@ -75,7 +74,7 @@ protected: { return m_rewriteActions; } static QmlDesigner::QmlRefactoring::PropertyType propertyType(const AbstractProperty &property, const QString &textValue = QString()); - static PropertyNameList getPropertyOrder(); + static PropertyNameList propertyOrder(); static bool isInHierarchy(const AbstractProperty &property); diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp index 1671d408187..208a16ac6e7 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp @@ -369,8 +369,8 @@ void RewriterView::applyChanges() if (inErrorState()) { const QString content = textModifierContent(); - qDebug() << "RewriterView::applyChanges() got called while in error state. Will do a quick-exit now."; - qDebug() << "Content:" << content; + qDebug().noquote() << "RewriterView::applyChanges() got called while in error state. Will do a quick-exit now."; + qDebug().noquote() << "Content: " << content; throw RewritingException(__LINE__, __FUNCTION__, __FILE__, "RewriterView::applyChanges() already in error state", content); } @@ -382,8 +382,8 @@ void RewriterView::applyChanges() enterErrorState(errors().first().description()); } catch (const Exception &e) { const QString content = textModifierContent(); - qDebug() << "RewriterException:" << m_rewritingErrorMessage; - qDebug() << "Content:" << content; + qDebug().noquote() << "RewriterException:" << m_rewritingErrorMessage; + qDebug().noquote() << "Content: " << qPrintable(content); enterErrorState(e.description()); } @@ -391,10 +391,10 @@ void RewriterView::applyChanges() if (inErrorState()) { const QString content = textModifierContent(); - qDebug() << "RewriterException:" << m_rewritingErrorMessage; - qDebug() << "Content:" << content; + qDebug().noquote() << "RewriterException: " << m_rewritingErrorMessage; + qDebug().noquote() << "Content: " << content; if (!errors().isEmpty()) - qDebug() << "Error:" << errors().first().description(); + qDebug().noquote() << "Error:" << errors().first().description(); throw RewritingException(__LINE__, __FUNCTION__, __FILE__, qPrintable(m_rewritingErrorMessage), content); } } diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index a0e75e314a7..438862d6c4f 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -1611,7 +1611,9 @@ void ModelValidator::variantValuesDiffer(VariantProperty &modelProperty, const Q QTC_ASSERT(modelProperty.dynamicTypeName() == dynamicTypeName, return); } - QTC_ASSERT(equals(modelProperty.value(), qmlVariantValue), return); + + + QTC_ASSERT(equals(modelProperty.value(), qmlVariantValue), qWarning() << modelProperty.value() << qmlVariantValue); QTC_ASSERT(0, return); } diff --git a/src/plugins/qmldesigner/designersettings.h b/src/plugins/qmldesigner/designersettings.h index bc53d15aca1..0756be0d974 100644 --- a/src/plugins/qmldesigner/designersettings.h +++ b/src/plugins/qmldesigner/designersettings.h @@ -60,6 +60,7 @@ const char FORWARD_PUPPET_OUTPUT[] = "ForwardPuppetOutput"; const char REFORMAT_UI_QML_FILES[] = "ReformatUiQmlFiles"; /* This Setting is not exposed in ui. The setting can be used to turn off the feature, if there are serious issues */ +const char TEXTEDIT_IN_DESIGNMODE[] = "TextEditInDesignMode"; } class DesignerSettings : public QHash diff --git a/src/plugins/qmldesigner/designmodecontext.cpp b/src/plugins/qmldesigner/designmodecontext.cpp index e8c0e33e155..3158e2dbb31 100644 --- a/src/plugins/qmldesigner/designmodecontext.cpp +++ b/src/plugins/qmldesigner/designmodecontext.cpp @@ -44,7 +44,6 @@ QString DesignModeContext::contextHelpId() const return qobject_cast(m_widget)->contextHelpId(); } - FormEditorContext::FormEditorContext(QWidget *widget) : IContext(widget) { diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index b162816ebdd..3c4349bd624 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -25,7 +25,7 @@ #include "designmodewidget.h" -#include "styledoutputpaneplaceholder.h" +#include #include "qmldesignerplugin.h" #include "crumblebar.h" #include "documentwarningwidget.h" @@ -248,21 +248,6 @@ void DesignModeWidget::updateErrorStatus(const QList &errors) } } -TextEditor::BaseTextEditor *DesignModeWidget::textEditor() const -{ - return currentDesignDocument()->textEditor(); -} - -void DesignModeWidget::setCurrentDesignDocument(DesignDocument *newDesignDocument) -{ - if (debug) - qDebug() << Q_FUNC_INFO << newDesignDocument; - - //viewManager().setDesignDocument(newDesignDocument); - - -} - static void hideToolButtons(QList &buttons) { foreach (QToolButton *button, buttons) @@ -319,13 +304,10 @@ void DesignModeWidget::setup() m_warningWidget->setVisible(false); connect(m_warningWidget.data(), &DocumentWarningWidget::gotoCodeClicked, [=] (const QString &filePath, int codeLine, int codeColumn) { - Q_UNUSED(filePath); - QTC_ASSERT(textEditor(), return;); - QTC_ASSERT(textEditor()->textDocument()->filePath().toString() == filePath, - qDebug() << Q_FUNC_INFO << textEditor()->textDocument()->filePath().toString() << filePath; ); - textEditor()->gotoLine(codeLine, codeColumn); + if (currentDesignDocument() && currentDesignDocument()->textEditor()) + currentDesignDocument()->textEditor()->gotoLine(codeLine, codeColumn); Core::ModeManager::activateMode(Core::Constants::MODE_EDIT); }); @@ -471,7 +453,7 @@ void DesignModeWidget::addNavigatorHistoryEntry(const Utils::FileName &fileName) ++m_navigatorHistoryCounter; } -static QWidget *createWidgetsInTabWidget(const QList &widgetInfos) +static QTabWidget *createWidgetsInTabWidget(const QList &widgetInfos) { QTabWidget *tabWidget = new QTabWidget; @@ -510,13 +492,23 @@ static Core::MiniSplitter *createCentralSplitter(const QList &widget outputPlaceholderSplitter->setStretchFactor(1, 0); outputPlaceholderSplitter->setOrientation(Qt::Vertical); - auto outputPanePlaceholder = new StyledOutputpanePlaceHolder(Core::Constants::MODE_DESIGN, outputPlaceholderSplitter); + auto outputPanePlaceholder = new Core::OutputPanePlaceHolder(Core::Constants::MODE_DESIGN, outputPlaceholderSplitter); - if (centralWidgetInfos.count() == 1) - outputPlaceholderSplitter->addWidget(centralWidgetInfos.first().widget); - else - outputPlaceholderSplitter->addWidget(createWidgetsInTabWidget(centralWidgetInfos)); + QTabWidget* tabWidget = createWidgetsInTabWidget(centralWidgetInfos); + tabWidget->setObjectName("centralTabWidget"); + tabWidget->setTabPosition(QTabWidget::East); + tabWidget->tabBar()->setObjectName("centralTabBar"); + QWidget *backgroundWidget = new QWidget(); + backgroundWidget->setObjectName("backgroundWidget"); + backgroundWidget->setLayout(new QVBoxLayout()); + backgroundWidget->layout()->setMargin(0); + backgroundWidget->layout()->addWidget(tabWidget); + + QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/centerwidget.css"); + backgroundWidget->setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(sheet))); + + outputPlaceholderSplitter->addWidget(backgroundWidget); outputPlaceholderSplitter->addWidget(outputPanePlaceholder); return outputPlaceholderSplitter; diff --git a/src/plugins/qmldesigner/designmodewidget.h b/src/plugins/qmldesigner/designmodewidget.h index a865bf6105f..f743432d515 100644 --- a/src/plugins/qmldesigner/designmodewidget.h +++ b/src/plugins/qmldesigner/designmodewidget.h @@ -68,8 +68,6 @@ public: void readSettings(); void saveSettings(); - TextEditor::BaseTextEditor *textEditor() const; - DesignDocument *currentDesignDocument() const; ViewManager &viewManager(); @@ -97,7 +95,6 @@ private slots: private: // functions enum InitializeStatus { NotInitialized, Initializing, Initialized }; - void setCurrentDesignDocument(DesignDocument *newDesignDocument); void setup(); bool isInNodeDefinition(int nodeOffset, int nodeLength, int cursorPos) const; QmlDesigner::ModelNode nodeForPosition(int cursorPos) const; diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/addnewbackenddialog.cpp b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/addnewbackenddialog.cpp index cad3da8fcfd..1ba26dcfc8a 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/addnewbackenddialog.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/addnewbackenddialog.cpp @@ -26,6 +26,8 @@ #include "addnewbackenddialog.h" #include "ui_addnewbackenddialog.h" +#include + namespace QmlDesigner { AddNewBackendDialog::AddNewBackendDialog(QWidget *parent) : @@ -57,6 +59,7 @@ void AddNewBackendDialog::setupPossibleTypes(const QList &types) for (const CppTypeData &typeData : types) m_ui->comboBox->addItem(typeData.typeName); + m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(m_ui->comboBox->count() > 0); invalidate(); blockSignals(block); } diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp index a5204efe405..8d47c3ca521 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp @@ -313,6 +313,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, const QStyleOptionVie QString itemText = tr("Change to default state"); QString source = QString::fromLatin1("{ %1.state = \"\" }").arg(rootModelNode.id()); connectionComboBox->addItem(itemText, source); + connectionComboBox->disableValidator(); foreach (const QmlModelState &state, QmlItemNode(rootModelNode).states().allStates()) { QString itemText = tr("Change state to %1").arg(state.name()); @@ -320,6 +321,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, const QStyleOptionVie connectionComboBox->addItem(itemText, source); } } + connectionComboBox->disableValidator(); } break; default: qWarning() << "ConnectionDelegate::createEditor column" << index.column(); diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index b8b45729314..0cca310bc7f 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -130,6 +130,24 @@ static bool shouldAssertInException() return !processEnvironment.value("QMLDESIGNER_ASSERT_ON_EXCEPTION").isEmpty(); } +static bool useTextEditInDesignMode() +{ + DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); + return settings.value(DesignerSettingsKey::TEXTEDIT_IN_DESIGNMODE, false).toBool(); +} + +static bool warningsForQmlFilesInsteadOfUiQmlEnabled() +{ + DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); + return settings.value(DesignerSettingsKey::WARNING_FOR_QML_FILES_INSTEAD_OF_UIQML_FILES).toBool(); +} + +static bool showWarningsForFeaturesInDesigner() +{ + DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); + return settings.value(DesignerSettingsKey::WARNING_FOR_FEATURES_IN_DESIGNER).toBool(); +} + QmlDesignerPlugin::QmlDesignerPlugin() { m_instance = this; @@ -196,12 +214,11 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e createDesignModeWidget(); connect(switchTextDesignAction, &QAction::triggered, this, [](){ - if (Core::ModeManager::currentMode() == Core::Constants::MODE_EDIT) { - Core::IEditor *editor = Core::EditorManager::currentEditor(); - if (checkIfEditorIsQtQuick(editor)) - Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN); - } else if (Core::ModeManager::currentMode() == Core::Constants::MODE_DESIGN) { - Core::ModeManager::activateMode(Core::Constants::MODE_EDIT); + if (Core::ModeManager::currentMode() == Core::Constants::MODE_DESIGN) { + if (useTextEditInDesignMode()) + qDebug() << "not implemented"; + else + Core::ModeManager::activateMode(Core::Constants::MODE_EDIT); } }); @@ -298,18 +315,6 @@ void QmlDesignerPlugin::createDesignModeWidget() }); } -static bool warningsForQmlFilesInsteadOfUiQmlEnabled() -{ - DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); - return settings.value(DesignerSettingsKey::WARNING_FOR_QML_FILES_INSTEAD_OF_UIQML_FILES).toBool(); -} - -static bool showWarningsForFeaturesInDesigner() -{ - DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); - return settings.value(DesignerSettingsKey::WARNING_FOR_FEATURES_IN_DESIGNER).toBool(); -} - void QmlDesignerPlugin::showDesigner() { QTC_ASSERT(!d->documentManager.hasCurrentDesignDocument(), return); diff --git a/src/plugins/qmldesigner/qmldesignerplugin.pri b/src/plugins/qmldesigner/qmldesignerplugin.pri index b9be0d0a558..b900f8d883e 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.pri +++ b/src/plugins/qmldesigner/qmldesignerplugin.pri @@ -7,7 +7,6 @@ HEADERS += $$PWD/qmldesignerconstants.h \ $$PWD/designmodecontext.h \ $$PWD/documentmanager.h \ $$PWD/documentwarningwidget.h \ - $$PWD/styledoutputpaneplaceholder.h \ $$PWD/qmldesignericons.h \ $$PWD/openuiqmlfiledialog.h @@ -19,7 +18,6 @@ SOURCES += $$PWD/qmldesignerplugin.cpp \ $$PWD/designmodecontext.cpp \ $$PWD/documentmanager.cpp \ $$PWD/documentwarningwidget.cpp \ - $$PWD/styledoutputpaneplaceholder.cpp \ $$PWD/openuiqmlfiledialog.cpp FORMS += $$PWD/settingspage.ui \ diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index 8e24fd09a7f..e593a32b3d3 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -646,8 +646,6 @@ Project { "settingspage.ui", "shortcutmanager.cpp", "shortcutmanager.h", - "styledoutputpaneplaceholder.cpp", - "styledoutputpaneplaceholder.h", ] } } diff --git a/src/plugins/qmldesigner/styledoutputpaneplaceholder.cpp b/src/plugins/qmldesigner/styledoutputpaneplaceholder.cpp deleted file mode 100644 index b8793740fbe..00000000000 --- a/src/plugins/qmldesigner/styledoutputpaneplaceholder.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "styledoutputpaneplaceholder.h" -#include "theming.h" - -#include - -#include -#include - -namespace QmlDesigner { -namespace Internal { - -StyledOutputpanePlaceHolder::StyledOutputpanePlaceHolder(Core::Id mode, QSplitter *parent) - : Core::OutputPanePlaceHolder(mode, parent) -{ - QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css"); - m_customStylesheet = Theming::replaceCssColors(QString::fromUtf8(sheet)); -} - -void StyledOutputpanePlaceHolder::childEvent(QChildEvent *event) -{ - Core::OutputPanePlaceHolder::childEvent(event); - - if (event->type() == QEvent::ChildAdded) { - if (QWidget *child = qobject_cast(event->child())) { - QList widgets = child->findChildren(); - if (!widgets.isEmpty()) - widgets.first()->parentWidget()->setStyleSheet(m_customStylesheet); - } - } else if (event->type() == QEvent::ChildRemoved) { - QWidget *child = qobject_cast(event->child()); - if (child) { - QList widgets = child->findChildren(); - if (!widgets.isEmpty()) - widgets.first()->parentWidget()->setStyleSheet(QString()); - } - } -} - -} // namespace Internal -} // namespace QmlDesigner diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index e004d229a26..4c933040e64 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -344,7 +344,7 @@ void QmlProfilerModelManager::save(const QString &filename) writer->saveQtd(file); else writer->saveQzt(file); - delete writer; + writer->deleteLater(); file->deleteLater(); }); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 83970db1956..72498a20d81 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -169,13 +169,13 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) QAction *act = d->m_loadQmlTrace = new QAction(tr("Load QML Trace"), options); command = ActionManager::registerAction(act, Constants::QmlProfilerLoadActionId); - connect(act, &QAction::triggered, this, &QmlProfilerTool::showLoadDialog); + connect(act, &QAction::triggered, this, &QmlProfilerTool::showLoadDialog, Qt::QueuedConnection); options->addAction(command); act = d->m_saveQmlTrace = new QAction(tr("Save QML Trace"), options); d->m_saveQmlTrace->setEnabled(false); command = ActionManager::registerAction(act, Constants::QmlProfilerSaveActionId); - connect(act, &QAction::triggered, this, &QmlProfilerTool::showSaveDialog); + connect(act, &QAction::triggered, this, &QmlProfilerTool::showSaveDialog, Qt::QueuedConnection); options->addAction(command); d->m_recordingTimer.setInterval(100); diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index 9667a5aa89e..97fc03e5fab 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -116,6 +116,8 @@ public: void setIcon(const QIcon &icon) { + if (m_icon.cacheKey() == icon.cacheKey()) + return; m_icon = icon; update(); } @@ -224,7 +226,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent) m_manualItem = new StaticTreeItem(tr("Manual")); m_model = new TreeModel(); - m_model->setHeader({tr("Name"), tr("qmake Location"), tr("Type")}); + m_model->setHeader({tr("Name"), tr("qmake Location")}); m_model->rootItem()->appendChild(m_autoItem); m_model->rootItem()->appendChild(m_manualItem); diff --git a/src/plugins/scxmleditor/common/common.qrc b/src/plugins/scxmleditor/common/common.qrc index 49ee31ce666..7981a023097 100644 --- a/src/plugins/scxmleditor/common/common.qrc +++ b/src/plugins/scxmleditor/common/common.qrc @@ -1,25 +1,31 @@ images/adjust_height.png + images/adjust_height@2x.png images/adjust_size.png + images/adjust_size@2x.png images/adjust_width.png + images/adjust_width@2x.png images/align_bottom.png + images/align_bottom@2x.png images/align_horizontal.png + images/align_horizontal@2x.png images/align_left.png + images/align_left@2x.png images/align_right.png + images/align_right@2x.png images/align_top.png + images/align_top@2x.png images/align_vertical.png + images/align_vertical@2x.png images/colorthemes.png images/final.png images/font_color.png - images/fullnamespace.png images/history.png images/icon-export-canvas.png images/icon-export-canvas@2x.png - images/icon-fit-screen.png images/icon-pan.png - images/icon-zoom-in.png - images/icon-zoom-out.png + images/icon-pan@2x.png images/initial.png images/more_colors.png images/navigator.png diff --git a/src/plugins/scxmleditor/common/images/adjust_height.png b/src/plugins/scxmleditor/common/images/adjust_height.png index 3a838838519..f3917bd462b 100644 Binary files a/src/plugins/scxmleditor/common/images/adjust_height.png and b/src/plugins/scxmleditor/common/images/adjust_height.png differ diff --git a/src/plugins/scxmleditor/common/images/adjust_height@2x.png b/src/plugins/scxmleditor/common/images/adjust_height@2x.png new file mode 100644 index 00000000000..844f94d4f72 Binary files /dev/null and b/src/plugins/scxmleditor/common/images/adjust_height@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/adjust_size.png b/src/plugins/scxmleditor/common/images/adjust_size.png index b95d8737a85..eb2ba0a551b 100644 Binary files a/src/plugins/scxmleditor/common/images/adjust_size.png and b/src/plugins/scxmleditor/common/images/adjust_size.png differ diff --git a/src/plugins/scxmleditor/common/images/adjust_size@2x.png b/src/plugins/scxmleditor/common/images/adjust_size@2x.png new file mode 100644 index 00000000000..62162d1dc77 Binary files /dev/null and b/src/plugins/scxmleditor/common/images/adjust_size@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/adjust_width.png b/src/plugins/scxmleditor/common/images/adjust_width.png index 89e509878c4..a261321bb41 100644 Binary files a/src/plugins/scxmleditor/common/images/adjust_width.png and b/src/plugins/scxmleditor/common/images/adjust_width.png differ diff --git a/src/plugins/scxmleditor/common/images/adjust_width@2x.png b/src/plugins/scxmleditor/common/images/adjust_width@2x.png new file mode 100644 index 00000000000..a45e6b5d584 Binary files /dev/null and b/src/plugins/scxmleditor/common/images/adjust_width@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/align_bottom.png b/src/plugins/scxmleditor/common/images/align_bottom.png index f827993a211..6b24ef1bba2 100644 Binary files a/src/plugins/scxmleditor/common/images/align_bottom.png and b/src/plugins/scxmleditor/common/images/align_bottom.png differ diff --git a/src/plugins/scxmleditor/common/images/align_bottom@2x.png b/src/plugins/scxmleditor/common/images/align_bottom@2x.png new file mode 100644 index 00000000000..7dd9d41cde0 Binary files /dev/null and b/src/plugins/scxmleditor/common/images/align_bottom@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/align_horizontal.png b/src/plugins/scxmleditor/common/images/align_horizontal.png index 876a38fdf59..e35354368f6 100644 Binary files a/src/plugins/scxmleditor/common/images/align_horizontal.png and b/src/plugins/scxmleditor/common/images/align_horizontal.png differ diff --git a/src/plugins/scxmleditor/common/images/align_horizontal@2x.png b/src/plugins/scxmleditor/common/images/align_horizontal@2x.png new file mode 100644 index 00000000000..574f4dce0da Binary files /dev/null and b/src/plugins/scxmleditor/common/images/align_horizontal@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/align_left.png b/src/plugins/scxmleditor/common/images/align_left.png index e015bc93e8f..24a597bb593 100644 Binary files a/src/plugins/scxmleditor/common/images/align_left.png and b/src/plugins/scxmleditor/common/images/align_left.png differ diff --git a/src/plugins/scxmleditor/common/images/align_left@2x.png b/src/plugins/scxmleditor/common/images/align_left@2x.png new file mode 100644 index 00000000000..197a5b37587 Binary files /dev/null and b/src/plugins/scxmleditor/common/images/align_left@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/align_right.png b/src/plugins/scxmleditor/common/images/align_right.png index c52bb1498b5..edfe3bd529f 100644 Binary files a/src/plugins/scxmleditor/common/images/align_right.png and b/src/plugins/scxmleditor/common/images/align_right.png differ diff --git a/src/plugins/scxmleditor/common/images/align_right@2x.png b/src/plugins/scxmleditor/common/images/align_right@2x.png new file mode 100644 index 00000000000..7e50ee73797 Binary files /dev/null and b/src/plugins/scxmleditor/common/images/align_right@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/align_top.png b/src/plugins/scxmleditor/common/images/align_top.png index 0366ae86867..044ca915e5d 100644 Binary files a/src/plugins/scxmleditor/common/images/align_top.png and b/src/plugins/scxmleditor/common/images/align_top.png differ diff --git a/src/plugins/scxmleditor/common/images/align_top@2x.png b/src/plugins/scxmleditor/common/images/align_top@2x.png new file mode 100644 index 00000000000..d387248dd06 Binary files /dev/null and b/src/plugins/scxmleditor/common/images/align_top@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/align_vertical.png b/src/plugins/scxmleditor/common/images/align_vertical.png index 036f8d40b73..f72b06483e3 100644 Binary files a/src/plugins/scxmleditor/common/images/align_vertical.png and b/src/plugins/scxmleditor/common/images/align_vertical.png differ diff --git a/src/plugins/scxmleditor/common/images/align_vertical@2x.png b/src/plugins/scxmleditor/common/images/align_vertical@2x.png new file mode 100644 index 00000000000..218c904f63c Binary files /dev/null and b/src/plugins/scxmleditor/common/images/align_vertical@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/fullnamespace.png b/src/plugins/scxmleditor/common/images/fullnamespace.png deleted file mode 100644 index ee890ccf5b6..00000000000 Binary files a/src/plugins/scxmleditor/common/images/fullnamespace.png and /dev/null differ diff --git a/src/plugins/scxmleditor/common/images/icon-export-canvas.png b/src/plugins/scxmleditor/common/images/icon-export-canvas.png index d2d47205a8f..cd6f0cea56a 100644 Binary files a/src/plugins/scxmleditor/common/images/icon-export-canvas.png and b/src/plugins/scxmleditor/common/images/icon-export-canvas.png differ diff --git a/src/plugins/scxmleditor/common/images/icon-export-canvas@2x.png b/src/plugins/scxmleditor/common/images/icon-export-canvas@2x.png index bdc82b7ade6..5dd92fbba32 100644 Binary files a/src/plugins/scxmleditor/common/images/icon-export-canvas@2x.png and b/src/plugins/scxmleditor/common/images/icon-export-canvas@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/icon-fit-screen.png b/src/plugins/scxmleditor/common/images/icon-fit-screen.png deleted file mode 100644 index d5d5a339563..00000000000 Binary files a/src/plugins/scxmleditor/common/images/icon-fit-screen.png and /dev/null differ diff --git a/src/plugins/scxmleditor/common/images/icon-pan.png b/src/plugins/scxmleditor/common/images/icon-pan.png index e157880417d..753b3bf02ba 100644 Binary files a/src/plugins/scxmleditor/common/images/icon-pan.png and b/src/plugins/scxmleditor/common/images/icon-pan.png differ diff --git a/src/plugins/scxmleditor/common/images/icon-pan@2x.png b/src/plugins/scxmleditor/common/images/icon-pan@2x.png new file mode 100644 index 00000000000..11c02fc1623 Binary files /dev/null and b/src/plugins/scxmleditor/common/images/icon-pan@2x.png differ diff --git a/src/plugins/scxmleditor/common/images/icon-zoom-in.png b/src/plugins/scxmleditor/common/images/icon-zoom-in.png deleted file mode 100644 index b8679e7ec5d..00000000000 Binary files a/src/plugins/scxmleditor/common/images/icon-zoom-in.png and /dev/null differ diff --git a/src/plugins/scxmleditor/common/images/icon-zoom-out.png b/src/plugins/scxmleditor/common/images/icon-zoom-out.png deleted file mode 100644 index d492a2e8c4a..00000000000 Binary files a/src/plugins/scxmleditor/common/images/icon-zoom-out.png and /dev/null differ diff --git a/src/plugins/scxmleditor/common/mainwidget.cpp b/src/plugins/scxmleditor/common/mainwidget.cpp index 09c00c0f623..d67003eb8b3 100644 --- a/src/plugins/scxmleditor/common/mainwidget.cpp +++ b/src/plugins/scxmleditor/common/mainwidget.cpp @@ -77,6 +77,7 @@ #include #include #include +#include using namespace ScxmlEditor::PluginInterface; using namespace ScxmlEditor::Common; @@ -120,6 +121,47 @@ void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString abort(); } +static QIcon toolButtonIcon(ActionType actionType) +{ + QString iconFileName; + + switch (actionType) { + case ActionAlignLeft: + iconFileName = ":/scxmleditor/images/align_left.png"; + break; + case ActionAlignRight: + iconFileName = ":/scxmleditor/images/align_right.png"; + break; + case ActionAlignTop: + iconFileName = ":/scxmleditor/images/align_top.png"; + break; + case ActionAlignBottom: + iconFileName = ":/scxmleditor/images/align_bottom.png"; + break; + case ActionAlignHorizontal: + iconFileName = ":/scxmleditor/images/align_horizontal.png"; + break; + case ActionAlignVertical: + iconFileName = ":/scxmleditor/images/align_vertical.png"; + break; + + case ActionAdjustWidth: + iconFileName = ":/scxmleditor/images/adjust_width.png"; + break; + case ActionAdjustHeight: + iconFileName = ":/scxmleditor/images/adjust_height.png"; + break; + case ActionAdjustSize: + iconFileName = ":/scxmleditor/images/adjust_size.png"; + break; + + default: + return QIcon(); + } + + return Utils::Icon({{iconFileName, Utils::Theme::IconsBaseColor}}).icon(); +} + MainWidget::MainWidget(QWidget *parent) : QWidget(parent) { @@ -289,8 +331,8 @@ void MainWidget::init() // Init ToolButtons auto stateColorButton = new ColorToolButton("StateColor", ":/scxmleditor/images/state_color.png", tr("State Color")); auto fontColorButton = new ColorToolButton("FontColor", ":/scxmleditor/images/font_color.png", tr("Font Color")); - QToolButton *alignToolButton = createToolButton(":/scxmleditor/images/align_left.png", tr("Align Left"), QToolButton::MenuButtonPopup); - QToolButton *adjustToolButton = createToolButton(":/scxmleditor/images/adjust_width.png", tr("Adjust Width"), QToolButton::MenuButtonPopup); + QToolButton *alignToolButton = createToolButton(toolButtonIcon(ActionAlignLeft), tr("Align Left"), QToolButton::MenuButtonPopup); + QToolButton *adjustToolButton = createToolButton(toolButtonIcon(ActionAdjustWidth), tr("Adjust Width"), QToolButton::MenuButtonPopup); // Connect state color change connect(stateColorButton, &ColorToolButton::colorSelected, [this](const QString &color) { @@ -725,10 +767,10 @@ void MainWidget::setMagnifier(bool m) } } -QToolButton *MainWidget::createToolButton(const QString &iconName, const QString &tooltip, QToolButton::ToolButtonPopupMode mode) +QToolButton *MainWidget::createToolButton(const QIcon &icon, const QString &tooltip, QToolButton::ToolButtonPopupMode mode) { auto button = new QToolButton; - button->setIcon(QIcon(iconName)); + button->setIcon(icon); button->setToolTip(tooltip); button->setPopupMode(mode); @@ -738,7 +780,7 @@ QToolButton *MainWidget::createToolButton(const QString &iconName, const QString void MainWidget::alignButtonClicked(ActionType alignType) { if (alignType >= ActionAlignLeft && alignType <= ActionAlignVertical) { - m_toolButtons[ToolButtonAlignment]->setIcon(m_actionHandler->action(alignType)->icon()); + m_toolButtons[ToolButtonAlignment]->setIcon(toolButtonIcon(alignType)); m_toolButtons[ToolButtonAlignment]->setToolTip(m_actionHandler->action(alignType)->toolTip()); m_toolButtons[ToolButtonAlignment]->setProperty("currentAlignment", alignType); StateView *view = m_views.last(); @@ -750,7 +792,7 @@ void MainWidget::alignButtonClicked(ActionType alignType) void MainWidget::adjustButtonClicked(ActionType adjustType) { if (adjustType >= ActionAdjustWidth && adjustType <= ActionAdjustSize) { - m_toolButtons[ToolButtonAdjustment]->setIcon(m_actionHandler->action(adjustType)->icon()); + m_toolButtons[ToolButtonAdjustment]->setIcon(toolButtonIcon(adjustType)); m_toolButtons[ToolButtonAdjustment]->setToolTip(m_actionHandler->action(adjustType)->toolTip()); m_toolButtons[ToolButtonAdjustment]->setProperty("currentAdjustment", adjustType); StateView *view = m_views.last(); diff --git a/src/plugins/scxmleditor/common/mainwidget.h b/src/plugins/scxmleditor/common/mainwidget.h index 6b75895b0f3..984c364f5b1 100644 --- a/src/plugins/scxmleditor/common/mainwidget.h +++ b/src/plugins/scxmleditor/common/mainwidget.h @@ -108,7 +108,7 @@ signals: void dirtyChanged(bool dirty); private: - QToolButton *createToolButton(const QString &iconName, const QString &tooltip, QToolButton::ToolButtonPopupMode mode); + QToolButton *createToolButton(const QIcon &icon, const QString &tooltip, QToolButton::ToolButtonPopupMode mode); void documentChanged(); void createUi(); void init(); diff --git a/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp b/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp index 076be01876b..e8067fd0165 100644 --- a/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp +++ b/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp @@ -44,10 +44,10 @@ ActionHandler::ActionHandler(QObject *parent) const char *keyseq; bool checkable; } actionInfos[] = { - { Utils::Icon(":/scxmleditor/images/icon-zoom-in.png"), AH::tr("Zoom In"), AH::tr("Zoom In (Ctrl + + / Ctrl + Wheel)"), "Ctrl++", false }, - { Utils::Icon(":/scxmleditor/images/icon-zoom-out.png"), AH::tr("Zoom Out"), AH::tr("Zoom Out (Ctrl + - / Ctrl + Wheel)"), "Ctrl+-", false }, - { Utils::Icon(":/scxmleditor/images/icon-fit-screen.png"), AH::tr("Fit to View"), AH::tr("Fit to View (F11)"), "F11", false }, - { Utils::Icon(":/scxmleditor/images/icon-pan.png"), AH::tr("Panning"), AH::tr("Panning (Shift)"), "Shift", true }, + { Utils::Icons::ZOOMIN_TOOLBAR, AH::tr("Zoom In"), AH::tr("Zoom In (Ctrl + + / Ctrl + Wheel)"), "Ctrl++", false }, + { Utils::Icons::ZOOMOUT_TOOLBAR, AH::tr("Zoom Out"), AH::tr("Zoom Out (Ctrl + - / Ctrl + Wheel)"), "Ctrl+-", false }, + { Utils::Icons::FITTOVIEW_TOOLBAR, AH::tr("Fit to View"), AH::tr("Fit to View (F11)"), "F11", false }, + { Utils::Icon({{":/scxmleditor/images/icon-pan.png", Utils::Theme::IconsBaseColor}}), AH::tr("Panning"), AH::tr("Panning (Shift)"), "Shift", true }, { Utils::Icons::ZOOM_TOOLBAR, AH::tr("Magnifier"), AH::tr("Magnifier Tool (Alt)"), "Alt", true }, { Utils::Icon(":/scxmleditor/images/navigator.png"), AH::tr("Navigator"), AH::tr("Navigator (Ctrl+E)"), "Ctrl+E", true }, @@ -57,17 +57,17 @@ ActionHandler::ActionHandler(QObject *parent) { Utils::Icon({{":/utils/images/editpaste.png", Utils::Theme::IconsBaseColor}}), AH::tr("Paste"), AH::tr("Paste (Ctrl + V)"), "Ctrl+V", false }, { Utils::Icons::SNAPSHOT_TOOLBAR, AH::tr("Screenshot"), AH::tr("Screenshot (Ctrl + Shift + C)"), "Ctrl+Shift+C", false }, { Utils::Icon({{":/scxmleditor/images/icon-export-canvas.png", Utils::Theme::IconsBaseColor}}), AH::tr("Export to Image"), AH::tr("Export to Image"), "Ctrl+Shift+E", false }, - { Utils::Icon(":/scxmleditor/images/fullnamespace.png"), AH::tr("Toggle Full Namespace"), AH::tr("Toggle Full Namespace"), "Ctrl+Shift+N", true }, + { Utils::Icon({{":/utils/images/namespace.png", Utils::Theme::IconsBaseColor}}), AH::tr("Toggle Full Namespace"), AH::tr("Toggle Full Namespace"), "Ctrl+Shift+N", true }, - { Utils::Icon(":/scxmleditor/images/align_left.png"), AH::tr("Align Left"), AH::tr("Align Left (Ctrl+L,1)"), "Ctrl+L,1", false }, - { Utils::Icon(":/scxmleditor/images/align_right.png"), AH::tr("Align Right"), AH::tr("Align Right (Ctrl+L,2)"), "Ctrl+L,2", false }, - { Utils::Icon(":/scxmleditor/images/align_top.png"), AH::tr("Align Top"), AH::tr("Align Top (Ctrl+L,3)"), "Ctrl+L,3", false }, - { Utils::Icon(":/scxmleditor/images/align_bottom.png"), AH::tr("Align Bottom"), AH::tr("Align Bottom (Ctrl+L,4)"), "Ctrl+L,4", false }, - { Utils::Icon(":/scxmleditor/images/align_horizontal.png"), AH::tr("Align Horizontal"), AH::tr("Align Horizontal (Ctrl+L,5)"), "Ctrl+L,5", false }, - { Utils::Icon(":/scxmleditor/images/align_vertical.png"), AH::tr("Align Vertical"), AH::tr("Align Vertical (Ctrl+L,6)"), "Ctrl+L,6", false }, - { Utils::Icon(":/scxmleditor/images/adjust_width.png"), AH::tr("Adjust Width"), AH::tr("Adjust Width (Ctrl+L,7)"), "Ctrl+L,7", false }, - { Utils::Icon(":/scxmleditor/images/adjust_height.png"), AH::tr("Adjust Height"), AH::tr("Adjust Height (Ctrl+L,8)"), "Ctrl+L,8", false }, - { Utils::Icon(":/scxmleditor/images/adjust_size.png"), AH::tr("Adjust Size"), AH::tr("Adjust Size (Ctrl+L,9)"), "Ctrl+L,9", false }, + { Utils::Icon({{":/scxmleditor/images/align_left.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Left"), AH::tr("Align Left (Ctrl+L,1)"), "Ctrl+L,1", false }, + { Utils::Icon({{":/scxmleditor/images/align_right.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Right"), AH::tr("Align Right (Ctrl+L,2)"), "Ctrl+L,2", false }, + { Utils::Icon({{":/scxmleditor/images/align_top.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Top"), AH::tr("Align Top (Ctrl+L,3)"), "Ctrl+L,3", false }, + { Utils::Icon({{":/scxmleditor/images/align_bottom.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Bottom"), AH::tr("Align Bottom (Ctrl+L,4)"), "Ctrl+L,4", false }, + { Utils::Icon({{":/scxmleditor/images/align_horizontal.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Horizontal"), AH::tr("Align Horizontal (Ctrl+L,5)"), "Ctrl+L,5", false }, + { Utils::Icon({{":/scxmleditor/images/align_vertical.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Align Vertical"), AH::tr("Align Vertical (Ctrl+L,6)"), "Ctrl+L,6", false }, + { Utils::Icon({{":/scxmleditor/images/adjust_width.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Adjust Width"), AH::tr("Adjust Width (Ctrl+L,7)"), "Ctrl+L,7", false }, + { Utils::Icon({{":/scxmleditor/images/adjust_height.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Adjust Height"), AH::tr("Adjust Height (Ctrl+L,8)"), "Ctrl+L,8", false }, + { Utils::Icon({{":/scxmleditor/images/adjust_size.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), AH::tr("Adjust Size"), AH::tr("Adjust Size (Ctrl+L,9)"), "Ctrl+L,9", false }, { Utils::Icon(":/scxmleditor/images/statistics.png"), AH::tr("Show Statistics..."), AH::tr("Show Statistics"), "", false } }; diff --git a/src/plugins/subversion/subversionclient.cpp b/src/plugins/subversion/subversionclient.cpp index 8bb53738dcc..85331d0a4d8 100644 --- a/src/plugins/subversion/subversionclient.cpp +++ b/src/plugins/subversion/subversionclient.cpp @@ -39,6 +39,8 @@ #include #include +#include + #include #include #include @@ -138,19 +140,20 @@ QStringList SubversionClient::addAuthenticationOptions(const VcsBaseClientSettin QString SubversionClient::synchronousTopic(const QString &repository) { QStringList args; - args << QLatin1String("info"); - const SynchronousProcessResponse result = vcsFullySynchronousExec(repository, args); + QString svnVersionBinary = vcsBinary().toString(); + int pos = svnVersionBinary.lastIndexOf('/'); + if (pos < 0) + svnVersionBinary.clear(); + else + svnVersionBinary = svnVersionBinary.left(pos + 1); + svnVersionBinary.append(HostOsInfo::withExecutableSuffix("svnversion")); + const SynchronousProcessResponse result + = vcsFullySynchronousExec(repository, FileName::fromString(svnVersionBinary), args); if (result.result != SynchronousProcessResponse::Finished) return QString(); - const QString revisionString = QLatin1String("Revision: "); - // stdOut is ASCII only (at least in those areas we care about). - foreach (const QString &line, result.stdOut().split(QLatin1Char('\n'))) { - if (line.startsWith(revisionString)) - return QString::fromLatin1("r") + line.mid(revisionString.count()); - } - return QString(); + return result.stdOut().trimmed(); } class DiffController : public DiffEditorController diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index aae750dc318..aa0204cc757 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -175,6 +175,18 @@ QString VcsBaseClientImpl::stripLastNewline(const QString &in) return in; } +Utils::SynchronousProcessResponse +VcsBaseClientImpl::vcsFullySynchronousExec(const QString &workingDir, const Utils::FileName &binary, + const QStringList &args, unsigned flags, + int timeoutS, QTextCodec *codec) const +{ + VcsCommand command(workingDir, processEnvironment()); + command.addFlags(flags); + if (codec) + command.setCodec(codec); + return command.runCommand(binary, args, (timeoutS > 0) ? timeoutS : vcsTimeoutS()); +} + void VcsBaseClientImpl::resetCachedVcsInfo(const QString &workingDir) { Core::VcsManager::resetVersionControlForDirectory(workingDir); @@ -197,11 +209,7 @@ Utils::SynchronousProcessResponse VcsBaseClientImpl::vcsFullySynchronousExec(const QString &workingDir, const QStringList &args, unsigned flags, int timeoutS, QTextCodec *codec) const { - VcsCommand command(workingDir, processEnvironment()); - command.addFlags(flags); - if (codec) - command.setCodec(codec); - return command.runCommand(vcsBinary(), args, (timeoutS > 0) ? timeoutS : vcsTimeoutS()); + return vcsFullySynchronousExec(workingDir, vcsBinary(), args, flags, timeoutS, codec); } VcsCommand *VcsBaseClientImpl::vcsExec(const QString &workingDirectory, const QStringList &arguments, diff --git a/src/plugins/vcsbase/vcsbaseclient.h b/src/plugins/vcsbase/vcsbaseclient.h index 4bc138984e3..d693a4357e8 100644 --- a/src/plugins/vcsbase/vcsbaseclient.h +++ b/src/plugins/vcsbase/vcsbaseclient.h @@ -104,6 +104,10 @@ public: Utils::SynchronousProcessResponse vcsFullySynchronousExec(const QString &workingDir, const QStringList &args, unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const; + Utils::SynchronousProcessResponse + vcsFullySynchronousExec(const QString &workingDir, const Utils::FileName &binary, const QStringList &args, + unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const; + // Simple helper to execute a single command using createCommand and enqueueJob. VcsCommand *vcsExec(const QString &workingDirectory, const QStringList &arguments, diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp index 8ceebd9cf0b..3a8e3b110ed 100644 --- a/src/shared/proparser/qmakebuiltins.cpp +++ b/src/shared/proparser/qmakebuiltins.cpp @@ -47,6 +47,8 @@ # include #endif +#include + #ifdef Q_OS_UNIX #include #include @@ -92,7 +94,7 @@ enum ExpandFunc { enum TestFunc { T_INVALID = 0, T_REQUIRES, T_GREATERTHAN, T_LESSTHAN, T_EQUALS, T_EXISTS, T_EXPORT, T_CLEAR, T_UNSET, T_EVAL, T_CONFIG, T_SYSTEM, - T_DEFINED, T_CONTAINS, T_INFILE, + T_DEFINED, T_DISCARD_FROM, T_CONTAINS, T_INFILE, T_COUNT, T_ISEMPTY, T_PARSE_JSON, T_INCLUDE, T_LOAD, T_DEBUG, T_LOG, T_MESSAGE, T_WARNING, T_ERROR, T_IF, T_MKPATH, T_WRITE_FILE, T_TOUCH, T_CACHE }; @@ -173,6 +175,7 @@ void QMakeEvaluator::initFunctionStatics() { "if", T_IF }, { "isActiveConfig", T_CONFIG }, { "system", T_SYSTEM }, + { "discard_from", T_DISCARD_FROM }, { "defined", T_DEFINED }, { "contains", T_CONTAINS }, { "infile", T_INFILE }, @@ -441,12 +444,13 @@ void QMakeEvaluator::runProcess(QProcess *proc, const QString &command) const } #endif -QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const +QByteArray QMakeEvaluator::getCommandOutput(const QString &args, int *exitCode) const { QByteArray out; #ifndef QT_BOOTSTRAPPED QProcess proc; runProcess(&proc, args); + *exitCode = (proc.exitStatus() == QProcess::NormalExit) ? proc.exitCode() : -1; QByteArray errout = proc.readAllStandardError(); # ifdef PROEVALUATOR_FULL // FIXME: Qt really should have the option to set forwarding per channel @@ -476,7 +480,12 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const break; out += QByteArray(buff, read_in); } - QT_PCLOSE(proc); + int ec = QT_PCLOSE(proc); +# ifdef Q_OS_WIN + *exitCode = ec >= 0 ? ec : -1; +# else + *exitCode = WIFEXITED(ec) ? WEXITSTATUS(ec) : -1; +# endif } # ifdef Q_OS_WIN out.replace("\r\n", "\n"); @@ -866,8 +875,8 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( break; case E_SYSTEM: if (!m_skipLevel) { - if (args.count() < 1 || args.count() > 2) { - evalError(fL1S("system(execute) requires one or two arguments.")); + if (args.count() < 1 || args.count() > 3) { + evalError(fL1S("system(command, [mode], [stsvar]) requires one to three arguments.")); } else { bool blob = false; bool lines = false; @@ -881,7 +890,12 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( else if (!m_tmp2.compare(QLatin1String("lines"), Qt::CaseInsensitive)) lines = true; } - QByteArray bytes = getCommandOutput(args.at(0).toQString(m_tmp2)); + int exitCode; + QByteArray bytes = getCommandOutput(args.at(0).toQString(m_tmp2), &exitCode); + if (args.count() > 2 && !args.at(2).isEmpty()) { + m_valuemapStack.top()[args.at(2).toKey()] = + ProStringList(ProString(QString::number(exitCode))); + } if (lines) { QTextStream stream(bytes); while (!stream.atEnd()) @@ -1277,6 +1291,38 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } return ReturnTrue; } + case T_DISCARD_FROM: { + if (args.count() != 1 || args.at(0).isEmpty()) { + evalError(fL1S("discard_from(file) requires one argument.")); + return ReturnFalse; + } + if (m_valuemapStack.count() != 1) { + evalError(fL1S("discard_from() cannot be called from functions.")); + return ReturnFalse; + } + QString fn = resolvePath(args.at(0).toQString(m_tmp1)); + ProFile *pro = m_parser->parsedProFile(fn, QMakeParser::ParseOnlyCached); + if (!pro) + return ReturnFalse; + ProValueMap &vmap = m_valuemapStack.first(); + for (auto vit = vmap.begin(); vit != vmap.end(); ) { + if (!vit->isEmpty()) { + auto isFrom = [pro](const ProString &s) { + return s.sourceFile() == pro; + }; + vit->erase(std::remove_if(vit->begin(), vit->end(), isFrom), vit->end()); + if (vit->isEmpty()) { + // When an initially non-empty variable becomes entirely empty, + // undefine it altogether. + vit = vmap.erase(vit); + continue; + } + } + ++vit; + } + pro->deref(); + return ReturnTrue; + } case T_INFILE: if (args.count() < 2 || args.count() > 3) { evalError(fL1S("infile(file, var, [values]) requires two or three arguments.")); @@ -1581,7 +1627,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( #ifdef PROEVALUATOR_FULL fputs(msg.toLatin1().constData(), stderr); #endif - } else { + } else if (!msg.isEmpty() || func_t != T_ERROR) { m_handler->fileMessage( (func_t == T_ERROR ? QMakeHandler::ErrorMessage : func_t == T_WARNING ? QMakeHandler::WarningMessage : diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 7d43610a31c..3f78878e630 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -1239,7 +1239,7 @@ bool QMakeEvaluator::loadSpec() goto cool; } } - evalError(fL1S("Could not find qmake configuration file %1.").arg(qmakespec)); + evalError(fL1S("Could not find qmake spec '%1'.").arg(qmakespec)); return false; } cool: diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h index e9cff77c67e..8f7a2072b5f 100644 --- a/src/shared/proparser/qmakeevaluator.h +++ b/src/shared/proparser/qmakeevaluator.h @@ -236,7 +236,7 @@ public: #ifndef QT_BOOTSTRAPPED void runProcess(QProcess *proc, const QString &command) const; #endif - QByteArray getCommandOutput(const QString &args) const; + QByteArray getCommandOutput(const QString &args, int *exitCode) const; QMakeEvaluator *m_caller; #ifdef PROEVALUATOR_CUMULATIVE diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp index 7751265e916..429ef3b500d 100644 --- a/src/shared/proparser/qmakeparser.cpp +++ b/src/shared/proparser/qmakeparser.cpp @@ -162,7 +162,7 @@ QMakeParser::QMakeParser(ProFileCache *cache, QMakeVfs *vfs, QMakeParserHandler ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags) { ProFile *pro; - if ((flags & ParseUseCache) && m_cache) { + if ((flags & (ParseUseCache|ParseOnlyCached)) && m_cache) { ProFileCache::Entry *ent; #ifdef PROPARSER_THREAD_SAFE QMutexLocker locker(&m_cache->mutex); @@ -184,7 +184,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags) #endif if ((pro = ent->pro)) pro->ref(); - } else { + } else if (!(flags & ParseOnlyCached)) { ent = &m_cache->parsed_files[fileName]; #ifdef PROPARSER_THREAD_SAFE ent->locker = new ProFileCache::Entry::Locker; @@ -209,13 +209,17 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags) ent->locker = 0; } #endif + } else { + pro = 0; } - } else { + } else if (!(flags & ParseOnlyCached)) { pro = new ProFile(fileName); if (!read(pro, flags)) { delete pro; pro = 0; } + } else { + pro = 0; } return pro; } diff --git a/src/shared/proparser/qmakeparser.h b/src/shared/proparser/qmakeparser.h index d370d17cbba..07a9f07753b 100644 --- a/src/shared/proparser/qmakeparser.h +++ b/src/shared/proparser/qmakeparser.h @@ -74,7 +74,8 @@ public: enum ParseFlag { ParseDefault = 0, ParseUseCache = 1, - ParseReportMissing = 2 + ParseOnlyCached = 2, + ParseReportMissing = 4 }; Q_DECLARE_FLAGS(ParseFlags, ParseFlag) diff --git a/src/tools/clangbackend/ipcsource/clangcodemodelserver.cpp b/src/tools/clangbackend/ipcsource/clangcodemodelserver.cpp index 62070b37b0b..3cbbd494453 100644 --- a/src/tools/clangbackend/ipcsource/clangcodemodelserver.cpp +++ b/src/tools/clangbackend/ipcsource/clangcodemodelserver.cpp @@ -55,6 +55,12 @@ #include #include +static bool useSupportiveTranslationUnit() +{ + static bool use = !qEnvironmentVariableIntValue("QTC_CLANG_NO_SUPPORTIVE_TRANSLATIONUNIT"); + return use; +} + namespace ClangBackEnd { ClangCodeModelServer::ClangCodeModelServer() @@ -116,9 +122,7 @@ void ClangCodeModelServer::updateTranslationUnitsForEditor(const UpdateTranslati // we might block the translation unit for a completion request // that comes right after this message. updateDocumentAnnotationsTimer.start(0); - QTimer::singleShot(0, [this, updateDocuments](){ - startInitializingSupportiveTranslationUnits(updateDocuments); - }); + delayStartInitializingSupportiveTranslationUnits(updateDocuments); } } catch (const std::exception &exception) { qWarning() << "Error in ClangCodeModelServer::updateTranslationUnitsForEditor:" << exception.what(); @@ -329,6 +333,16 @@ void ClangCodeModelServer::processInitialJobsForDocuments(const std::vector &documents) +{ + if (useSupportiveTranslationUnit()) { + QTimer::singleShot(0, [this, documents](){ + startInitializingSupportiveTranslationUnits(documents); + }); + } +} + void ClangCodeModelServer::startInitializingSupportiveTranslationUnits( const std::vector &documents) { diff --git a/src/tools/clangbackend/ipcsource/clangcodemodelserver.h b/src/tools/clangbackend/ipcsource/clangcodemodelserver.h index b03b4327faf..2622c01db69 100644 --- a/src/tools/clangbackend/ipcsource/clangcodemodelserver.h +++ b/src/tools/clangbackend/ipcsource/clangcodemodelserver.h @@ -72,6 +72,7 @@ private: void startDocumentAnnotationsTimerIfFileIsNotOpenAsDocument(const Utf8String &filePath); void processInitialJobsForDocuments(const std::vector &documents); + void delayStartInitializingSupportiveTranslationUnits(const std::vector &documents); void startInitializingSupportiveTranslationUnits(const std::vector &documents); void processJobsForDirtyAndVisibleDocuments(); diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg index 7002b7fd402..7d55635c446 100644 --- a/src/tools/icons/qtcreatoricons.svg +++ b/src/tools/icons/qtcreatoricons.svg @@ -3697,12 +3697,13 @@ id="path5168-9-0" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" /> - + @@ -3734,6 +3735,323 @@ d="m 1236,579.75 1.75,0 0,-1.75" style="fill:none;stroke:#808080;stroke-width:0.5" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="src/libs/utils/images/namespace"> + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/auto/debugger/dumpers.pro b/tests/auto/debugger/dumpers.pro index ed66def4055..a22349dc04d 100644 --- a/tests/auto/debugger/dumpers.pro +++ b/tests/auto/debugger/dumpers.pro @@ -2,10 +2,6 @@ QT = core network QTC_LIB_DEPENDS += utils -!win32 { -CONFIG -= release -CONFIG += debug -} include(../qttest.pri) msvc { @@ -45,4 +41,5 @@ HEADERS += \ INCLUDEPATH += $$DEBUGGERDIR # clang 3.5 does not like to optimize long functions. -clang: QMAKE_CXXFLAGS_RELEASE = +# likewise gcc 5.4 +QMAKE_CXXFLAGS_RELEASE = diff --git a/tests/manual/qml/testprojects/cppmockup/MainForm.ui.qml b/tests/manual/qml/testprojects/cppmockup/MainForm.ui.qml new file mode 100644 index 00000000000..14aa0928337 --- /dev/null +++ b/tests/manual/qml/testprojects/cppmockup/MainForm.ui.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.7 + +Rectangle { + property alias mouseArea: mouseArea + property alias textEdit: textEdit + + width: 360 + height: 360 + + MouseArea { + id: mouseArea + anchors.fill: parent + + MyComponent { + id: myComponent + x: 174 + y: 180 + } + } + + TextEdit { + id: textEdit + text: qsTr("Enter some text...") + verticalAlignment: Text.AlignVCenter + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + anchors.topMargin: 20 + Rectangle { + anchors.fill: parent + anchors.margins: -10 + color: "transparent" + border.width: 1 + } + } +} diff --git a/tests/manual/qml/testprojects/cppmockup/MyComponent.qml b/tests/manual/qml/testprojects/cppmockup/MyComponent.qml new file mode 100644 index 00000000000..3e6cf1694c0 --- /dev/null +++ b/tests/manual/qml/testprojects/cppmockup/MyComponent.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.6 +import MyPlugin 1.0 + +Item { + width: 40 + height: 40 + MyObject { + test: true + } + Rectangle { + anchors.fill: parent + gradient: Gradient { + GradientStop { + position: 0 + color: "#ffffff" + } + + GradientStop { + position: 1 + color: "#000000" + } + } + + } + +} diff --git a/tests/manual/qml/testprojects/cppmockup/cppmockup.pro b/tests/manual/qml/testprojects/cppmockup/cppmockup.pro new file mode 100644 index 00000000000..1f8ea65d427 --- /dev/null +++ b/tests/manual/qml/testprojects/cppmockup/cppmockup.pro @@ -0,0 +1,22 @@ +TEMPLATE = app + +QT += qml quick +CONFIG += c++11 + +SOURCES += main.cpp \ + mybackendobject.cpp + +RESOURCES += qml.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +### QML_IMPORT_PATH = $$PWD/mockups +QML_DESIGNER_IMPORT_PATH = $$PWD/mockups + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +HEADERS += \ + mybackenmodel.h \ + mybackendobject.h diff --git a/tests/manual/qml/testprojects/cppmockup/main.cpp b/tests/manual/qml/testprojects/cppmockup/main.cpp new file mode 100644 index 00000000000..32c7a2d4721 --- /dev/null +++ b/tests/manual/qml/testprojects/cppmockup/main.cpp @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include + +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + + qmlRegisterType("MyPlugin", 1, 0, "MyObject"); + + return app.exec(); +} diff --git a/tests/manual/qml/testprojects/cppmockup/main.qml b/tests/manual/qml/testprojects/cppmockup/main.qml new file mode 100644 index 00000000000..aff0f6ae262 --- /dev/null +++ b/tests/manual/qml/testprojects/cppmockup/main.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +import QtQuick 2.7 +import QtQuick.Window 2.2 + +Window { + visible: true + width: 640 + height: 480 + title: qsTr("Hello World") + + MainForm { + anchors.fill: parent + mouseArea.onClicked: { + console.log(qsTr('Clicked on background. Text: "' + textEdit.text + '"')) + } + } +} diff --git a/tests/manual/qml/testprojects/cppmockup/mockups/MyPlugin/MyObject.qml b/tests/manual/qml/testprojects/cppmockup/mockups/MyPlugin/MyObject.qml new file mode 100644 index 00000000000..0df2d302067 --- /dev/null +++ b/tests/manual/qml/testprojects/cppmockup/mockups/MyPlugin/MyObject.qml @@ -0,0 +1,5 @@ +import QtQuick 2.6 + +QtObject { + property bool test +} diff --git a/tests/manual/qml/testprojects/cppmockup/mockups/MyPlugin/qmldir b/tests/manual/qml/testprojects/cppmockup/mockups/MyPlugin/qmldir new file mode 100644 index 00000000000..2ee4872b4b8 --- /dev/null +++ b/tests/manual/qml/testprojects/cppmockup/mockups/MyPlugin/qmldir @@ -0,0 +1,2 @@ +module MyPlugin +MyObject 1.0 MyObject.qml diff --git a/tests/manual/qml/testprojects/cppmockup/mybackendobject.cpp b/tests/manual/qml/testprojects/cppmockup/mybackendobject.cpp new file mode 100644 index 00000000000..ea93896af03 --- /dev/null +++ b/tests/manual/qml/testprojects/cppmockup/mybackendobject.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "mybackendobject.h" + +MyBackendObject::MyBackendObject(QObject *parent) : QObject(parent) +{ + +} + +bool MyBackendObject::test() const +{ + return false; +} + +void MyBackendObject::setTest(bool) +{ + +} diff --git a/src/plugins/qmldesigner/styledoutputpaneplaceholder.h b/tests/manual/qml/testprojects/cppmockup/mybackendobject.h similarity index 75% rename from src/plugins/qmldesigner/styledoutputpaneplaceholder.h rename to tests/manual/qml/testprojects/cppmockup/mybackendobject.h index c55830115d8..e637ac12a6e 100644 --- a/src/plugins/qmldesigner/styledoutputpaneplaceholder.h +++ b/tests/manual/qml/testprojects/cppmockup/mybackendobject.h @@ -1,3 +1,4 @@ + /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. @@ -23,24 +24,24 @@ ** ****************************************************************************/ -#pragma once +#ifndef MYBACKENDOBJECT_H +#define MYBACKENDOBJECT_H -#include +#include -namespace QmlDesigner { -namespace Internal { - -class StyledOutputpanePlaceHolder : public Core::OutputPanePlaceHolder +class MyBackendObject : public QObject { + Q_OBJECT + + Q_PROPERTY(bool test READ test write setTest) + public: - explicit StyledOutputpanePlaceHolder(Core::Id mode, QSplitter *parent = 0); + explicit MyBackendObject(QObject *parent = 0); -protected: - void childEvent(QChildEvent *event) override;; + bool test() const; + void setTest(bool b); -private: - QString m_customStylesheet; +public slots: }; -} // namespace Internal -} // namespace QmlDesigner +#endif // MYBACKENDOBJECT_H diff --git a/tests/manual/qml/testprojects/cppmockup/qml.qrc b/tests/manual/qml/testprojects/cppmockup/qml.qrc new file mode 100644 index 00000000000..cabeffdb5a6 --- /dev/null +++ b/tests/manual/qml/testprojects/cppmockup/qml.qrc @@ -0,0 +1,7 @@ + + + main.qml + MainForm.ui.qml + MyComponent.qml + +