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>
Already worked with the shortcut defined in the settings, but not with
the standard shortcuts defined by QKeySequence.
Task-number: QTCREATORBUG-16586
Change-Id: I4dc02e29ee5d273c3bfc9de28f52e90cffc2397c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
We assume that libclang does not return any duplicates, at least we
never noticed any so far. For the concrete test below no duplicates were
removed.
Function overloads are not problematic because they are folded into one
ClangAssistProposalItem (addOverload()).
To the completion items from libclang we add the Qt Creator snippets as
items. Those might have the same text in the completion list view, but
their icon is different (e.g. consider the keyword completion "class"
and the Qt Creator snippet "class"), thus the user can still tell them
apart.
Test:
1. Open src/plugins/clangstaticanalyzer/unit-tests/qt-essential-includes.pro
2. Open main.cpp
3. Complete in the main function
Measured with a timer in IpcReceiver::codeCompleted.
On Linux, for 20637 completion items:
Before: 74ms (avg)
Now: 66ms (avg)
Gain: 11%
Change-Id: I524eaa09f8d9e07c78dc9efcc77f7e021c6f37f7
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Check for invalid (top level) or valid indexes in the overridden
functions. This prevents crashes due to accessibility traversing
the model.
Task-number: QTCREATORBUG-13142
Change-Id: I22d0831338436479e6ec3b215514bbb9513dffc7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
For unit test we need to break every dependency to the TextEditor
Widget etc.. With an abstract interface we can implement it in clang
without relying on unwanted dependencies. It makes it also easier to
compute the values deferred.
Change-Id: I1b313a1625f4e80bd324ab4bf1a7c4f6b690abe9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
...since that's
1. easier to handle (see e.g. QTCREATORBUG-15630, where a "&" was
not properly auto-detected).
2. consistent with the tooltip that is used for function signatures
(FunctionHintProposalWidgetPrivate)
Change-Id: I66aab253e13c5c7f63a0d9ddaf297b890567f335
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This reverts commit c5f70a3bad1ee2457741459cafb6419c67c417ad.
We will set the rich text unconditionally in a follow-up change to
simplify things.
Change-Id: I59aad8e33011ef68aa7c32ec80bb02edfd29c6a6
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
The tooltip text right to the completion list item is prepared for rich
text (html) interpretation, but the QLabel the text will finally be
displayed with has no explicit text format set and thus defaults to auto
detection. The auto detection works fine for e.g. "<i>int optionalArg</
i>" but fails for "const Foo&".
Task-number: QTCREATORBUG-15630
Change-Id: Ia58d65ee542730e4823c69150d452cdde98112f8
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Ensures that the DeferredDelete event is posted from the outermost
loop level.
Change-Id: Ib74d49d35811f35659ef272d6f0e0a4508f93076
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Mostly done using the following ruby script:
Dir.glob('**/*.cpp').each { |file|
next if file =~ %r{src/shared/qbs|/qmljs/}
s = File.read(file)
s.scan(/^using namespace (.*);$/) {
ns = $1
t = s.gsub(/^(.*)\b#{ns}::((?!Const)[A-Z])/) { |m|
before = $1
char = $2
if before =~ /"|\/\/|\\|using|SIGNAL|SLOT|Q_/
m
else
before + char
end
}
if t != s
puts file
File.open(file, 'w').write(t)
end
}
}
Change-Id: Ief087658e2adc337ee02c49f0fb406597114df07
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
Simplifies the code base by removing one level of unused
and unneeded abstraction.
- Merge {I,Default}AssistInterface to AssistInterface
- Merge {IAssist,Basic}ProposalItem to AssistProposalItem
- Merge {IGenericProposal,BasicProposalItemList}Model to GenericProposalModel
Change-Id: I54ee7b095427383d67a00fc1d87c3808c21d812d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* Consolidate code dealing with C++ identifiers into cpptoolsreuse.h
* Handle code points that are represented with two QChars
Change-Id: I4fb4435aa539f65d88598cac0b50629f33f32440
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This is a workaround for black tooltips or even crahes when the nvidia
driver is used.
Task-number: QTCREATORBUG-11653
Change-Id: I4ddc09354a9956a55ac6b196a596f3eaeef13670
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Assumption: model never has 1 entry for immediate result
(there is always the natural result + "Searching for overrides"
Change-Id: I5de7e7933b1309f995a6111a2ab1c7aed31c086e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
...otherwise subsequent events (e.g. Return) might trigger functions
operating on an invalid model index (see activateCurrentProposalItem).
Task-number: QTCREATORBUG-10589
Change-Id: Ib3e37c8c85c882135970d5d9418d6e69917494c6
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
F2 on a virtual function call presents a list of overrides in derived
classes. The function declaration of the static type is shown
immediately at the top.
Task-number: QTCREATORBUG-9611
Change-Id: I80ce906fa06272dc9fbd1662cd17500b8c77067f
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
... for the same function
Task-number: QTCREATORBUG-5748
Change-Id: Iadf5be76c24f95cf057c2112a8248bea2a9e20cf
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Since fuzzy completions are allowed, the lexicographically first proposal
is not necessarily most relevant. The patch modifies sorting of proposals
so that the exact match and continuations go first, and fuzzy completions
follow.
Moreover, being a continuation seem to be a more important characteristic
of a proposal, than being it a function argument or keyword etc. That's why
the check for continuation is placed before the check for order.
Task-number: QTCREATORBUG-8737
Task-number: QTCREATORBUG-9236
Change-Id: I89aae9d2ce6bfa59af7c2f75e6f3af00212008ca
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Alexey Zhondin <lexxmark.dev@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Otherwise it is passed on to other widgets (like the Find toolbar)
Task-number: QTCREATORBUG-5748
Change-Id: I3e7fe19327d2b3d15c9c9f84360b936dc4698dfd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
Stop resizing width on scrolling the proposal
widget via drag of the scrollbar.
Task-number: QTCREATORBUG-7925
Change-Id: I948a0ec1bba8a9294b8a65b5eaa72063bbede48f
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
The width of the List view showing the
autocompleter proposals is now adjusted
when scrolling.
Task-number: QTCREATORBUG-7185
Change-Id: I5b26ef6195d389b30fdf0964bebd9c2f33056c66
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
The class' member functions are intended to be used
instead of the Q_OS_* macros in all contexts where
the latter are not syntactically required.
This lowers the likelihood of changes made on one
platform breaking the build on another, e.g. due to
the code model missing symbols in #ifdef'ed out code
when refactoring.
Change-Id: I4a54788591b4c8f8d589b8368a6c683d4155c9fa
Reviewed-by: hjk <qthjk@ovi.com>
this is the behaviour of many OS X widgets, e.g. in Spotlight
Change-Id: Idc769d45d53b332bafdfb8190fd3d14843347776
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>