Commit Graph

112 Commits

Author SHA1 Message Date
Alessandro Portale
7f60ce0666 Utils: Align enum StyleHelper::UiElement with upcoming design system #1
This change demotes the existing H1 and H2 to H3 and H4. It is supposed
to not change the visual appearance.

Change-Id: Idc3056307f0286a2d4d276ba79125ba93d5ac428
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-11-17 10:42:53 +00:00
Alessandro Portale
6c57c51981 Use StyleHelper::UiFont()
Change-Id: I0c09578b76c48ddb255f44bb6117089dd092a72c
Reviewed-by: hjk <hjk@qt.io>
2023-11-15 15:02:13 +00:00
Alessandro Portale
f8671f3e3c Utils: Introduce StyleHelper::UiFont() for centralized font definitions
Custom font sizes of UI texts like titles and subtitles were usually
defined on the spot in code. With the upcoming focus on unified fonts
and colors in Qt Creator, a centralization of font styles in needed.

This adds the font getter function StyleHelper::UiFont() and the enum
UiElement that specifies types as H1..H6 and some custom ones.

Change-Id: Ie0d6e6fb51fe24d8aee6b4242941cbff45fe3853
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2023-11-15 15:02:06 +00:00
Alessandro Portale
4b98bebb86 Utils: Change prefix of global static variable names from m_ to s_
Change-Id: Ibf50f1e4db1791e6800b508f80fe1e0cc9d12ef7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-11-10 11:38:35 +00:00
Mike Chen
10a390c3d2 StyleHelper: fix floating-point DPR icon pixelated
set the DPR as a floating point number for the pixmap.

Change-Id: I354e27556dbd8a0d53cfc3e0c2b708f06406aaf5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-11-03 02:55:14 +00:00
Alessandro Portale
1824db503e Utils: Restore original default DPI rounding policy
Qt Creator 11.0.2 changed the default DPI rounding policy to
"PassThrough" for Windows. In QtC 12, there is now a setting that allows
the user to chose the policy. The default was changed to "PassThrough"
also for Linux.

This change sets the default back to the original policy "Round" which
Qt Creator used from the beginnings of HighDPI support.

Amends: 3726f0d6c1

Change-Id: I74f2310f1b5379c8dea0bf86aee965374ca2732e
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-10-20 09:42:29 +00:00
Alessandro Portale
64870f9163 Utils: Move defaultHighDpiScaleFactorRoundingPolicy() to StyleHelper
... from HostOSInfo. A better suited place.

Amends: 3726f0d6c1

Change-Id: I5ba052603ae438b9347f1091088f0d105d19f587
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-05 08:05:53 +00:00
hjk
9679412a23 Replace QFile::exists by QFileInfo::exists
QFile::exists only calls QFileInfo::exists, so this saves one
function call per invocation.

Change-Id: I41cb407345654eeead14455a4955b8b9b015aedc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-01 10:24:31 +00:00
Alessandro Portale
fb406a26f4 Utils: Turn StyleHelper into a namespace
It was in fact just a bag of static functions. Most importantly, it
fixes a previouls introduced build error.

Amends 5975657e77

Change-Id: Ia7de8bdcf91e1763f9d3b435316a5df9993717de
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-11 17:10:40 +00:00
Alessandro Portale
e44d0c57dc Utils: Fix the applying of new base color at run-time
If the base color was changed via the color picker that opens with
shift-click on the upper left toolbar area, some widgets were not
instantly updated with the new color.

This change ensures that all (visible) widgets instead of just all top
level windows get updated after changing the color. While this method is
potentially more expensive, it does not effect the start-up negatively,
because on start-up StyleHelper::setBaseColor() gets called before the
mainwindow is shown.

Fixes: QTCREATORBUG-29135
Change-Id: I227c2f243ffcd9f8210b9d2d1a47ad0494663d50
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-05-10 13:25:19 +00:00
Alessandro Portale
5975657e77 Utils: Centralize style-related property names as constants
This introduces string constants in Utils::StyleHelper. They are used by
code all over in Qt Creator to tell ManhattanStyle how to paint certain
widgets.

Change-Id: Iecca36103f80084cd5fe93fcb6b18b8fbb3a32bb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-10 13:25:10 +00:00
Alessandro Portale
02637390fa ManhattanStyle: Draw round rectangles in "Relaxed toolbar style"
Task-number: QTCREATORBUG-29054
Change-Id: Ic06ddfec87fd9b43c88b3a7dfb9946c3a8b22c60
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-05 11:36:25 +00:00
Alessandro Portale
495f5f006f Utils: Add toolbarStyle to StyleHelper
Task-number: QTCREATORBUG-29054
Change-Id: I01572eb7bdd267ea6aadb9530afc52b3c7834382
Reviewed-by: hjk <hjk@qt.io>
2023-05-05 11:36:06 +00:00
Alessandro Portale
3821683647 StyleHelper: Add setter for "panelwidget[_singlerow]"
20 string duplications warrant a centralized setter. A couple more of
them will come with the upcoming toolbar changes.

