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