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
qwindowsdialoghelpers.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 QWINDOWSDIALOGHELPER_H
5#define QWINDOWSDIALOGHELPER_H
6
7#include <QtCore/qt_windows.h>
8#include <qpa/qplatformdialoghelper.h>
9#include <qpa/qplatformtheme.h>
10#include <QtCore/qstringlist.h>
11#include <QtCore/qsharedpointer.h>
12
14
15class QFileDialog;
16class QDialog;
17class QThread;
19
20namespace QWindowsDialogs
21{
22 void eatMouseMove();
23
26} // namespace QWindowsDialogs
27
28template <class BaseClass>
29class QWindowsDialogHelperBase : public BaseClass
30{
31 Q_DISABLE_COPY_MOVE(QWindowsDialogHelperBase)
32public:
33 using QWindowsNativeDialogBasePtr = QSharedPointer<QWindowsNativeDialogBase>;
35
36 void exec() override;
37 bool show(Qt::WindowFlags windowFlags,
38 Qt::WindowModality windowModality,
39 QWindow *parent) override;
40 void hide() override;
41
42 virtual bool supportsNonModalDialog(const QWindow * /* parent */ = nullptr) const { return true; }
43
44protected:
47 inline bool hasNativeDialog() const { return !m_nativeDialog.isNull(); }
48 void timerEvent(QTimerEvent *) override;
49
50private:
52 inline QWindowsNativeDialogBase *ensureNativeDialog();
53 inline void startDialogThread();
54 inline void stopTimer();
55 void cleanupThread();
56
57 QWindowsNativeDialogBasePtr m_nativeDialog;
58 HWND m_ownerWindow = nullptr;
59 int m_timerId = 0;
60 QThread *m_thread = nullptr;
61};
62
64
65#endif // QWINDOWSDIALOGHELPER_H
The QDialog class is the base class of dialog windows.
Definition qdialog.h:19
The QFileDialog class provides a dialog that allows users to select files or directories.
Definition qfiledialog.h:28
The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
\inmodule QtCore
Definition qcoreevent.h:366
\inmodule QtGui
Definition qwindow.h:63
Helper for native Windows dialogs.
virtual bool supportsNonModalDialog(const QWindow *=nullptr) const
void timerEvent(QTimerEvent *) override
virtual QWindowsNativeDialogBase * createNativeDialog()=0
QWindowsDialogHelperBase()=default
QWindowsNativeDialogBase * nativeDialog() const
Base class for Windows native dialogs.
Combined button and popup list for selecting options.
bool useHelper(QPlatformTheme::DialogType type)
QPlatformDialogHelper * createHelper(QPlatformTheme::DialogType type)
void eatMouseMove()
After closing a windows dialog with a double click (i.e.
WindowModality
GLenum type
view show()
[18] //! [19]