Change-Id: Ide8c680da21d5be09f968bcc0a774e062c6f0260
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-04-26 09:23:29 +00:00
Tim Jenßen
feabda3aa7 Merge remote-tracking branch 'origin/10.0' into qds/dev
bigger conflicts resolved at:
  src/plugins/qmldesigner/CMakeLists.txt
  src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp

Change-Id: I08e2a109d8e37cbd77225129854e9e633725bfc7
2023-03-26 16:26:18 +02:00
Henning Gruendl
1b2328f4a7 QmlDesigner: Apply new theme on navigatior toolbar
Change-Id: I1e2448a2d8eea1bd3badf27ee02913d8470851c6
Reviewed-by: Brook Cronin <brook.cronin@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2023-02-09 08:40:47 +00:00
Christian Stenger
8655603c2e Utils: Improve readability on output windows
Enhancing the StyleHelper by some functionality used
on the results pane of the AutoTest plugin and make use of it
inside the output formatter.
This highly improves readability depending on the current theme
when having output formatters and allows to easily re-use the
output formatter there instead of having several stuff
re-implemented.
Mainly relevant for output formatted with ANSI escape codes.

Change-Id: Ic2f5eff877656eb52e3bd2fda0ec9a015e54ea82
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-02-03 06:34:53 +00:00
Thomas Hartmann
4597317d2d QmlDesigner: Fix crash
Task-number: QDS-9009
Change-Id: Id2c862e1890ecfc0f2d14bf58eb6cb4c5112d0ba
Reviewed-by: Burak Hancerli <burak.hancerli@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2023-02-01 11:15:38 +00:00
Thomas Hartmann
724eb54387 Add QDSTheme to theming and use it in ManhattanStyle
Change-Id: If3f634cd96665150b27605eaf7a2a5d4ea7078b6
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-31 12:41:07 +00:00
Ali Kianian
757a6f2e12 QmlDesigner: Handle QmlEditorMenu in Manhattan style
* QmlEditorMenu is handled in Manhattan style.
* Icons are available for cascading menu items in macOS.
* Shortkeys hints are handled and right aligned in the menu.
* The style is customized  QmlEditorMenu.

Task-number: QDS-8720
Change-Id: Iff5ebae0dce70dade5b48a1abe4232e70d6953d6
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2023-01-26 14:33:07 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Alessandro Portale
dfa5b54647 Utils: Fix StyleHelper::drawArrow workaround for 6.4.0
The workaround that fixed the drawing of arrows after a change between
6.4.0 and 6.4.1 broke the drawing of arrows with Qt 6.4.0.

This change add another enforced detachment of the palette (leading to a
modified cache key) that works with Qt 6.4.0. It still works with 6.4.1.

Amends: 9d32093421

Change-Id: I8917c99488cec4fb17ed148bb3b0f95d4ed7127c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-11-21 15:26:57 +00:00
Alessandro Portale
9d32093421 Utils: Workaround StyleHelper::drawArrow for Qt 6.4.1
A change in Qt 6.4.1 influences the behavior of QPalette::setColor, so
that the arrows appear in a wrong color. An enforeced detachment of the
palette in style option works as a workaround.

Fixes: QTCREATORBUG-28470
Change-Id: I4a44ff59c368105fdf448152d83e96cdedd46495
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-11-18 16:27:46 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Jarek Kobus
ed40753ed1 Utils: Drop unused headers [I-Z]
Round 2 - focus on sources.
For classes with initial in range [I-Z].
Try to keep the same separators between different kind of headers.

Change-Id: I8a7ab99bab8120ee72cda6433ee3dc6f260a4d76
Reviewed-by: hjk <hjk@qt.io>
2022-05-25 07:49:25 +00:00
Jarek Kobus
0a8dbaf153 Utils lib: Remove unneeded includes from cpp files
It's a result of a team work consisting of yellow triangle and me.

Change-Id: I8b4812766da70e0785ae71bf0cb71357379e2514
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-05-19 12:37:20 +00:00
Aleksei German
181fd57cc4 QmlDesigner: Fix for rotation cursor
- Added new icons to icon font
 - Uses new drawing method for rotation cursor

