Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgtk3dialoghelpers.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QGTK3DIALOGHELPERS_H
5#define QGTK3DIALOGHELPERS_H
6
7#include <QtCore/qhash.h>
8#include <QtCore/qlist.h>
9#include <QtCore/qurl.h>
10#include <QtCore/qscopedpointer.h>
11#include <QtCore/qstring.h>
12#include <qpa/qplatformdialoghelper.h>
13
14typedef struct _GtkWidget GtkWidget;
15typedef struct _GtkDialog GtkDialog;
16typedef struct _GtkFileFilter GtkFileFilter;
17
19
20class QGtk3Dialog;
21class QColor;
22
24{
26
27public:
30
31 bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
32 void exec() override;
33 void hide() override;
34
35 void setCurrentColor(const QColor &color) override;
36 QColor currentColor() const override;
37
38private:
39 static void onColorChanged(QGtk3ColorDialogHelper *helper);
40 void applyOptions();
41
42 QScopedPointer<QGtk3Dialog> d;
43};
44
46{
48
49public:
52
53 bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
54 void exec() override;
55 void hide() override;
56
57 bool defaultNameFilterDisables() const override;
58 void setDirectory(const QUrl &directory) override;
59 QUrl directory() const override;
60 void selectFile(const QUrl &filename) override;
61 QList<QUrl> selectedFiles() const override;
62 void setFilter() override;
63 void selectNameFilter(const QString &filter) override;
64 QString selectedNameFilter() const override;
65
66private:
67 static void onSelectionChanged(GtkDialog *dialog, QGtk3FileDialogHelper *helper);
68 static void onCurrentFolderChanged(QGtk3FileDialogHelper *helper);
69 static void onFilterChanged(QGtk3FileDialogHelper *helper);
70 static void onUpdatePreview(GtkDialog *dialog, QGtk3FileDialogHelper *helper);
71 void applyOptions();
72 void setNameFilters(const QStringList &filters);
73 void selectFileInternal(const QUrl &filename);
74 void setFileChooserAction();
75
76 QUrl _dir;
77 QList<QUrl> _selection;
78 QHash<QString, GtkFileFilter*> _filters;
79 QHash<GtkFileFilter*, QString> _filterNames;
80 QScopedPointer<QGtk3Dialog> d;
81 GtkWidget *previewWidget;
82};
83
85{
87
88public:
91
92 bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
93 void exec() override;
94 void hide() override;
95
96 void setCurrentFont(const QFont &font) override;
97 QFont currentFont() const override;
98
99private:
100 static void onFontChanged(QGtk3FontDialogHelper *helper);
101 void applyOptions();
102
103 QScopedPointer<QGtk3Dialog> d;
104};
105
107
108#endif // QGTK3DIALOGHELPERS_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\reentrant
Definition qfont.h:22
void setCurrentColor(const QColor &color) override
QColor currentColor() const override
void setDirectory(const QUrl &directory) override
QString selectedNameFilter() const override
void selectNameFilter(const QString &filter) override
void selectFile(const QUrl &filename) override
QList< QUrl > selectedFiles() const override
QUrl directory() const override
bool defaultNameFilterDisables() const override
void setCurrentFont(const QFont &font) override
QFont currentFont() const override
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
The QPlatformColorDialogHelper class allows for platform-specific customization of color dialogs.
The QPlatformFileDialogHelper class allows for platform-specific customization of file dialogs.
The QPlatformFontDialogHelper class allows for platform-specific customization of font dialogs.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
WindowModality
struct _GtkDialog GtkDialog
struct _GtkFileFilter GtkFileFilter
struct _GtkWidget GtkWidget
GLuint color
[2]
GLbitfield flags
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
#define Q_OBJECT
view show()
[18] //! [19]
QFileDialog dialog(this)
[1]
const QStringList filters({"Image files (*.png *.xpm *.jpg)", "Text files (*.txt)", "Any files (*)" })
[6]