Commit Graph

4 Commits

Author SHA1 Message Date
Friedemann Kleint
ec6b38dea0 Fix Qt 5.13 deprecation warning about QFontMetrics::width()
Replace by QFontMetrics::horizontalAdvance(), fixing:
warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated:
 Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations]

Change-Id: I9991ffefe6e87e872dc35ba291d562e06b28ca64
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-02-15 15:12:02 +00:00
Alessandro Portale
e38410b76c Utils: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default

Change-Id: I8d44d9405011a1878353baf9325f7af90b89db02
Reviewed-by: hjk <hjk@qt.io>
2018-07-20 13:36:22 +00:00
Andre Hartmann
632f2a7709 Locator: Add camel hump locator filter for C++, QML, and files
* Use the CamelHumpMatcher in the C++, QML, and files filters
* Supports matching against UpperCamelCase, lowerCamelCase
  and snake_case strings
* Supports highlighting of matched characters

Task-number: QTCREATORBUG-3111
Started-by: David Kaspar <dkaspar@blackberry.com>
Change-Id: If6220191432ef965bde3c8dbe4a10d89e222ba6f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-09-19 08:24:38 +00:00
Eike Ziller
3841d2fce2 Locator: Fix diverse issues with drawing highlighted text
To draw the result items with highlighted parts, we split the text to
draw into "before highlight", "highlight" and "after highlight", and
painted them separately. This had several issues:

It breaks the text layout. Characters within a text are often started at
subpixels, which was not so visible in the static search results, but
lead to ugly artifacts while typing in Locator (enter a search term, and
then continue adding characters that still match the first found item,
and watch the effect in the "after highlight" part).

It needs a lot of custom painting code. Properly supporting text elide
modes is hard, scaling to more than one highlight as well. Reusing parts
of the QItemDelegate base functions also has its issues, e.g. that
clipping doesn't work well.

Instead, QItemDelegate::drawDisplay should make it possible to set
format ranges for the text it draws. This patch copies part of
QItemDelegate to be able to add this parameter. Unfortunately Qt
currently has a bug (QTBUG-62019) that character backgrounds are not
painted far enough (1 pixel to the right has the wrong background), which
looks very ugly in selected items in the search results. So we use the
new delegate only for Locator for now, to be used later for the search
results too, when that bug is fixed.

Task-number: QTCREATORBUG-18532
Change-Id: Idf59b2c2bcfa6b188a810f7a3128a81e7e6fffb1
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-07-26 07:16:25 +00:00