Task: QDS-3131

Change-Id: Ifa8dda2630794694dd262396ca314a9b4e6675ad
Reviewed-by: Brook Cronin <brook.cronin@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-11-20 10:49:52 +00:00
Henning Gruendl
f726b0d90b QmlDesigner: Enable modes/states with icon font
Add functionality to use modes and states when generating a QIcon
from a font in StyleHelper

Task-number: QDS-2558
Change-Id: I764e8434a645d0984c6104cd1868fd5b0091d225
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-08-03 12:54:51 +00:00
Orgad Shaneh
51453936cc Utils: Replace foreach with range-based for
Change-Id: I9aeea9c029ffc56cbadc04edd20e9b35b154f986
Reviewed-by: hjk <hjk@qt.io>
2020-06-16 04:43:29 +00:00
Alessandro Portale
0e1fb1cf06 QmlDesigner: Make alternative icon engine HighDPI-aware
Change-Id: Ib1c757aac7cf7a963b2912f98fc5cd403f667ed7
Reviewed-by: Aleksei German <aleksei.german@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-29 20:46:05 +00:00
Henning Gruendl
a35a9e72d9 QmlDesigner: Extend icon font support
* Use ADS::IconProvider to make use of font icons
* Add support for IconProvider in FloatingWidgetTitlebar
* Add support for named font icon entities in QmlDesigner::Theme
* Add level of indirection to Constants.qml to be able to parse it
  from inside C++
* Add color and HighDPI support in stylehelper
* Update RichTextEditor
* Update icon font and related constants

Task-number: QDS-1913
Change-Id: I7212f4dfe480dbb340fd042f59c69b8f5ca7a8e4
Reviewed-by: Aleksei German <aleksei.german@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-04-20 16:21:46 +00:00
Aleksei German
ab5a0c9cb1 QDS IconFont to Icons importer
Change-Id: Idae58499cf3a3e3967e701597b0f00c16367c602
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-04-07 18:40:59 +00:00
Christian Stenger
f188622704 AutoTest: Re-use established code
Instead of "parsing", modifying and highlighting the text
after it has been added use existing code to get formatted
code beforehand.

Change-Id: I33be2950f9b9a6910ad80b10b132089f4e5f0b1c
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-01-08 14:10:26 +00:00
Christian Stenger
9ac4e29a20 Move helper functions to more public location
Change-Id: I12a2000bfc82c194d12fb5c25302a06f782aa605
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-11-15 12:00:31 +00:00
Friedemann Kleint
a49175aa29 Fix some deprecation warnings about String::sprintf() and qVariantFromValue()
stylehelper.cpp:216:46: warning: 'QString& QString::sprintf(const char*, ...)' is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
...
baseenginedebugclient.cpp:124:49: warning: 'QVariant qVariantFromValue(const T&) [with T = QmlDebug::ObjectReference]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations]
...

Change-Id: Iafdb58b8a66f1b0a14342fa5b29e31fc4997a621
Reviewed-by: hjk <hjk@qt.io>
2019-05-28 08:11:48 +00:00
Friedemann Kleint
963dc84cc5 Fix some deprecation warnings in basic plugins
Fix warnings apppearing in 5.13, for example:
warning: ‘QDir& QDir::operator=(const QString&)’ is deprecated: Use QDir::setPath() instead [-Wdeprecated-declarations]
...
warning: ‘static QRgb QColorDialog::getRgba(QRgb, bool*, QWidget*)’ is deprecated: Use getColor() [-Wdeprecated-declarations]
warning: ‘Qt::DropAction QDrag::start(Qt::DropActions)’ is deprecated: Use QDrag::exec() instead [-Wdeprecated-declarations]
warning: ‘void QProcess::finished(int)’ is deprecated: Use QProcess::finished(int, QProcess::ExitStatus) instead [-Wdeprecated-declarations]
...
warning: ‘const QRect QDesktopWidget::availableGeometry(int) const’ is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations]
...
warning: ‘const QBrush& QPalette::background() const’ is deprecated: Use QPalette::window() instead [-Wdeprecated-declarations]
...
warning: ‘const QBrush& QPalette::foreground() const’ is deprecated: Use QPalette::windowText() instead [-Wdeprecated-declarations]
...
warning: ‘void QTextOption::setTabStop(qreal)’ is deprecated [-Wdeprecated-declarations]
warning: ‘void QList<T>::swap(int, int) [with T = ProjectExplorer::BuildStep*]’ is deprecated: Use QList<T>::swapItemsAt() [-Wdeprecated-declarations]
warning: ‘void QProcess::setReadChannelMode(QProcess::ProcessChannelMode)’ is deprecated: Use QProcess::setProcessChannelMode() instead [-Wdeprecated-declarations]
...
warning: ‘QString QFileInfo::readLink() const’ is deprecated: Use QFileInfo::symLinkTarget() instead [-Wdeprecated-declarations]

