1 | /* $Id: QITableWidget.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QITableWidget class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008-2024 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_QITableWidget_h
|
---|
29 | #define FEQT_INCLUDED_SRC_extensions_QITableWidget_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QTableWidget>
|
---|
36 | #include <QTableWidgetItem>
|
---|
37 |
|
---|
38 | /* GUI includes: */
|
---|
39 | #include "UILibraryDefs.h"
|
---|
40 |
|
---|
41 | /* Forward declarations: */
|
---|
42 | class QITableWidget;
|
---|
43 |
|
---|
44 | /** QTableWidgetItem subclass extending standard functionality. */
|
---|
45 | class SHARED_LIBRARY_STUFF QITableWidgetItem : public QObject, public QTableWidgetItem
|
---|
46 | {
|
---|
47 | Q_OBJECT;
|
---|
48 |
|
---|
49 | public:
|
---|
50 |
|
---|
51 | /** Item type for QITableWidgetItem. */
|
---|
52 | enum { ItemType = QTableWidgetItem::UserType + 1 };
|
---|
53 |
|
---|
54 | /** Casts QTableWidgetItem* to QITableWidgetItem* if possible. */
|
---|
55 | static QITableWidgetItem *toItem(QTableWidgetItem *pItem);
|
---|
56 | /** Casts const QTableWidgetItem* to const QITableWidgetItem* if possible. */
|
---|
57 | static const QITableWidgetItem *toItem(const QTableWidgetItem *pItem);
|
---|
58 |
|
---|
59 | /** Constructs item passing @a strText into the base-class. */
|
---|
60 | QITableWidgetItem(const QString &strText = QString());
|
---|
61 |
|
---|
62 | /** Returns the parent table-widget. */
|
---|
63 | QITableWidget *parentTable() const;
|
---|
64 | };
|
---|
65 |
|
---|
66 | /** QTableWidget subclass extending standard functionality. */
|
---|
67 | class SHARED_LIBRARY_STUFF QITableWidget : public QTableWidget
|
---|
68 | {
|
---|
69 | Q_OBJECT;
|
---|
70 |
|
---|
71 | signals:
|
---|
72 |
|
---|
73 | /** Notifies about particular tree-widget @a pItem is painted with @a pPainter. */
|
---|
74 | void painted(QTableWidgetItem *pItem, QPainter *pPainter);
|
---|
75 | /** Notifies about tree-widget being resized from @a oldSize to @a size. */
|
---|
76 | void resized(const QSize &size, const QSize &oldSize);
|
---|
77 |
|
---|
78 | public:
|
---|
79 |
|
---|
80 | /** Constructs tree-widget passing @a pParent to the base-class. */
|
---|
81 | QITableWidget(QWidget *pParent = 0);
|
---|
82 |
|
---|
83 | /** Returns the child item with @a iRow and @a iColumn. */
|
---|
84 | QITableWidgetItem *childItem(int iRow, int iColumn) const;
|
---|
85 | /** Returns a model-index of @a pItem specified. */
|
---|
86 | QModelIndex itemIndex(QTableWidgetItem *pItem);
|
---|
87 |
|
---|
88 | protected:
|
---|
89 |
|
---|
90 | /** Handles paint @a pEvent. */
|
---|
91 | void paintEvent(QPaintEvent *pEvent) RT_OVERRIDE RT_FINAL;
|
---|
92 | /** Handles resize @a pEvent. */
|
---|
93 | void resizeEvent(QResizeEvent *pEvent) RT_OVERRIDE RT_FINAL;
|
---|
94 | };
|
---|
95 |
|
---|
96 | #endif /* !FEQT_INCLUDED_SRC_extensions_QITableWidget_h */
|
---|