This adds C++11-style initializers and breaks the initializer list into a new line, since most classes will have other members to be put in new lines as well.
Change-Id: I7b6d6bf6f32dbd58a744405aefabb02be9f45316
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
That is, if the user specifies a custom base class, we check whether its
constructor takes a "QObject *parent" parameter, and if it does, we give
the derived class one as well.
This is technically a heuristic, but the pattern is pretty stable in the
Qt world.
Fixes: QTCREATORBUG-25156
Change-Id: Ie64440929df61cca7258d6d692c5de62970f9a65
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... to class name field in "New Class" wizard.
This way, users understand right away that the class name can include
namespaces.
Change-Id: I84aaf2aca532a97ba40f72fd2385fcab40788970
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
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>
Technically, almost any "new file" wizard could be used to create a C
file, but conceptually, it makes the most sense to turn the "C++"
category into "C/C++".
Fixes: QTCREATORBUG-23621
Change-Id: I002365fa35cc6c9bf7c71039e122f72890f66b1a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
If the project has a header file whose name suggests that it might
declare the base class, then add an include statement for it.
While we cannot guarantee that the include statement is resolvable as-
is, it's at least a basis for the user to adapt accordingly, while
without any include statement the class will definitely not compile.
Fixes: QTCREATORBUG-3855
Change-Id: I55ec43d58a9a13b9b59a5bbe6415a457b974b654
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
The original version is not valid JSON, even though the QJSON parser
will accept it:-/
Change-Id: Id408e4b83a62bca358191cf6fe4b3a7ce7d7c59e
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Slots have become rather irrelevant with Qt5 and C++11. Let's not annoy
and/or confuse users by reserving a segment for them in our generated
classes.
Change-Id: Ied26bd627c87654ac26f6577387397f39367c0ee
Reviewed-by: hjk <hjk@qt.io>
This lets users specify that a class derived from a custom base should
have a Q_OBJECT macro, and it also allows them to opt out of it for
classes derived directly from QObject & friends.
Fixes: QTCREATORBUG-21810
Change-Id: I850bd3bcb7b6eb71720afe5fa097178ff5d5c620
Reviewed-by: hjk <hjk@qt.io>
Provide general infrastrucure and implementation for qmake.
Fixes: QTCREATORBUG-16067
Change-Id: I8c6368fe2724c9450dcbc3410b6ca459bbbdc043
Reviewed-by: hjk <hjk@qt.io>
This was broken in 63c339ffba while trying to fix a different bug.
Fixes: QTCREATORBUG-18157
Change-Id: Iec7e14de257195ed9bb20314b8031d3ef59df2ae
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
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>
It's a valid use case to put new files into a new directory.
Task-number: QTCREATORBUG-15599
Change-Id: Iea479d7a723302a14ba8cc887c1036ea6a120ced
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
The header file must be referenced relative to the location of the
source file.
Task-number: QTCREATORBUG-15599
Change-Id: Ib7d4aa5a62a94541cbe32cd340a8a1e7d6ef35e5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Allow users to choose #pragma once instead of #ifndef include guards in
generated header files.
Fixes: QTCREATORBUG-12166
Change-Id: I3ba41c7570beb9c5958e174b5581fcc25855050f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Filip Bucek <fbucek@atlas.cz>
Generate header guard of cpp classes based on the header file name, not
based on the class name (plus the preferred extension for header files).
Task-number: QTCREATORBUG-15864
Change-Id: I8c2b5d4a78e59a2389091ed5933b5bdeae8e5730
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Remove "kind" as that is no longer necessary (even though it is still
handled if that is in the wizard).
Change-Id: I3e56d5e0d936b622dae5091950427f9b2db60695
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Now that we have the infrastructure to handle both separately it makes
no more sense to merge them.
Change-Id: Ia2694eef60c0fe17b025e4d6766c7a8f775513f5
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Map existing class wizards to file wizards. The separation has never
been clean anyway. Now "file" wizards create one or more files,
"project" wizards create a complete project (something that can be
opened as a project in Qt Creator).
Change-Id: I0562f26019b54a59d46814a13a0b2fa8995c3e0f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
It is very often a mistake to define a destructor without a copy (and move)
constructor and assignment operator. In C++11 no move constructor and
assignment operator will be generated if a destructor is defined. So it is
better to omit a lonely destructor in out template.
https://en.wikipedia.org/wiki/Rule_of_three_%28C%2B%2B_programming%29
Change-Id: If911556f872d878939f0f2fcaa974494a4df8a8a
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Make use of a validator when entering C++ class names.
Change-Id: Id7f9c8c2e1fe036397a337595cbe7aa7fd9589d5
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>