Change-Id: I1d893d42d372245892f2de8406f52dbe7bbd552a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-02-11 09:32:06 +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
Alessandro Portale
4c0e86ecc1 utils: Fix StyleHelper::baseColor with lightColored
Change-Id: I3b06664585c0a608962f2d627859fd388bcb0372
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-14 15:09:29 +00:00
Alessandro Portale
5e89fae10f Unify the dimensions for all mode/action bar icons
Having icons of all different kinds of sizes makes it difficult to get
the painting right in all cases. It definitely fails when the szsytem is
running in multi-monitor mode with different scaling factors. Unifying
the dimensions makes it possible.

This change should not cause any visual difference in a purely scaled or
unscaled screen.

Task-number: QTCREATORBUG-18869
Change-Id: I3a864c9a86036b4f4f3b350a489077b247ca85b7
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2017-09-19 13:54:30 +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
Friedemann Kleint
ce088cb754 Call QPainter::end() prior to QPixmapCache::insert()
Inserting a QPixmap with active painters on it causes it to
do a deep copy of it, which is unnecessary.

Task-number: QTBUG-58653
Change-Id: I49123ffcec2e12a01c87974b7a513d68a11185d4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-02-08 11:33:01 +00:00
Thomas Hartmann
80ca67e43f StyleHelper: Fixing alphaBlendedColors
Change-Id: Ib2f5e37e213e221ecfcce876ed2f44013815ca46
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2016-07-28 09:00:08 +00:00
Alessandro Portale
4bdd1ffbf7 Themes: Enable using the original Window color for toolbars
This patch adds a flag which enables the "fancy" side/tool/status bars
to use the original Window color from the application palette.

The flag is disabled for all themes by default.

Task-number: QTCREATORBUG-16331
Change-Id: I1433e865e1903012d521a2cdb7083f110086e455
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
2016-07-28 08:58:47 +00:00
Alessandro Portale
2a765db3a5 Fix text color of progress/find status summary label
Using a themed text color instead of a hard-coded one and making sure
that ManhattanStyle does not tweak it.

Task-number: QTCREATORBUG-16643
Change-Id: I4bac9b29ee3c293270f39438664d617ac7591c8e
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2016-07-22 11:11:56 +00:00
Alessandro Portale
276b20409d Themes: Lighter toolbar borders
The toolbar border/separator lines for flat themes need to be a bit
lighter.

This change introduces StyleHelper::toolBarBorderColor and puts it into
use for drawing all toolbar borders.

Change-Id: Icef20759ce282e768f6ba867474e506b9230b864
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
2016-07-21 10:17:05 +00:00
Alessandro Portale
3b30617758 Core: Improved theme-awareness in application menu painting
Using theme colors rather than hard-coded ones and at the same some
simplification.

This is needed for an upcoming "Flat Light" theme.

Change-Id: I8a8715a16d1b246c5228978633143eb64d371701
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2016-06-21 15:24:15 +00:00
Alessandro Portale
abb63602de Utils: Make the "shadow" under toolbar icons optional
In preparation od a "Flat Light" theme, where shadows under the icons
would have a negative impact.

Change-Id: I2d9d3563c90336640513c1a970a432898dd63cfc
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
2016-06-20 07:49:56 +00:00
Alessandro Portale
4707fc4945 StyleHelper: Silence warning about wrong format string
Change-Id: Ic31f3ed15a9039098d0e1467fc51487bd0201113
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
2016-03-31 11:58:26 +00:00
Alessandro Portale
2710168446 ManhattanStyle: Themable arrows
This change makes arrows in e.g. ComboBoxes themable. This also improves
the clear distinction between enabled and disabled state.

Change-Id: If40dcd3e162ad71d1bc6507c047203aa60e09ee6
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
2016-03-31 10:40:32 +00:00
Alessandro Portale
ddde4bdd27 Utils: Improved handling of StyleHelper::baseColor
This change makes sure that the "UI coloring" feature respects the
original brightness of the current theme. It prevents dark themes from
getting a too light recoloring and vice versa.

Extra benefit: this allows to remove much recently introduced code.

Change-Id: Ib2c96e7ed172a4cc97520aa4b5d180cc6353c661
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-03-21 14:23:23 +00:00