2019-09-08 22:27:57 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
#include <pajlada/signals/signal.hpp>
|
|
|
|
|
|
|
|
class QAbstractTableModel;
|
|
|
|
class QTableView;
|
|
|
|
class QHBoxLayout;
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class EditableModelView : public QWidget
|
|
|
|
{
|
|
|
|
public:
|
2020-10-22 20:02:14 +02:00
|
|
|
EditableModelView(QAbstractTableModel *model, bool movable = true);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
void setTitles(std::initializer_list<QString> titles);
|
2022-05-08 12:27:25 +02:00
|
|
|
void setValidationRegexp(QRegularExpression regexp);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
QTableView *getTableView();
|
|
|
|
QAbstractTableModel *getModel();
|
|
|
|
|
|
|
|
pajlada::Signals::NoArgSignal addButtonPressed;
|
|
|
|
|
|
|
|
void addCustomButton(QWidget *widget);
|
|
|
|
void addRegexHelpLink();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QTableView *tableView_{};
|
|
|
|
QAbstractTableModel *model_{};
|
|
|
|
QHBoxLayout *buttons_{};
|
2020-09-26 15:11:45 +02:00
|
|
|
|
|
|
|
void moveRow(int dir);
|
2021-11-21 18:46:21 +01:00
|
|
|
|
|
|
|
public:
|
2020-09-26 15:11:45 +02:00
|
|
|
void selectRow(int row);
|
2019-09-08 22:27:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|