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