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// Qt-Security score:significant reason:default
4
5#ifndef PIXMAPEDITOR_H
6#define PIXMAPEDITOR_H
7
8#include <QtWidgets/qdialog.h>
9
10#include <QtGui/qpixmap.h>
11
12#include <optional>
13
14QT_BEGIN_NAMESPACE
15
16class QLabel;
17class QHBoxLayout;
18class QToolButton;
19
20class QDesignerFormEditorInterface;
21
22namespace qdesigner_internal {
23
24class DesignerPixmapCache;
25class IconThemeEditor;
26class IconThemeEnumEditor;
27class PropertySheetIconValue;
28
30{
32public:
34private:
35 explicit IconThemeDialog(QWidget *parent);
36 IconThemeEditor *m_editor;
37};
38
40{
42public:
43 static std::optional<int> getTheme(QWidget *parent, int theme);
44
45private:
46 IconThemeEnumDialog(QWidget *parent);
47 IconThemeEnumEditor *m_editor;
48};
49
50class PixmapEditor : public QWidget
51{
53public:
55
56 void setSpacing(int spacing);
57 void setPixmapCache(DesignerPixmapCache *cache);
58 void setIconThemeModeEnabled(bool enabled);
59
60 static QString msgThemeIcon(const QString &t);
61 static QString msgMissingThemeIcon(const QString &t);
62 static QString displayText(const PropertySheetIconValue &icon);
63
64public slots:
65 void setPath(const QString &path);
66 void setTheme(const QString &theme);
67 void setThemeEnum(int e);
68 void setDefaultPixmap(const QPixmap &pixmap);
69 void setDefaultPixmapIcon(const QIcon &icon);
70
72 void pathChanged(const QString &path);
73 void themeEnumChanged(int themeEnum);
74 void themeChanged(const QString &theme);
75
76protected:
77 void contextMenuEvent(QContextMenuEvent *event) override;
78
79private slots:
81 void resourceActionActivated();
82 void fileActionActivated();
83 void themeEnumActionActivated();
84 void themeActionActivated();
85#if QT_CONFIG(clipboard)
89#endif
90private:
91 enum class State {
92 Empty,
93 ThemeEnum,
94 MissingThemeEnum,
95 XdgTheme,
96 MissingXdgTheme,
97 Path,
98 PathFallback // Non-existent theme icon, falling back to path
99 };
100
101 static State stateFromData(int themeEnum, const QString &xdgTheme, const QString &path);
102 State state() const;
103 static QString displayText(int themeEnum, const QString &xdgTheme, const QString &path);
104
105 void updateLabels();
106 bool m_iconThemeModeEnabled;
107 QDesignerFormEditorInterface *m_core;
108 QLabel *m_pixmapLabel;
109 QLabel *m_pathLabel;
110 QToolButton *m_button;
111 QAction *m_resourceAction;
112 QAction *m_fileAction;
113 QAction *m_themeEnumAction;
114 QAction *m_themeAction;
115 QAction *m_copyAction;
116 QAction *m_pasteAction;
117 QHBoxLayout *m_layout;
118 QPixmap m_defaultPixmap;
119 QString m_path;
120 QString m_theme;
121 int m_themeEnum = -1;
122 DesignerPixmapCache *m_pixmapCache;
123};
124
125} // namespace qdesigner_internal
126
127QT_END_NAMESPACE
128
129#endif // PIXMAPEDITOR_H
The QDesignerFormEditorInterface class allows you to access Qt Widgets Designer's various components.
friend class QWidget
Definition qpainter.h:432
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