1 | /* $Id: QIDialogButtonBox.h 99946 2023-05-24 06:53:04Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QIDialogButtonBox 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_QIDialogButtonBox_h
|
---|
29 | #define FEQT_INCLUDED_SRC_extensions_QIDialogButtonBox_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QDialogButtonBox>
|
---|
36 | #include <QPointer>
|
---|
37 |
|
---|
38 | /* GUI includes: */
|
---|
39 | #include "QIWithRetranslateUI.h"
|
---|
40 | #include "UILibraryDefs.h"
|
---|
41 |
|
---|
42 | /* Forward declarations: */
|
---|
43 | class QBoxLayout;
|
---|
44 | class QPushButton;
|
---|
45 | class UIHelpButton;
|
---|
46 |
|
---|
47 | /** QDialogButtonBox subclass extending standard functionality. */
|
---|
48 | class SHARED_LIBRARY_STUFF QIDialogButtonBox : public QIWithRetranslateUI<QDialogButtonBox>
|
---|
49 | {
|
---|
50 | Q_OBJECT;
|
---|
51 |
|
---|
52 | public:
|
---|
53 |
|
---|
54 | /** Constructs dialog-button-box passing @a pParent to the base-class. */
|
---|
55 | QIDialogButtonBox(QWidget *pParent = 0);
|
---|
56 | /** Constructs dialog-button-box passing @a pParent to the base-class.
|
---|
57 | * @param enmOrientation Brings the button-box orientation. */
|
---|
58 | QIDialogButtonBox(Qt::Orientation enmOrientation, QWidget *pParent = 0);
|
---|
59 | /** Constructs dialog-button-box passing @a pParent to the base-class.
|
---|
60 | * @param enmButtonTypes Brings the set of button types.
|
---|
61 | * @param enmOrientation Brings the button-box orientation. */
|
---|
62 | QIDialogButtonBox(StandardButtons enmButtonTypes, Qt::Orientation enmOrientation = Qt::Horizontal, QWidget *pParent = 0);
|
---|
63 |
|
---|
64 | /** Returns the button of requested @a enmButtonType. */
|
---|
65 | QPushButton *button(StandardButton enmButtonType) const;
|
---|
66 |
|
---|
67 | /** Adds button with passed @a strText for specified @a enmRole. */
|
---|
68 | QPushButton *addButton(const QString &strText, ButtonRole enmRole);
|
---|
69 | /** Adds standard button of passed @a enmButtonType. */
|
---|
70 | QPushButton *addButton(StandardButton enmButtonType);
|
---|
71 |
|
---|
72 | /** Defines a set of standard @a enmButtonTypes. */
|
---|
73 | void setStandardButtons(StandardButtons enmButtonTypes);
|
---|
74 |
|
---|
75 | /** Adds extra @a pWidget. */
|
---|
76 | void addExtraWidget(QWidget *pWidget);
|
---|
77 | /** Adds extra @a pLayout. */
|
---|
78 | void addExtraLayout(QLayout *pLayout);
|
---|
79 |
|
---|
80 | /** Defines whether button-box should avoid picking default button. */
|
---|
81 | void setDoNotPickDefaultButton(bool fDoNotPickDefaultButton);
|
---|
82 |
|
---|
83 | public slots:
|
---|
84 |
|
---|
85 | /** Handles help request. */
|
---|
86 | void sltHandleHelpRequest();
|
---|
87 |
|
---|
88 | protected:
|
---|
89 |
|
---|
90 | /** Handles translation event. */
|
---|
91 | virtual void retranslateUi() RT_OVERRIDE;
|
---|
92 |
|
---|
93 | /** Handles show @a pEvent. */
|
---|
94 | virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
|
---|
95 |
|
---|
96 | /** Returns button layout. */
|
---|
97 | QBoxLayout *boxLayout() const;
|
---|
98 |
|
---|
99 | /** Searchs for empty @a pLayout space. */
|
---|
100 | int findEmptySpace(QBoxLayout *pLayout) const;
|
---|
101 |
|
---|
102 | private:
|
---|
103 |
|
---|
104 | /** Holds the Help button reference. */
|
---|
105 | QPointer<UIHelpButton> m_pHelpButton;
|
---|
106 |
|
---|
107 | /** Holds whether button-box should avoid picking default button. */
|
---|
108 | bool m_fDoNotPickDefaultButton;
|
---|
109 | };
|
---|
110 |
|
---|
111 | #endif /* !FEQT_INCLUDED_SRC_extensions_QIDialogButtonBox_h */
|
---|