3
* Table with context menu to add and remove rows.
9
* Copyright (C) 2009 Urs Fleisch
11
* This file is part of Kid3.
13
* Kid3 is free software; you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation; either version 2 of the License, or
16
* (at your option) any later version.
18
* Kid3 is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* You should have received a copy of the GNU General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>.
31
#include "qtcompatmac.h"
32
/** The base class depends on the Qt version and is a table widget. */
33
#if QT_VERSION >= 0x040000
34
#include <QTableWidget>
35
typedef QTableWidget ConfigTableBaseClass;
38
typedef QTable ConfigTableBaseClass;
43
* Table with context menu to add and remove rows.
45
class ConfigTable : public ConfigTableBaseClass {
52
* @param labels column labels
53
* @param parent parent widget
55
ConfigTable(const QStringList& labels, QWidget* parent = 0);
60
virtual ~ConfigTable();
63
* Set the values from a map.
65
* @param map map with keys and values
67
void fromMap(const QMap<QString, QString>& map);
70
* Store the values in a map.
72
* @param map to be filled
74
void toMap(QMap<QString, QString>& map) const;
78
* Called when a value in the table is changed.
79
* If the command cell in the last row is changed to a non-empty
80
* value, a new row is added. If it is changed to an empty value,
83
* @param row table row of changed item
84
* @param col table column of changed item
86
void valueChanged(int row, int col);
89
* Insert a new row into the table.
91
* @param row the new row is inserted after this row
96
* Delete a row from the table.
98
* @param row row to delete
100
void deleteRow(int row);
103
* Clear a row in the table.
105
* @param row row to clear
107
void clearRow(int row);
110
* Execute a context menu action.
112
* @param action action of selected menu
114
void executeAction(QAction* action);
117
* Display context menu.
119
* @param row row at which context menu is displayed
120
* @param col column at which context menu is displayed
121
* @param pos position where context menu is drawn on screen
123
void contextMenu(int row, int col, const QPoint& pos);
126
* Display custom context menu.
128
* @param pos position where context menu is drawn on screen
130
void customContextMenu(const QPoint& pos);
133
#endif // CONFIGTABLE_H