Commit Graph

82 Commits

Author SHA1 Message Date
Artem Sokolovskii
b06db48869 Wizard: Improve QtQuick2 extension plugin
- Added options for Kit version
- Added CMake support for Qt6.2
- Added options for creating example project,
which uses the plugin

Task-number: QTCREATORBUG-26982
Change-Id: I808c01bce6e4015a679f2fd69767c13179a25ee5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-03-21 12:47:11 +00:00
Eike Ziller
51d23ad64f Merge remote-tracking branch 'origin/6.0'
Change-Id: I55d228482ceda144f903fb85eef048d53602ad18
2022-01-24 10:34:10 +01:00
Samuel Ghinet
d023dfca1e Fix creating a project from a Recent preset with custom size
When creating a project from a Recent preset, everything worked well if
the user selected a predefined size. However, when typing a custom width
and custom height, the recent was saved with the selected/active item in
the screen size combobox.

This patch does the following to fix the issue:
* Save the recent info with the screen size written in the text fields
  (since they're updated when the user selects a different size from
  combobox but the user can type in any other value, the text fields
  always reflect the user's choice of width and height)
* When loading a preset for display in the UI, if the preset was saved
  with a custom size that does not exist in the predefined list (i.e. in
  the combobox), whether that is a custom size or a different
  orientation of a predefined size, then append an item into the screen
  size combobox so that this custom size will appear as one of the
  predefined sizes for the preset. This is both for visual reasons (so
  that the combobox would have a valid item active on display) and in
  order to be able to save in the backend model this choice (when the
  user decides to create the project)
* Update the ListField::selectRow function so that it does not attempt
  to select an item that does not exist. The reason is that, when the
  user clicks "Create" to create the project, the QWizard will be reset
  to the first page, and any modification we might have made to the
  model of the screen size combobox will be gone - and thus the
  selection would be invalid, which would normally cause the wizard to
  fail on page->isComplete(). By not allowing it to select an item in
  this case, we rely on the custom width and custom height fields to
  hold the real values.

Task-number: QDS-5691
Change-Id: I9e848c5f4957252eb414da7e7146f9f8e7be760c
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-20 08:56:08 +00:00
Alessandro Portale
d7ed48ac6f Add missing "emit"s
Change-Id: I88a7397c7689b1e72cdd0e52077f8097443963c0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-11-11 14:10:42 +00:00
Samuel Ghinet
32799b3a7b Make additional changes in the QtCreator side required for QDS new project dialog
* We need to use the CheckBox field to set the checked state of fields
  (TargetQtVersion, Use as default project location).
* When the validation of the Project Name or Project Location fails, we
  need a way to be notified of what went wrong. We also need a way to
  force the project intro page to execute the validation of those fields
  whenever we need (i.e. when the user types into our QML TextField
  controls)

Also, add a warning on loading wizards: whenever a wizard.json file
cannot be parsed, we should issue a qWarning(), so that we can more
easily notice when something went wrong.

Task-number: QDS-4490
Change-Id: I7cfa61b4e43d731db9d0679e093e723d947b60c0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-30 09:41:04 +00:00
hjk
98fad961a6 ProjectExplorer: Use FilePath in JsonWizard
Also remove m_currentPath and logic around it, as it was unused.

Change-Id: Id32ae2845e3788a3e24bb238005b31e8f174f6b9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-28 07:49:36 +00:00
Samuel Ghinet
b985530144 Make changes in the QtCreator side required for QDS new project dialog
* We need the showing of the Wizard dialog to be optional
* Each wizard has a "detailsPage.qml" file that stores wizard-specific
  UI configuration. We need a way to access that path (QUrl) from QDS.
* ComboboxField is used directly by QDS, and the field object is
  fetched by a call to JsonFieldPage::jsonField() - hence, the
  ComboboxField needs to be dllexported. We need to access fields
  directly from QDS because the QML controls use those fields as backend.
* From QDS we need to select / activate in a combobox field, and to see
  which item is current (activated). We also need to make use of the
  model that the ComboBoxField uses in order to show those same items in
  the qml controls of QDS.
* From QDS we need to set the text in a LineEditField

Task-number: QDS-4490
Change-Id: Ia42d539a5bcbf3dff4593fb027ac18c52da4d046
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-09-21 13:21:44 +00:00
Samuel Ghinet
8bd1969e7f Enhance logging capabilities for wizard classes
* Added QDebug operator<< for the Field classes so that they could be inspected during runtime (i.e. logged)
* Added optional QDebug operator<< overloads for QVariant (wizarddebug.h) - to better visualize the data parsed from the wizard.json files (QVariant objects), by using a format more in the like of json.

Change-Id: I53a729b24e4f2d9c9acf1ed802ac9dc3bb67f373
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-09-02 12:11:11 +00:00
David Schulz
6008c5f673 Core: filepathify LocatorFilterEntry
Change-Id: I279af30f6b57e8d1279d96e5cbae4025cf4ef473
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-08 07:46:37 +00:00
Christian Kandeler
d12e3cb72d Wizards: Use a FancyLineEdit::ValidationFunction
... rather than a QValidator.
QLineEdit's behavior of preventing invalid input is not suitable here,
as its concept of intermediate states is too limited.

Change-Id: If34793966e8b06762db86b90bb1dbb1526b74ea7
Fixes: QTCREATORBUG-22080
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-12-10 08:26:41 +00:00
Christian Kandeler
3a6e4860c4 Wizards: Delay validity check in LineEditField
... until the values have actually been set up.

Fixes: QTCREATORBUG-24971
Change-Id: Ia967fe95545eda1c9044faf8ab1ee885bf3d9e02
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-12-03 08:32:03 +00:00
Jarek Kobus
6b588d7227 Remove unused variables
Mark some of them with Q_UNUSED, since it looks like
sometimes the copy is done on purpose, to force detach
or used for some hack with memory management.
In one case make unused variable used again.

Change-Id: I3825cd3399fa63bf6e12173c64509287d4a125e5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-11-20 13:58:46 +00:00
Christian Kandeler
1f72edcda9 Wizards: Fix crash
... if the project has no classes.
Apparently, one must not call QFutureInterface::reportsResults() with an
empty list, so prevent that.
Also, for simplicity, make sure we have only one possible point of
deletion for the watcher.

Change-Id: I68c3813459533ced86610e88bea81b6a9d170ca5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-08-12 08:21:12 +00:00
Christian Kandeler
45dd017853 Wizards: Offer auto-completion in "New C++ Class" wizard
That is, offer existing namespaces for the class name line edit and
existing classes for the base class line edit.

Fixes: QTCREATORBUG-10066
Change-Id: I276036864626eff92997e40e4e22ab16c4f4d617
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-21 10:11:37 +00:00
hjk
611a3bb68a Even more Qt6 porting
Task-number: QTCREATORBUG-24098
Change-Id: Ib6ef0e521483153c9716c9a1870072e836d6b026
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-23 11:24:44 +00:00
Christian Stenger
839e776012 PE: JsonWizard: Improve handling of check boxes
Only handle active user clicks as 'modified' to be able
to react on (un)setting values by expressions that depend
on other fields.
Improves the check box handling on the "Add C++ Class" and
"Add Python Class" wizards as it re-evaluates the check box
state based on an expression as long the user does not
actively checks the respective check box.

Change-Id: I739c02b85196555c0379272005ca3b0095f7c762
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-05-28 05:03:59 +00:00
Christian Stenger
0aa1a3ad4b Revert "JsonWizard: Fix restoreLastHistoryItem for LineEdit"
This reverts commit e3abd5b348 as it broke
updating evaluating line edits.

Change-Id: Ie729a63d6a2b87df7143aba26726b657cffb8148
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-05-26 09:23:09 +00:00
hjk
68c539bb9d Utils: Replace FileChooser::path() by filePath().toString()
Keep the old method for now to ease downstream porting.

The change is kept mechanical, there's a lot of cleanup possible now
on the user code side.

Change-Id: I936baedd45b7ba057f1c789a1bec896886f48eff
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-04-09 17:45:06 +00:00
Andre Hartmann
e3abd5b348 JsonWizard: Fix restoreLastHistoryItem for LineEdit
The value was successfully loaded from the history,
but overwritten again.

Let's now check if the line edit already contains
a value (loaded from history) before setting the
default text.

Change-Id: Ic0acad83f76e0aca76309dfd213183a210d334ac
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-04-08 10:45:03 +00:00
Andre Hartmann
0c1906319d JsonWizard: Fix spelling of "restoreLastHistoryItem"
Change-Id: If442b51bc5dc67ab668eb77afb8f0a0ead7c7c95
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-04-06 16:25:42 +00:00
hjk
84d0e3dda8 Utils: Use FilePath for PathChooser::m_baseDirectory
... and collapse the two accessor versions to one.

Change-Id: I282753a0092601cff073684053ff914016452645
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-12-19 07:59:13 +00:00
Nikolai Kosjar
6c1b11dd3e ProjectExplorer: Simplify
bugprone-branch-clone
readability-simplify-boolean-expr

Change-Id: Iaaac21e96a3e9db6b9819d77fdae623ede373e59
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-01 09:31:32 +00:00
Christian Kandeler
0d81e90bb1 Wizards: Fix ComboBox implementation
The ComboBoxField class used the QComboBox view's selection model as the
source for the current value, which makes no sense, as the item that was
last selected was not necessarily activated by the user.

Fixes: QTCREATORBUG-23149
Change-Id: I8587dd20381e142b91f13a987e54c86b8f6237c8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-10-28 12:14:18 +00:00
Christian Kandeler
4702faba06 Wizards: Add the ability to remember user choices
Wizard authors can now provide a persistence key to values where that
makes sense.
For now, we make use of it for the build system type in all wizards and
the minimum Qt version as well as the virtual keyboard settings in the
QtQuick wizards.

Fixes: QTCREATORBUG-16657
Change-Id: I179930665bd163b1cf198467ab8b43bc72f8ec4a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-23 12:48:56 +00:00
hjk
251287f0d3 Avoid warning on empty expressions
For some reason, Q_UNUSED includes already a semicolon, adding one
on the user side creates an additional empty statement.

Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-23 11:55:59 +00:00
Alessandro Portale
0933c20de8 connect() to ambiguous signals/slots: Replace static_cast with QOverload
Change-Id: I473d7a2a16509cee944a2a21b022a3f6f02cfd8d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 14:07:03 +00:00
Eike Ziller
e0d38ae414 Export Wizard values to JavaScript macro
Registers a new function "value('name')", available to the wizard json
files, which returns the value of the variable "name" as a JavaScript
object. So, variables with a string value are actual JavaScript strings,
booleans are booleans, lists are lists, and dictionaries are
dictionaries.

The patch also makes it actually possible to assign JSON lists and
dictionaries to values.

This removes some hacks involving creating complex JavaScript objects
through string substitution.

Change-Id: I4ac6da22bc5bccc9fadee97694c2fa14d44c9307
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-09 11:19:43 +00:00
Eike Ziller
788ef20247 JSON Wizards: Give labels more space even when word-wrapped
QLabel has a horizontal size policy of "Preferred", but if the label is
word-wrapped, the sizeHint is a using a golden ratio for width & height,
but we want the label to grab as much horizontal space as it gets
anyhow.

Change-Id: I6ed049f4f23158014dc04f2d5020b7c2dd4c1980
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-05 07:26:10 +00:00
Alessandro Portale
616e19ff9e Fix warning: "Missing emit keyword on signal call"
[-Wclazy-incorrect-emit]

Change-Id: I93bdc6e23cdaccf35c9899ae16870ccc65a54f80
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-01-17 15:54:56 +00:00
Robert Loehning
747d1ef9f1 Remove unused variables
Change-Id: I8b49a2eea7509abb685d751a0f038dc3b4f555ca
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-09-07 14:02:23 +00:00
Tobias Hunger
80c2ce118d ProjectExplorer: Modernize even more
Use unique_ptr for all *Private classes, except for those
in singletons.

Change-Id: Ib56c31ddedc6e9cf321f15de1f1e697a27ad4089
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-07-24 09:04:54 +00:00
Alessandro Portale
8d19333075 ProjectExplorer: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default
modernize-use-transparent-functors

Change-Id: Iebed22caa2e733d292f334e956e3d16b844e14e3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-07-16 10:01:53 +00:00
Alessandro Portale
8797123128 ProjectExplorer: Fix warning about signed/unsigned mismatch
Msvc says:
warning: C4018: '>=': signed/unsigned mismatch

Change-Id: Ib3fc4734088bd799271105ed3757d55562efcba3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2018-04-12 13:36:49 +00:00
Tim Jenssen
18ad5653d5 Wizards: fix crash when index is wrong
Task-number: QTCREATORBUG-20193
Change-Id: I20da636a3db478c6ff0d812b1b3dc3405f73cb8e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-04-09 08:28:10 +00:00
Robert Loehning
2109f3573f Wizards: Add missing spaces
Change-Id: If4bb6a48b1da1433c36e367c700d18a10fabe45d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2018-02-12 10:07:48 +00:00
Tim Jenssen
30d123e2ec Wizards: add IconListField
- reuse some code from ComboBoxField throw an abstract ListField class
 - ListField can handle more data like: icon, trToolTip
 - fix disabledIndex in ComboBoxField
 - adjust documentation

Change-Id: I00b6ab787fb2fad97dafff32786cf73c636c772d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-10-30 11:55:35 +00:00
Tim Jenssen
2f3acee4e0 Wizards: add a warning about unsupported keys
- parseData methods check that there is no unknown key is used
 - showing the name and type might be useful in warning and error messages

Change-Id: I1371bb3af1ad48ed4b85260f3b1309cdba1cb71f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-10-26 11:32:03 +00:00
Tim Jenssen
7dbd399a97 Wizards: introduce ObjectToFieldWidgetConverter
With it as a wrapper we can register any QObject
to use widget based field mechanism from QWizard.

It also helps to avoid the necessity for inheritance
to just adjust the text property of a widget.

Can not remove the TextCheckBox, because it is used
in some old C++ wizards.

Change-Id: I85a85a834714a4b38b501c13357fa8c8bb02b5bd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-29 09:34:08 +00:00
Tim Jenssen
bb16ae7323 Wizards: let the page use wizard values
For example it will be used to get the
wizard directory to show icons in fields later.

Change-Id: I6a243a67a89e4a0133550a61b870d771147667f1
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-29 07:59:24 +00:00
Tim Jenssen
c0b2ba829f Wizards: add label for spanned widgets
Change-Id: Ib6cd4791d33a3b14b37f63adb967e17c9357da9f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-27 09:01:41 +00:00
Tim Jenssen
08d3ef13a7 Wizards: improve looking for a factory
Change-Id: I5d384ff43b01274556c30a1669a953955d81a501
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-27 09:01:24 +00:00
Tim Jenssen
2f0a395017 Wizards: make get widget a bit more robust
Change-Id: I0182147f517a39c3fdb0f27be4354b30e2cc4f31
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-07-19 09:14:49 +00:00
Tim Jenssen
ca39f63b33 Wizards: Remove QLatin1String from JsonFieldPage
Change-Id: I91e69c80c62ac6f77fd1823f246097355cd81286
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-06-15 09:02:15 +00:00
Eike Ziller
64b19af7dd Merge remote-tracking branch 'origin/4.3'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri

Change-Id: I6d89ea588de955f5d878500b59285d3adde6c77d
2017-05-15 15:31:55 +02:00
Tobias Hunger
3e8e82b2e3 Wizards: Fix wizards in KDE environments
KDE checks for a "text" property in the wizard pages and will then replace the
text it sees there with some text with added '&' characters. This breaks the
wizards, so rename the properties to something that is not "text".

Task-number: QTCREATORBUG-17503
Change-Id: Ie513848cef9cd795f06a47659abb550abd268b11
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-05-12 13:34:37 +00:00
Alessandro Portale
3624a663d8 Reduce usage of qApp in favor of static function calls
Q*Application classes have unusually many static functions. In many
cases in our code, these functions are unnecessarily called as instance
functions, using the qApp helper.

This patch replaces many occurencies of qApp with the according
Q*Application classname.

Change-Id: I6099a419fa7bf969891269c37ed7a9e817ef5124
Reviewed-by: hjk <hjk@qt.io>
2017-04-24 18:36:28 +00:00
Tobias Hunger
0c0c0a6fd0 Jsonwizard: Modernize JsonFieldPage elements
QTCREATORBUG-17190 is fixed by this since initialization is fixed as a side effect;-)

Task-number: QTCREATORBUG-17190
Change-Id: I9d1f81d6cca26fcdd9ba8a49ee66e05607d6cae1
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-10-31 13:04:03 +00:00
Tobias Hunger
318b6c9dba JSON Wizards: Add "isPassword" property to LineEdits
Change-Id: I5539c66c162345bda052546fa02cc69d4bd55f9a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2016-10-10 08:29:48 +00:00
Victor Heng
f0a4ad1b6c JsonWizard: Hide label when widget is hidden in Field Page
Setting "visible" of a widget (such as TextField) to false in a Field
Page hides the widget, but leaves it's label visible. Modified each
field to update it's label visibility when the widget is shown/hidden.

Change-Id: Idf20c624b6aad09a2be159e2fc697fcb24bd2bc5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-06-06 18:53:27 +00:00
Eike Ziller
33210099f1 Merge remote-tracking branch 'origin/4.0'
Change-Id: I9793f0f9019b16f3725c5a9708a5ccf81557cdc6
2016-06-03 09:50:43 +02:00