1 | /* $Id: QITableView.h 64168 2016-10-06 14:55:18Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QITableView class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2016 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 ___QITableView_h___
|
---|
19 | #define ___QITableView_h___
|
---|
20 |
|
---|
21 | /* Qt includes: */
|
---|
22 | #include <QTableView>
|
---|
23 |
|
---|
24 |
|
---|
25 | /** QTableView subclass extending standard functionality. */
|
---|
26 | class QITableView : public QTableView
|
---|
27 | {
|
---|
28 | Q_OBJECT;
|
---|
29 |
|
---|
30 | signals:
|
---|
31 |
|
---|
32 | /** Notifies listeners about index changed from @a previous to @a current. */
|
---|
33 | void sigCurrentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
---|
34 |
|
---|
35 | public:
|
---|
36 |
|
---|
37 | /** Constructs table-view passing @a pParent to the base-class. */
|
---|
38 | QITableView(QWidget *pParent = 0);
|
---|
39 |
|
---|
40 | /** Makes sure current editor data committed. */
|
---|
41 | void makeSureEditorDataCommitted();
|
---|
42 |
|
---|
43 | protected slots:
|
---|
44 |
|
---|
45 | /** Stores the created @a pEditor for passed @a index in the map. */
|
---|
46 | virtual void sltEditorCreated(QWidget *pEditor, const QModelIndex &index);
|
---|
47 | /** Clears the destoyed @a pEditor from the map. */
|
---|
48 | virtual void sltEditorDestroyed(QObject *pEditor);
|
---|
49 |
|
---|
50 | protected:
|
---|
51 |
|
---|
52 | /** Prepares all. */
|
---|
53 | virtual void prepare();
|
---|
54 |
|
---|
55 | /** Handles index change from @a previous to @a current. */
|
---|
56 | virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) /* override */;
|
---|
57 |
|
---|
58 | /** Holds the map of editors stored for passed indexes. */
|
---|
59 | QMap<QModelIndex, QObject*> m_editors;
|
---|
60 | };
|
---|
61 |
|
---|
62 | #endif /* !___QITableView_h___ */
|
---|
63 |
|
---|