Commit Graph

130 Commits

Author SHA1 Message Date
hjk
355b8e4d1a Fix QIcon::pixmap() related deprecation warnings
QPixmap pixmap(const QSize &size, qreal devicePixelRatio, Mode mode = Normal, State state = Off) const;
    QT_DEPRECATED_VERSION_X_6_0("Use pixmap(size, devicePixelRatio) instead")
    QPixmap pixmap(QWindow *window, const QSize &size, Mode mode = Normal, State state = Off) const;

Change-Id: I8b08bec86014809887c1915b72c2776bae4a87fb
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-06-05 16:40:02 +00:00
Alessandro Portale
0650fe14e5 Utils: Update Figma text tokens
This adds UiElementLabelMedium and UiElementLabelSmall.

Change-Id: I592f2bdf7a4d0a98e38ea69c33cf1b27040f7eea
Reviewed-by: hjk <hjk@qt.io>
2024-06-05 14:30:00 +00:00
hjk
efae651924 Utils: Introduce a convenience function creatorColor()
... forwarding to creatorTheme()->color(...)

Change-Id: Iefaa043495127b3e500ed225584481d3ec0f8c1f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-05-29 13:49:25 +00:00
hjk
8c61df1cff Handle QFontDatabase related deprecation warnings
QFontDatabase is 'all static' nowadays.

Change-Id: I1e20a7b8452961b8051d0299b89d161ded95d8fa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-05-27 14:22:17 +00:00
Alessandro Portale
a0b19d9fba Welcome: Restore legibility
After the release of Qt Creator 13.0.0, a couple of bug reports and
comments regarding reduced legibility appeared.

They boil down to:

 1) Text appears blurry
 2) Text is too small
 3) Text contrast is too low

This change fixes the blurryness by setting less custom font weights for
non-HighDpi systems in StyleHelper::uiFont().

Bigger texts are used for the "Session" and "Recent Project" delegates.

The text contrast is being increased by making Token_Text_Accent darker
for light themes and brighter for dark themes.
Token_Background_Muted, which is used as background color is made a bit
brighter for light themes.

Fixes: QTCREATORBUG-30579
Fixes: QTCREATORBUG-30637
Fixes: QTCREATORBUG-30650
Change-Id: I8eeb9db6854a19b0de0bcee14b10e2ef66234e06
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: hjk <hjk@qt.io>
2024-05-02 15:52:11 +00:00
Alessandro Portale
0817f7ae5e Utils: Replace imageFileWithResolution with qt_findAtNxFile
qt_findAtNxFile does a better job at returing a suited @Nx-image for
"exotic" device pixel ratios. This change fixes for example the active
mode icon when running Qt Creator at 250% ui scaling.

Task-number: QTCREATORBUG-30464
Change-Id: Ia90ba3573fcd4af7941322d7dbc8905fe140192b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2024-03-13 06:49:55 +00:00
Christian Stenger
3e90ccaf35 Utils: Fix Qt6.2 build on macOS
Change-Id: I2b2ca409b88551dc71b7784ff2d7678fe45e3fc2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-02-29 05:33:34 +00:00
Alessandro Portale
903d01b934 Welcome: Implement new design
2024 redesign

Change-Id: I6629849921272d856f201693973a8e29c6465e94
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-02-27 16:42:10 +00:00
Alessandro Portale
7d659b446d Utils: Introduce StyleHelper::uiFontLineHeight
The "Text tokens" which are defined in Figma have an additional line
height value.

This change adds a getter function for the line heights.

Change-Id: I9513ac2f689292baf6e2c0a52fca8a1ec7f14dc1
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2024-01-31 20:06:14 +00:00
Alessandro Portale
03db2fd6c5 Utils: Add two fonts to StyleHelper::UIElement
Change-Id: I0b4ff271ef9fe91eb369c916ad886c7d39c2e060
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2024-01-31 20:06:05 +00:00
Alessandro Portale
4d56f9b840 Utils: Improve metrics handling in StyleHelper::uiFont
Figma designs have font sizes defined in pixels. We want to
define font sizes in points.

This change introduces the original font pixel size values from Figma
and provides the conversion to sensible point sizes.

Change-Id: Ic8356942a9bc033d2b5cd62863d2bd0a4cc6973b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2024-01-31 20:05:52 +00:00
Alessandro Portale
022ff621d4 Utils: Quote font-face in StyleHelper::fontToCssProperties
Font faces should be quoted. '.AppleSystemUIFont', which is the default
on macOS, would break the CSS parsing if not quoted.

This change uses single quotes (which is equivalent with double) for the
task, because inline CSS in HTML is usually already quoted with double
quotes.

Change-Id: I08d8de1131f58a9c968cf45acc636cb2b3b21700
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2024-01-30 20:19:13 +00:00
Alessandro Portale
fb28890eb2 Utils: Introduce H5, H6 and "H6 Capital" Ui fonts
As defined by the new Qt Creator design system.

Change-Id: Ib67b35ea552cf88c4b89481b72e690e04a57bbb7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-12-11 12:03:44 +00:00
Alessandro Portale
d5b3366d55 Utils: Change UiElementCaptionStrong from Bold to DemiBold
The new font design suggests a slightly less caption font. This
has a visual impact on the mode bar labels.

Change-Id: I8d0714785b1e3f5b4c73493e0c9f45fcfc69b562
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2023-12-11 10:04:39 +00:00
Alessandro Portale
608bb8cf3d Utils: Add StyleHelper::fontToCssProperties
This function takes a QFont and returns the relevant CSS properties as a
string. Using that CSS string in Qt's HTML supporting widgets ensures
the true to detail HTML rendering of text elements with those CSS
properties.

This change also adds an HTML sample to tst_manual_widgets_uifonts.

Change-Id: I7caf3214854f6ee62ae1211015572c640fc08dc8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-12-08 09:10:50 +00:00
Alessandro Portale
a4a27b8931 Utils: Fix function name case StyleHelper::Uifont -> uifont
Oopsie.

Change-Id: I66c4b56f43c50e3dfc5c17ffd95d778d496b77f2
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-12-07 11:05:12 +00:00
Alessandro Portale
1da84754db Utils: Align enum StyleHelper::UiElement with upcoming design system #3
The Qt Creator Design System defines display headings H1 and H2 with a
"Titillium  Web" font face.

This change introduces the "Titillium Web" based as new H1 and H2 and
lets the WelcomeScreen code obtain them via StyleHelper::UiFont(). It is
supposed to not change the visual appearance.

Change-Id: Ia2c5ac14858e574c4ffd31af1ed80ac1781cd970
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-11-17 10:43:06 +00:00
Alessandro Portale
b3acdae338 Utils: Align enum StyleHelper::UiElement with upcoming design system #2
This change "PanelTitle" to "Caption". It is supposed to not change the
visual appearance.

Change-Id: I3342e6c80d8ce11b7ab1ac40b4395c265e1e07ec
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-11-17 10:43:00 +00:00
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