1 | /* $Id: UIFormEditorWidget.h 92165 2021-11-01 13:08:24Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIFormEditorWidget class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2019-2020 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_widgets_UIFormEditorWidget_h
|
---|
19 | #define FEQT_INCLUDED_SRC_widgets_UIFormEditorWidget_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QPointer>
|
---|
26 | #include <QWidget>
|
---|
27 |
|
---|
28 | /* COM includes: */
|
---|
29 | #include "COMEnums.h"
|
---|
30 | #include "CFormValue.h"
|
---|
31 |
|
---|
32 | /* Forward declarations: */
|
---|
33 | class QHeaderView;
|
---|
34 | class UIFormEditorModel;
|
---|
35 | class UIFormEditorView;
|
---|
36 | class UINotificationCenter;
|
---|
37 | class CForm;
|
---|
38 | class CVirtualSystemDescriptionForm;
|
---|
39 |
|
---|
40 | /** QWidget subclass representing model/view Form Editor widget. */
|
---|
41 | class UIFormEditorWidget : public QWidget
|
---|
42 | {
|
---|
43 | Q_OBJECT;
|
---|
44 |
|
---|
45 | public:
|
---|
46 |
|
---|
47 | /** Constructs Form Editor widget passing @a pParent to the base-class.
|
---|
48 | * @param pNotificationCenter Brings the notification-center this widget should report to. */
|
---|
49 | UIFormEditorWidget(QWidget *pParent = 0, UINotificationCenter *pNotificationCenter = 0);
|
---|
50 |
|
---|
51 | /** Returns the notification-center reference. */
|
---|
52 | UINotificationCenter *notificationCenter() const { return m_pNotificationCenter; }
|
---|
53 | /** Defines the @a pNotificationCenter reference. */
|
---|
54 | void setNotificationCenter(UINotificationCenter *pNotificationCenter) { m_pNotificationCenter = pNotificationCenter; }
|
---|
55 |
|
---|
56 | /** Returns horizontal header reference. */
|
---|
57 | QHeaderView *horizontalHeader() const;
|
---|
58 | /** Returns vertical header reference. */
|
---|
59 | QHeaderView *verticalHeader() const;
|
---|
60 |
|
---|
61 | /** Clears form. */
|
---|
62 | void clearForm();
|
---|
63 | /** Defines @a values to be edited. */
|
---|
64 | void setValues(const QVector<CFormValue> &values);
|
---|
65 | /** Defines @a comForm to be edited. */
|
---|
66 | void setForm(const CForm &comForm);
|
---|
67 | /** Defines virtual system description @a comForm to be edited. */
|
---|
68 | void setVirtualSystemDescriptionForm(const CVirtualSystemDescriptionForm &comForm);
|
---|
69 |
|
---|
70 | /** Makes sure current editor data committed. */
|
---|
71 | void makeSureEditorDataCommitted();
|
---|
72 |
|
---|
73 | protected:
|
---|
74 |
|
---|
75 | /** Preprocesses any Qt @a pEvent for passed @a pObject. */
|
---|
76 | virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
|
---|
77 |
|
---|
78 | private:
|
---|
79 |
|
---|
80 | /** Prepares all. */
|
---|
81 | void prepare();
|
---|
82 |
|
---|
83 | /** Adjusts table column sizes. */
|
---|
84 | void adjustTable();
|
---|
85 |
|
---|
86 | /** Holds the notification-center reference. */
|
---|
87 | UINotificationCenter *m_pNotificationCenter;
|
---|
88 |
|
---|
89 | /** Holds the table-view instance. */
|
---|
90 | UIFormEditorView *m_pTableView;
|
---|
91 | /** Holds the table-model instance. */
|
---|
92 | UIFormEditorModel *m_pTableModel;
|
---|
93 | };
|
---|
94 |
|
---|
95 | /** Safe pointer to Form Editor widget. */
|
---|
96 | typedef QPointer<UIFormEditorWidget> UIFormEditorWidgetPointer;
|
---|
97 |
|
---|
98 | #endif /* !FEQT_INCLUDED_SRC_widgets_UIFormEditorWidget_h */
|
---|