diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-04-24 19:49:50 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-04-27 08:47:31 +0000 |
commit | 9c17fd0dbe6ca18c98741abc27f8729926b95d8c (patch) | |
tree | 46cb7e3ae4a00cc25668b2fe4218c65d41a1f8fd /src/plugins/qmldesigner/designmodewidget.cpp | |
parent | 02226300120a2c3c3795159736ed0b84d46fbb44 (diff) |
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 icon font and related constants
Change-Id: I31ac33917d2db002697ce63f50f5c181c5fdb103
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner/designmodewidget.cpp')
-rw-r--r-- | src/plugins/qmldesigner/designmodewidget.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 7769fb43a9..9bc485fd90 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -60,6 +60,7 @@ #include <utils/algorithm.h> #include <utils/fileutils.h> #include <utils/qtcassert.h> +#include <utils/stylehelper.h> #include <QSettings> #include <QToolBar> @@ -70,6 +71,7 @@ #include <advanceddockingsystem/dockareawidget.h> #include <advanceddockingsystem/docksplitter.h> +#include <advanceddockingsystem/iconprovider.h> using Core::MiniSplitter; using Core::IEditor; @@ -227,6 +229,26 @@ void DesignModeWidget::setup() QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/dockwidgets.css")); m_dockManager->setStyleSheet(Theme::replaceCssColors(sheet)); + // Setup icons + QColor buttonColor(Theme::getColor(Theme::QmlDesigner_TabLight)); // TODO Use correct color roles + QColor tabColor(Theme::getColor(Theme::QmlDesigner_TabDark)); + + const QString closeUnicode = Theme::getIconUnicode(Theme::Icon::adsClose); + const QString menuUnicode = Theme::getIconUnicode(Theme::Icon::adsDropDown); + const QString undockUnicode = Theme::getIconUnicode(Theme::Icon::adsDetach); + + const QString fontName = "qtds_propertyIconFont.ttf"; + const QIcon tabsCloseIcon = Utils::StyleHelper::getIconFromIconFont(fontName, closeUnicode, 28, 28, tabColor); + const QIcon menuIcon = Utils::StyleHelper::getIconFromIconFont(fontName, menuUnicode, 28, 28, buttonColor); + const QIcon undockIcon = Utils::StyleHelper::getIconFromIconFont(fontName, undockUnicode, 28, 28, buttonColor); + const QIcon closeIcon = Utils::StyleHelper::getIconFromIconFont(fontName, closeUnicode, 28, 28, buttonColor); + + m_dockManager->iconProvider().registerCustomIcon(ADS::TabCloseIcon, tabsCloseIcon); + m_dockManager->iconProvider().registerCustomIcon(ADS::DockAreaMenuIcon, menuIcon); + m_dockManager->iconProvider().registerCustomIcon(ADS::DockAreaUndockIcon, undockIcon); + m_dockManager->iconProvider().registerCustomIcon(ADS::DockAreaCloseIcon, closeIcon); + m_dockManager->iconProvider().registerCustomIcon(ADS::FloatingWidgetCloseIcon, closeIcon); + // Setup Actions and Menus Core::ActionContainer *mwindow = Core::ActionManager::actionContainer(Core::Constants::M_WINDOW); // Window > Views |