NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
customtablewidget.h
Go to the documentation of this file.
1
13#ifndef CUSTOMTABLEWIDGET_H
14#define CUSTOMTABLEWIDGET_H
15
16#include <QTableWidget>
17#include <QKeyEvent>
18#include <QSet>
19
24class CustomTableWidget : public QTableWidget
25{
26 Q_OBJECT
27
28public:
33 CustomTableWidget(QWidget *parent = nullptr);
34
40 bool hasEmptyCell(const QList<int>& exceptionColumns = QList<int>());
41
48 bool isRowEmpty(int row, const QList<int>& exceptionColumns = QList<int>());
49
61 bool isTableIncomplete(const QList<int>& exceptionColumns = QList<int>());
62
68 void setCheckboxDelegateForColumns(int row, const QList<int>& columns);
69
75 void setNumericDelegateForColumns(int row, const QList<int> &columns);
76
81 void setupTable();
82
88 int generateUniqueID();
89
90signals:
95 void keyPress(QKeyEvent *event);
96
102
103private slots:
107 void deleteSelectedRows();
108
109protected:
114 void keyPressEvent(QKeyEvent *event) override;
115
122 void setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
123};
124
125#endif // CUSTOMTABLEWIDGET_H
The CustomTableWidget class is a subclass of QTableWidget that provides additional functionality and ...
Definition customtablewidget.h:25
void setupTable()
Performs initial setup for the table.
Definition customtablewidget.cpp:123
void keyPressEvent(QKeyEvent *event) override
Overridden keyPressEvent() method to handle key press events in the table.
Definition customtablewidget.cpp:12
bool isTableIncomplete(const QList< int > &exceptionColumns=QList< int >())
Checks if the table is incomplete, i.e., if it does not have at least one complete row of data.
Definition customtablewidget.cpp:76
void keyPress(QKeyEvent *event)
Signal emitted when a key press event occurs in the table.
bool isRowEmpty(int row, const QList< int > &exceptionColumns=QList< int >())
Checks if a row is empty.
Definition customtablewidget.cpp:62
void setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Overridden setData() method for custom handling of data changes in the table.
Definition customtablewidget.cpp:157
bool hasEmptyCell(const QList< int > &exceptionColumns=QList< int >())
Checks if the table has any empty cells.
Definition customtablewidget.cpp:43
void cannotDeleteRow()
Signal emitted when row deletion is not allowed.
void setNumericDelegateForColumns(int row, const QList< int > &columns)
Sets a numeric delegate for the specified columns in a row.
Definition customtablewidget.cpp:118
void setCheckboxDelegateForColumns(int row, const QList< int > &columns)
Sets a checkbox delegate for the specified columns in a row.
Definition customtablewidget.cpp:105
int generateUniqueID()
Generates a unique ID.
Definition customtablewidget.cpp:141