... when using declarations are involved.
Second attempt.
I have a suspicion that this is not the "correct" approach, however:
a) It appears to fix the problem.
b) It does not break any tests.
c) It's rather high in the call tree, so there's a low likelihood
of breaking something else.
d) Considering the hacky-looking pre-existing code dealing with
using declarations (e.g. LookupContext::lookupByUsing()),
it seems quite possible that there is no "correct" way with
the current infrastructure.
Fixes: QTCREATORBUG-14524
Change-Id: I28c6e53137c21ce158bbd03b92b3db39146116d5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This effetively reverts 87ec0f349f, which had unwanted side effects.
Change-Id: I03438c18f43b07a6560416af746132bc4471fbb7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... when using declarations are involved.
Fixes: QTCREATORBUG-14524
Change-Id: I0c391b88628f40973b6f601e60c64263f62a88a0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... for the edge case of the insertion location being preceded by a
function whose body is a try-catch clause.
Fixes: QTCREATORBUG-14661
Change-Id: Icc7d5283ead81d644231479317214a8cc177493d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Previously only using directives in the global scope that followed the
quickfixed using directive were removed
Change-Id: I330acfe3236a6845fd1667f9fa699ab6c8fb560d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
- Make sure the template parameters are included in the definition.
- Find the correct insertion location when using an already-defined
template member function as an anchor.
Fixes: QTCREATORBUG-24848
Change-Id: I1272ba36403904e7aed81bcef48745793c5e2217
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
There are a lot more problems in this area (e.g. with nested classes),
but let's tackle them one by one.
Fixes: QTCREATORBUG-24801
Change-Id: I4b3805ea6f8b28373925693650150bbd89508096
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
That is, allow the cursor to on some "neutral" place in the body of the
declaration, not only strictly on the class name.
Fixes: QTCREATORBUG-15699
Change-Id: I74ad6048c16c19d418446c990178535d878fc630
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
The check whether there are unimplemented member functions takes quite
long, so Creator would freeze for several seconds when right-clicking on
the name of even a medium-sized class.
Therefore, we offer the operation for all classes with member functions
and move the expensive check into the perform() method.
Change-Id: Ie19958ba8c53493be859f9982d7d5697e6e9d88b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Introduces a QuickFix settings page where the generation of getters and
setters can be customized. The settings can be saved into a file that can
go into a VCS. All QuickFixes that generate getter/setter/signals/
Q_PROPERTIES now use the same backend. QuickFixes that generate getters/
setters are now extended to also generate signals and Q_PROPERTIES.
Fixes: QTCREATORBUG-1532
Fixes: QTCREATORBUG-17941
Fixes: QTCREATORBUG-12678
Fixes: QTCREATORBUG-15779
Fixes: QTCREATORBUG-11620
Fixes: QTCREATORBUG-22707
Fixes: QTCREATORBUG-20157
Fixes: QTCREATORBUG-21804
Fixes: QTCREATORBUG-19814
Fixes: QTCREATORBUG-14622
Fixes: QTCREATORBUG-19803
Change-Id: I50ed2dad9b4a637fbd87b3e1f2856060ad0ad920
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Previously, typedefs were ignored and the new code became invalid after
applying the quickfix.
Change-Id: I0d4295e90d02dfacc3edac5ac3f96d9edbeaf662
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
If you mention "Q_OBJECT" in a raw string literal, the cmake build
fails...
Change-Id: I9004184b48dea9a77b9303c3fd871cef747ade4c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
That is, if a class member being initialized is not yet declared, offer
to add the declaration.
Fixes: QTCREATORBUG-11842
Change-Id: I1d2a56ab99543e996e220aa26b7923023dd163f7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... from a block of code.
We must not insert an empty line into the newly created function,
because it gets indented in the first indent operation, resulting in
trailing characters after the actual code has been inserted later.
Fixes: QTCREATORBUG-12118
Change-Id: If438d4de379cae90baa846c112866f2777b44fce
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... to also generate the RESET function.
Fixes: QTCREATORBUG-11809
Change-Id: I94789227230a67f074ff5fdc76ad8113d2870dd6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Having no namespace when inserting generated functions may insert
explicitly at the end of a header which is not always desired as we
need to take care of e.g. header guards as well.
Change-Id: I3b154ae936a96f2f8e7e34cda6b5bcdfcbc83faf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... when creating functions in header files. Otherwise, we will likely
cause linker failures in non-trivial projects.
Fixes: QTCREATORBUG-15052
Change-Id: Ic0fff8779ba924f8b9943ab233a0cda409e73e9d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
If the class is in a namespace and the cpp file does not yet have any
implementations in that namespace, then we would erroneously put the
getters in the global namespace.
Fixes: QTCREATORBUG-14886
Change-Id: I836537abddfdd92ced783d60e1226b082bbc238e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Anchor the opening brace at the closing parenthesis, rather than at the
statement. This way, we won't get troubled by macro weirdness in the
statement part.
Fixes: QTCREATORBUG-13921
Change-Id: I05af24d1642e6b62c78bb2f47a1ef0b1fea326d0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
It can easily happen that callers insert indent ranges out of order, and
without sorting the indentation done earlier in the file is not
considered for the later parts, leading to inconsistent results.
Fixes: QTCREATORBUG-18929
Change-Id: Ice2abe92d54446bcdd102c6a1f822262a8533543
Reviewed-by: David Schulz <david.schulz@qt.io>
... so it works for all kinds of symbols, not just Qt classes.
Fixes: QTCREATORBUG-21
Change-Id: I2d329c09b64cd8f7eef8cce7d9f022aca8586c0d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... when trying to create definitions from declarations.
Instead, we completely ignore friends in this context, arguing that the
respective function normally should have a proper declaration somewhere
else.
Fixes: QTCREATORBUG-7164
Change-Id: I3ddb89cefecbc494f9c7e63600b65fd6288b7169
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Variables declared like this:
enum { E1, E2 } e;
would not get assigned a proper type.
Task-number: QTCREATORBUG-7487
Change-Id: I4362f22feb0f2e4e1e754e9c623e5576fa31f4bc
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Consider these two variable declarations:
enum EX { EX1, EX2};
EX ex;
emum EY { EY1, EY2} ey;
The ex variable would correctly get assigned type EX, but the ey
variable would not have any type.
This is now fixed.
Task-number: QTCREATORBUG-7487
Change-Id: I3e09c5766fdb9e6baf3a8d7bc6f2fc581f2d824b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
In header files, a forward declaration is often preferable to including
another header file, so let's offer this as a quickfix.
Fixes: QTCREATORBUG-23444
Change-Id: Ib50550abb5337098e4122e65e2af42a66742d6f6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Adding a "= new <TypeName>" after converting a stack variable without
assignment or initializer to pointer.
Also remove the assignment when converting from pointer to stack
variable as this works better with explicit constructors.
Fixes: QTCREATORBUG-23181
Change-Id: I377ec32a1b66cf4b96db14cfcb4b71fb96c80c98
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This applies for e.g.
* "Add Definition..." (on function decl)
* "Move Definition..." (on function decl)
* "Insert Virtual Functions of Base Class" (on class specifier)
Fixes: QTCREATORBUG-11849
Fixes: QTCREATORBUG-19699
Change-Id: I0d259bc1782470f3b3f19617230005a5594a5cca
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
It is the type used by the HeaderPath class, so reflect that in
the name.
I also considered to rename HeaderPath to IncludePath, but
that name is reflected in a lot of users, which would also need
to be adjusted for consistency. That would blow up the patch size
for little value IMHO.
Change-Id: I51421dbd3ab8b2874dc32fc82dc394c9b93ce5e9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
System include paths are appended after other includes by the compiler. So
we should set them as system includes and not as normal includes. Otherwise
we change the include order. Headers in system include paths are not
cluttering the screen with unwanted warning and by the way improve
performance too.
ProjectPartHeaderPath was a dopperganger of HeaderPath, so we merged them.
Change-Id: I7c394b4098b697de79761499ffcd5913cc02d652
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Not needed anymore.
Also some cleanup, no 'using' in headers etc.
Change-Id: I8c4547d80d0c0ffd989d1efbc74687c9f56096a4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>