VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.h

Last change on this file was 103977, checked in by vboxsync, 2 months ago

Apply RT_OVERRIDE/NS_OVERRIDE where required to shut up clang.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/* $Id: QIDialog.h 103977 2024-03-21 02:04:52Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - Qt extensions: QIDialog class declaration.
4 */
5
6/*
7 * Copyright (C) 2008-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef FEQT_INCLUDED_SRC_extensions_QIDialog_h
29#define FEQT_INCLUDED_SRC_extensions_QIDialog_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QDialog>
36#include <QPointer>
37
38/* GUI includes: */
39#include "UILibraryDefs.h"
40
41/* Forward declarations: */
42class QEventLoop;
43
44/** QDialog extension providing the GUI with
45 * the advanced capabilities like delayed show. */
46class SHARED_LIBRARY_STUFF QIDialog : public QDialog
47{
48 Q_OBJECT;
49
50public:
51
52 /** Constructs the dialog passing @a pParent and @a enmFlags to the base-class. */
53 QIDialog(QWidget *pParent = 0, Qt::WindowFlags enmFlags = Qt::WindowFlags());
54
55 /** Defines whether the dialog is @a fVisible. */
56 void setVisible(bool fVisible) RT_OVERRIDE;
57
58public slots:
59
60 /** Shows the dialog as a modal one, blocking until the user closes it.
61 * @param fShow Brings whether the dialog should be shown instantly.
62 * @param fApplicationModal Brings whether the dialog should be application-modal. */
63 virtual int execute(bool fShow = true, bool fApplicationModal = false);
64
65 /** Shows the dialog as a modal one, blocking until the user closes it. */
66 virtual int exec() RT_OVERRIDE { return execute(); }
67
68 /** Closes the dialog and sets its result code to iResult. */
69 virtual void done(int iResult) RT_OVERRIDE;
70
71protected:
72
73 /** Handles show @a pEvent. */
74 virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
75 /** Handles show @a pEvent sent for the first time. */
76 virtual void polishEvent(QShowEvent *pEvent);
77
78private:
79
80 /** Holds whether the dialog is polished. */
81 bool m_fPolished;
82
83 /** Holds the separate event-loop instance.
84 * @note This event-loop is only used when the dialog being executed via the execute()
85 * functionality, allowing for the delayed show and advanced modality flag. */
86 QPointer<QEventLoop> m_pEventLoop;
87};
88
89/** Safe pointer to the QIDialog class. */
90typedef QPointer<QIDialog> UISafePointerDialog;
91
92#endif /* !FEQT_INCLUDED_SRC_extensions_QIDialog_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use