[26714] | 1 | /* $Id: QIStyledItemDelegate.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
[25177] | 2 | /** @file
|
---|
[71874] | 3 | * VBox Qt GUI - Qt extensions: QIStyledItemDelegate class declaration.
|
---|
[25177] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[106061] | 7 | * Copyright (C) 2006-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 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_extensions_QIStyledItemDelegate_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_extensions_QIStyledItemDelegate_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[64161] | 33 |
|
---|
[44662] | 34 | /* Qt includes: */
|
---|
[71874] | 35 | #include <QStyledItemDelegate>
|
---|
[52730] | 36 |
|
---|
[71874] | 37 | /* GUI includes: */
|
---|
| 38 | #include "UILibraryDefs.h"
|
---|
[64161] | 39 |
|
---|
| 40 | /** QStyledItemDelegate subclass extending standard functionality. */
|
---|
[71874] | 41 | class SHARED_LIBRARY_STUFF QIStyledItemDelegate : public QStyledItemDelegate
|
---|
[51649] | 42 | {
|
---|
| 43 | Q_OBJECT;
|
---|
| 44 |
|
---|
[55134] | 45 | signals:
|
---|
| 46 |
|
---|
[64163] | 47 | /** Notifies listeners about @a pEditor created for particular model @a index. */
|
---|
| 48 | void sigEditorCreated(QWidget *pEditor, const QModelIndex &index) const;
|
---|
| 49 |
|
---|
[64161] | 50 | /** Notifies listeners about editor's Enter key triggering. */
|
---|
[55134] | 51 | void sigEditorEnterKeyTriggered();
|
---|
| 52 |
|
---|
[51649] | 53 | public:
|
---|
| 54 |
|
---|
[64161] | 55 | /** Constructs delegate passing @a pParent to the base-class. */
|
---|
[71874] | 56 | QIStyledItemDelegate(QObject *pParent);
|
---|
[51649] | 57 |
|
---|
[64162] | 58 | /** Defines whether delegate should watch for the editor's data commits. */
|
---|
[71874] | 59 | void setWatchForEditorDataCommits(bool fWatch);
|
---|
[64161] | 60 | /** Defines whether delegate should watch for the editor's Enter key triggering. */
|
---|
[71874] | 61 | void setWatchForEditorEnterKeyTriggering(bool fWatch);
|
---|
[55134] | 62 |
|
---|
[64162] | 63 | protected:
|
---|
[51649] | 64 |
|
---|
[64161] | 65 | /** Returns the widget used to edit the item specified by @a index.
|
---|
| 66 | * The @a pParent widget and style @a option are used to control how the editor widget appears. */
|
---|
[71874] | 67 | virtual QWidget *createEditor(QWidget *pParent,
|
---|
| 68 | const QStyleOptionViewItem &option,
|
---|
[93990] | 69 | const QModelIndex &index) const RT_OVERRIDE;
|
---|
[64161] | 70 |
|
---|
[64162] | 71 | private:
|
---|
| 72 |
|
---|
| 73 | /** Holds whether delegate should watch for the editor's data commits. */
|
---|
| 74 | bool m_fWatchForEditorDataCommits : 1;
|
---|
[64161] | 75 | /** Holds whether delegate should watch for the editor's Enter key triggering. */
|
---|
[64162] | 76 | bool m_fWatchForEditorEnterKeyTriggering : 1;
|
---|
[51649] | 77 | };
|
---|
[64161] | 78 |
|
---|
[76581] | 79 | #endif /* !FEQT_INCLUDED_SRC_extensions_QIStyledItemDelegate_h */
|
---|