Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
pixmapeditor.h
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef PIXMAPEDITOR_H
5#define PIXMAPEDITOR_H
6
7#include <QtWidgets/qdialog.h>
8
9#include <QtGui/qpixmap.h>
10
11#include <optional>
12
13QT_BEGIN_NAMESPACE
14
15class QLabel;
16class QHBoxLayout;
17class QToolButton;
18
19class QDesignerFormEditorInterface;
20
21namespace qdesigner_internal {
22
23class DesignerPixmapCache;
24class IconThemeEditor;
25class IconThemeEnumEditor;
26class PropertySheetIconValue;
27
29{
31public:
33private:
34 explicit IconThemeDialog(QWidget *parent);
35 IconThemeEditor *m_editor;
36};
37
39{
41public:
42 static std::optional<int> getTheme(QWidget *parent, int theme);
43
44private:
45 IconThemeEnumDialog(QWidget *parent);
46 IconThemeEnumEditor *m_editor;
47};
48
49class PixmapEditor : public QWidget
50{
52public:
54
55 void setSpacing(int spacing);
56 void setPixmapCache(DesignerPixmapCache *cache);
57 void setIconThemeModeEnabled(bool enabled);
58
59 static QString msgThemeIcon(const QString &t);
60 static QString msgMissingThemeIcon(const QString &t);
61 static QString displayText(const PropertySheetIconValue &icon);
62
63public slots:
64 void setPath(const QString &path);
65 void setTheme(const QString &theme);
66 void setThemeEnum(int e);
67 void setDefaultPixmap(const QPixmap &pixmap);
68 void setDefaultPixmapIcon(const QIcon &icon);
69
71 void pathChanged(const QString &path);
72 void themeEnumChanged(int themeEnum);
73 void themeChanged(const QString &theme);
74
75protected:
76 void contextMenuEvent(QContextMenuEvent *event) override;
77
78private slots:
80 void resourceActionActivated();
81 void fileActionActivated();
82 void themeEnumActionActivated();
83 void themeActionActivated();
84#if QT_CONFIG(clipboard)
88#endif
89private:
90 enum class State {
91 Empty,
92 ThemeEnum,
93 MissingThemeEnum,
94 XdgTheme,
95 MissingXdgTheme,
96 Path,
97 PathFallback // Non-existent theme icon, falling back to path
98 };
99
100 static State stateFromData(int themeEnum, const QString &xdgTheme, const QString &path);
101 State state() const;
102 static QString displayText(int themeEnum, const QString &xdgTheme, const QString &path);
103
104 void updateLabels();
105 bool m_iconThemeModeEnabled;
106 QDesignerFormEditorInterface *m_core;
107 QLabel *m_pixmapLabel;
108 QLabel *m_pathLabel;
109 QToolButton *m_button;
110 QAction *m_resourceAction;
111 QAction *m_fileAction;
112 QAction *m_themeEnumAction;
113 QAction *m_themeAction;
114 QAction *m_copyAction;
115 QAction *m_pasteAction;
116 QHBoxLayout *m_layout;
117 QPixmap m_defaultPixmap;
118 QString m_path;
119 QString m_theme;
120 int m_themeEnum = -1;
121 DesignerPixmapCache *m_pixmapCache;
122};
123
124} // namespace qdesigner_internal
125
126QT_END_NAMESPACE
127
128#endif // PIXMAPEDITOR_H
The QDesignerFormEditorInterface class allows you to access Qt Widgets Designer's various components.
friend class QWidget
Definition qpainter.h:421
void setSuperPalette(const QPalette &palette)
static QString msgMissingThemeIcon(const QString &t)
void setTheme(const QString &theme)
void setDefaultPixmap(const QPixmap &pixmap)
static QString displayText(const PropertySheetIconValue &icon)
void setPixmapCache(DesignerPixmapCache *cache)
static QString msgThemeIcon(const QString &t)
void setDefaultPixmapIcon(const QIcon &icon)
void setIconThemeModeEnabled(bool enabled)
void contextMenuEvent(QContextMenuEvent *event) override
This event handler, for event event, can be reimplemented in a subclass to receive widget context men...
void themeEnumChanged(int themeEnum)
void themeChanged(const QString &theme)
static constexpr auto defaultResourceAttributeC
static constexpr auto themeEnumAttributeC
static constexpr auto flagsAttributeC
static constexpr auto validationModesAttributeC
static constexpr auto resettableAttributeC
static constexpr auto themeAttributeC
static constexpr auto superPaletteAttributeC
static constexpr auto fontAttributeC
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
#define QT_PROPERTYEDITOR_EXPORT