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
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// Qt-Security score:significant reason:default
4
5#ifndef QGTK3DIALOGHELPERS_H
6#define QGTK3DIALOGHELPERS_H
7
8#include <QtCore/qhash.h>
9#include <QtCore/qlist.h>
10#include <QtCore/qurl.h>
11#include <QtCore/qscopedpointer.h>
12#include <QtCore/qstring.h>
13#include <qpa/qplatformdialoghelper.h>
14
15typedef struct _GtkWidget GtkWidget;
16typedef struct _GtkDialog GtkDialog;
17typedef struct _GtkFileFilter GtkFileFilter;
18
19QT_BEGIN_NAMESPACE
20
21class QGtk3Dialog;
22class QColor;
23
25{
27
28public:
31
32 bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
33 void exec() override;
34 void hide() override;
35
36 void setCurrentColor(const QColor &color) override;
37 QColor currentColor() const override;
38
39private:
40 static void onColorChanged(QGtk3ColorDialogHelper *helper);
41 void applyOptions();
42
43 QScopedPointer<QGtk3Dialog> d;
44};
45
47{
49
50public:
53
54 bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
55 void exec() override;
56 void hide() override;
57
59 void setDirectory(const QUrl &directory) override;
60 QUrl directory() const override;
61 void selectFile(const QUrl &filename) override;
62 QList<QUrl> selectedFiles() const override;
63 void setFilter() override;
64 void selectNameFilter(const QString &filter) override;
65 QString selectedNameFilter() const override;
66
67private:
68 static void onSelectionChanged(GtkDialog *dialog, QGtk3FileDialogHelper *helper);
69 static void onCurrentFolderChanged(QGtk3FileDialogHelper *helper);
70 static void onFilterChanged(QGtk3FileDialogHelper *helper);
71 static void onUpdatePreview(GtkDialog *dialog, QGtk3FileDialogHelper *helper);
72 void applyOptions();
73 void setNameFilters(const QStringList &filters);
74 void selectFileInternal(const QUrl &filename);
75 void setFileChooserAction();
76
77 QUrl _dir;
78 QList<QUrl> _selection;
79 QHash<QString, GtkFileFilter*> _filters;
80 QHash<GtkFileFilter*, QString> _filterNames;
81 QScopedPointer<QGtk3Dialog> d;
82 GtkWidget *previewWidget;
83};
84
86{
88
89public:
92
93 bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
94 void exec() override;
95 void hide() override;
96
97 void setCurrentFont(const QFont &font) override;
98 QFont currentFont() const override;
99
100private:
101 static void onFontChanged(QGtk3FontDialogHelper *helper);
102 void applyOptions();
103
104 QScopedPointer<QGtk3Dialog> d;
105};
106
107QT_END_NAMESPACE
108
109#endif // QGTK3DIALOGHELPERS_H
\inmodule QtCore
Definition qeventloop.h:16
\reentrant
Definition qfont.h:22
void setCurrentColor(const QColor &color) override
QColor currentColor() const override
bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override
static void onResponse(QPlatformDialogHelper *helper, int response)
QGtk3Dialog(GtkWidget *gtkWidget, QPlatformDialogHelper *helper)
GtkDialog * gtkDialog() const
bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
void setDirectory(const QUrl &directory) override
bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) 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
bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override
QFont currentFont() const override
static GtkFileChooserAction gtkFileChooserAction(const QSharedPointer< QFileDialogOptions > &options)
#define PREVIEW_HEIGHT
#define PREVIEW_WIDTH
static QFont qt_fontFromString(const QString &name)
static QString qt_fontToString(const QFont &font)
struct _GtkDialog GtkDialog
struct _GtkFileFilter GtkFileFilter