1 | /* $Id: QIDialog.h 76581 2019-01-01 06:24:57Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QIDialog class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef FEQT_INCLUDED_SRC_extensions_QIDialog_h
|
---|
19 | #define FEQT_INCLUDED_SRC_extensions_QIDialog_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QDialog>
|
---|
26 | #include <QPointer>
|
---|
27 |
|
---|
28 | /* GUI includes: */
|
---|
29 | #include "UILibraryDefs.h"
|
---|
30 |
|
---|
31 | /* Forward declarations: */
|
---|
32 | class QEventLoop;
|
---|
33 |
|
---|
34 | /** QDialog extension providing the GUI with
|
---|
35 | * the advanced capabilities like delayed show. */
|
---|
36 | class SHARED_LIBRARY_STUFF QIDialog : public QDialog
|
---|
37 | {
|
---|
38 | Q_OBJECT;
|
---|
39 |
|
---|
40 | public:
|
---|
41 |
|
---|
42 | /** Constructs the dialog passing @a pParent and @a enmFlags to the base-class. */
|
---|
43 | QIDialog(QWidget *pParent = 0, Qt::WindowFlags enmFlags = 0);
|
---|
44 |
|
---|
45 | /** Defines whether the dialog is @a fVisible. */
|
---|
46 | void setVisible(bool fVisible);
|
---|
47 |
|
---|
48 | public slots:
|
---|
49 |
|
---|
50 | /** Shows the dialog as a modal one, blocking until the user closes it.
|
---|
51 | * @param fShow Brings whether the dialog should be shown instantly.
|
---|
52 | * @param fApplicationModal Brings whether the dialog should be application-modal. */
|
---|
53 | virtual int execute(bool fShow = true, bool fApplicationModal = false);
|
---|
54 |
|
---|
55 | /** Shows the dialog as a modal one, blocking until the user closes it. */
|
---|
56 | virtual int exec() /* override */ { return execute(); }
|
---|
57 |
|
---|
58 | protected:
|
---|
59 |
|
---|
60 | /** Handles show @a pEvent. */
|
---|
61 | virtual void showEvent(QShowEvent *pEvent) /* override */;
|
---|
62 | /** Handles show @a pEvent sent for the first time. */
|
---|
63 | virtual void polishEvent(QShowEvent *pEvent);
|
---|
64 |
|
---|
65 | private:
|
---|
66 |
|
---|
67 | /** Holds whether the dialog is polished. */
|
---|
68 | bool m_fPolished;
|
---|
69 |
|
---|
70 | /** Holds the separate event-loop instance.
|
---|
71 | * @note This event-loop is only used when the dialog being executed via the execute()
|
---|
72 | * functionality, allowing for the delayed show and advanced modality flag. */
|
---|
73 | QPointer<QEventLoop> m_pEventLoop;
|
---|
74 | };
|
---|
75 |
|
---|
76 | /** Safe pointer to the QIDialog class. */
|
---|
77 | typedef QPointer<QIDialog> UISafePointerDialog;
|
---|
78 |
|
---|
79 | #endif /* !FEQT_INCLUDED_SRC_extensions_QIDialog_h */
|
---|