VirtualBox

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

Last change on this file was 104358, checked in by vboxsync, 5 weeks ago

FE/Qt. bugref:10622. More refactoring around the retranslation functionality.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/* $Id: QIDialogButtonBox.h 104358 2024-04-18 05:33:40Z 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 "UILibraryDefs.h"
40
41/* Forward declarations: */
42class QBoxLayout;
43class QPushButton;
44class UIHelpButton;
45
46/** QDialogButtonBox subclass extending standard functionality. */
47class SHARED_LIBRARY_STUFF QIDialogButtonBox : public QDialogButtonBox
48{
49 Q_OBJECT;
50
51public:
52
53 /** Constructs dialog-button-box passing @a pParent to the base-class. */
54 QIDialogButtonBox(QWidget *pParent = 0);
55 /** Constructs dialog-button-box passing @a pParent to the base-class.
56 * @param enmOrientation Brings the button-box orientation. */
57 QIDialogButtonBox(Qt::Orientation enmOrientation, QWidget *pParent = 0);
58 /** Constructs dialog-button-box passing @a pParent to the base-class.
59 * @param enmButtonTypes Brings the set of button types.
60 * @param enmOrientation Brings the button-box orientation. */
61 QIDialogButtonBox(StandardButtons enmButtonTypes, Qt::Orientation enmOrientation = Qt::Horizontal, QWidget *pParent = 0);
62
63 /** Returns the button of requested @a enmButtonType. */
64 QPushButton *button(StandardButton enmButtonType) const;
65
66 /** Adds button with passed @a strText for specified @a enmRole. */
67 QPushButton *addButton(const QString &strText, ButtonRole enmRole);
68 /** Adds standard button of passed @a enmButtonType. */
69 QPushButton *addButton(StandardButton enmButtonType);
70
71 /** Defines a set of standard @a enmButtonTypes. */
72 void setStandardButtons(StandardButtons enmButtonTypes);
73
74 /** Adds extra @a pWidget. */
75 void addExtraWidget(QWidget *pWidget);
76 /** Adds extra @a pLayout. */
77 void addExtraLayout(QLayout *pLayout);
78
79 /** Defines whether button-box should avoid picking default button. */
80 void setDoNotPickDefaultButton(bool fDoNotPickDefaultButton);
81
82public slots:
83
84 /** Handles help request. */
85 void sltHandleHelpRequest();
86
87protected:
88
89 /** Handles show @a pEvent. */
90 virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
91
92 /** Returns button layout. */
93 QBoxLayout *boxLayout() const;
94
95 /** Searchs for empty @a pLayout space. */
96 int findEmptySpace(QBoxLayout *pLayout) const;
97
98private slots:
99
100 /** Handles translation event. */
101 void sltRetranslateUI();
102
103private:
104
105 /** Holds the Help button reference. */
106 QPointer<UIHelpButton> m_pHelpButton;
107
108 /** Holds whether button-box should avoid picking default button. */
109 bool m_fDoNotPickDefaultButton;
110};
111
112#endif /* !FEQT_INCLUDED_SRC_extensions_QIDialogButtonBox_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use