1 | /* $Id: UIFormEditorWidget.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIFormEditorWidget class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2019-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_widgets_UIFormEditorWidget_h
|
---|
29 | #define FEQT_INCLUDED_SRC_widgets_UIFormEditorWidget_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QPointer>
|
---|
36 | #include <QWidget>
|
---|
37 |
|
---|
38 | /* COM includes: */
|
---|
39 | #include "COMEnums.h"
|
---|
40 | #include "CFormValue.h"
|
---|
41 |
|
---|
42 | /* Forward declarations: */
|
---|
43 | class QHeaderView;
|
---|
44 | class QItemEditorFactory;
|
---|
45 | class UIFormEditorModel;
|
---|
46 | class UIFormEditorView;
|
---|
47 | class UINotificationCenter;
|
---|
48 | class CForm;
|
---|
49 | class CVirtualSystemDescriptionForm;
|
---|
50 |
|
---|
51 | /** QWidget subclass representing model/view Form Editor widget. */
|
---|
52 | class UIFormEditorWidget : public QWidget
|
---|
53 | {
|
---|
54 | Q_OBJECT;
|
---|
55 |
|
---|
56 | public:
|
---|
57 |
|
---|
58 | /** Constructs Form Editor widget passing @a pParent to the base-class.
|
---|
59 | * @param pNotificationCenter Brings the notification-center this widget should report to. */
|
---|
60 | UIFormEditorWidget(QWidget *pParent = 0, UINotificationCenter *pNotificationCenter = 0);
|
---|
61 | /** Destructs Form Editor widget. */
|
---|
62 | virtual ~UIFormEditorWidget() RT_OVERRIDE;
|
---|
63 |
|
---|
64 | /** Returns the notification-center reference. */
|
---|
65 | UINotificationCenter *notificationCenter() const { return m_pNotificationCenter; }
|
---|
66 | /** Defines the @a pNotificationCenter reference. */
|
---|
67 | void setNotificationCenter(UINotificationCenter *pNotificationCenter) { m_pNotificationCenter = pNotificationCenter; }
|
---|
68 |
|
---|
69 | /** Returns table-view reference. */
|
---|
70 | UIFormEditorView *view() const;
|
---|
71 | /** Returns horizontal header reference. */
|
---|
72 | QHeaderView *horizontalHeader() const;
|
---|
73 | /** Returns vertical header reference. */
|
---|
74 | QHeaderView *verticalHeader() const;
|
---|
75 | /** Defines table-view @a strWhatsThis help text. */
|
---|
76 | void setWhatsThis(const QString &strWhatsThis);
|
---|
77 |
|
---|
78 | /** Clears form. */
|
---|
79 | void clearForm();
|
---|
80 | /** Defines @a values to be edited. */
|
---|
81 | void setValues(const QVector<CFormValue> &values);
|
---|
82 | /** Defines @a comForm to be edited. */
|
---|
83 | void setForm(const CForm &comForm);
|
---|
84 | /** Defines virtual system description @a comForm to be edited. */
|
---|
85 | void setVirtualSystemDescriptionForm(const CVirtualSystemDescriptionForm &comForm);
|
---|
86 |
|
---|
87 | /** Makes sure current editor data committed. */
|
---|
88 | void makeSureEditorDataCommitted();
|
---|
89 |
|
---|
90 | protected:
|
---|
91 |
|
---|
92 | /** Preprocesses any Qt @a pEvent for passed @a pObject. */
|
---|
93 | virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
|
---|
94 |
|
---|
95 | private:
|
---|
96 |
|
---|
97 | /** Prepares all. */
|
---|
98 | void prepare();
|
---|
99 | /** Cleanups all. */
|
---|
100 | void cleanup();
|
---|
101 |
|
---|
102 | /** Adjusts table column sizes. */
|
---|
103 | void adjustTable();
|
---|
104 |
|
---|
105 | /** Holds the notification-center reference. */
|
---|
106 | UINotificationCenter *m_pNotificationCenter;
|
---|
107 |
|
---|
108 | /** Holds the table-view instance. */
|
---|
109 | UIFormEditorView *m_pTableView;
|
---|
110 | /** Holds the table-model instance. */
|
---|
111 | UIFormEditorModel *m_pTableModel;
|
---|
112 |
|
---|
113 | /** Holds the item editor factory instance. */
|
---|
114 | QItemEditorFactory *m_pItemEditorFactory;
|
---|
115 | };
|
---|
116 |
|
---|
117 | /** Safe pointer to Form Editor widget. */
|
---|
118 | typedef QPointer<UIFormEditorWidget> UIFormEditorWidgetPointer;
|
---|
119 |
|
---|
120 | #endif /* !FEQT_INCLUDED_SRC_widgets_UIFormEditorWidget_h */
|
---|