blob: c025d81381c212a1c33353369c34771df0315ad5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/* $Id$ */
/** @file
* VBox Qt GUI - UIFormEditorWidget class declaration.
*/
/*
* Copyright (C) 2019-2022 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef FEQT_INCLUDED_SRC_widgets_UIFormEditorWidget_h
#define FEQT_INCLUDED_SRC_widgets_UIFormEditorWidget_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif
/* Qt includes: */
#include <QPointer>
#include <QWidget>
/* COM includes: */
#include "COMEnums.h"
#include "CFormValue.h"
/* Forward declarations: */
class QHeaderView;
class QItemEditorFactory;
class UIFormEditorModel;
class UIFormEditorView;
class UINotificationCenter;
class CForm;
class CVirtualSystemDescriptionForm;
/** QWidget subclass representing model/view Form Editor widget. */
class UIFormEditorWidget : public QWidget
{
Q_OBJECT;
public:
/** Constructs Form Editor widget passing @a pParent to the base-class.
* @param pNotificationCenter Brings the notification-center this widget should report to. */
UIFormEditorWidget(QWidget *pParent = 0, UINotificationCenter *pNotificationCenter = 0);
/** Destructs Form Editor widget. */
virtual ~UIFormEditorWidget() RT_OVERRIDE;
/** Returns the notification-center reference. */
UINotificationCenter *notificationCenter() const { return m_pNotificationCenter; }
/** Defines the @a pNotificationCenter reference. */
void setNotificationCenter(UINotificationCenter *pNotificationCenter) { m_pNotificationCenter = pNotificationCenter; }
/** Returns table-view reference. */
UIFormEditorView *view() const;
/** Returns horizontal header reference. */
QHeaderView *horizontalHeader() const;
/** Returns vertical header reference. */
QHeaderView *verticalHeader() const;
/** Defines table-view @a strWhatsThis help text. */
void setWhatsThis(const QString &strWhatsThis);
/** Clears form. */
void clearForm();
/** Defines @a values to be edited. */
void setValues(const QVector<CFormValue> &values);
/** Defines @a comForm to be edited. */
void setForm(const CForm &comForm);
/** Defines virtual system description @a comForm to be edited. */
void setVirtualSystemDescriptionForm(const CVirtualSystemDescriptionForm &comForm);
/** Makes sure current editor data committed. */
void makeSureEditorDataCommitted();
protected:
/** Preprocesses any Qt @a pEvent for passed @a pObject. */
virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
private:
/** Prepares all. */
void prepare();
/** Cleanups all. */
void cleanup();
/** Adjusts table column sizes. */
void adjustTable();
/** Holds the notification-center reference. */
UINotificationCenter *m_pNotificationCenter;
/** Holds the table-view instance. */
UIFormEditorView *m_pTableView;
/** Holds the table-model instance. */
UIFormEditorModel *m_pTableModel;
/** Holds the item editor factory instance. */
QItemEditorFactory *m_pItemEditorFactory;
};
/** Safe pointer to Form Editor widget. */
typedef QPointer<UIFormEditorWidget> UIFormEditorWidgetPointer;
#endif /* !FEQT_INCLUDED_SRC_widgets_UIFormEditorWidget_h */
|