mirror-chatterino2/src/widgets/helper/EditableModelView.hpp
kornes 36c8fffee2
feat: Automatically select newly added table rows (#4216)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
2022-12-06 22:52:58 +00:00

37 lines
760 B
C++

#pragma once
#include <pajlada/signals/signal.hpp>
#include <QWidget>
class QAbstractTableModel;
class QTableView;
class QHBoxLayout;
namespace chatterino {
class EditableModelView : public QWidget
{
public:
EditableModelView(QAbstractTableModel *model, bool movable = true);
void setTitles(std::initializer_list<QString> titles);
void setValidationRegexp(QRegularExpression regexp);
QTableView *getTableView();
QAbstractTableModel *getModel();
pajlada::Signals::NoArgSignal addButtonPressed;
void addCustomButton(QWidget *widget);
void addRegexHelpLink();
private:
QTableView *tableView_{};
QAbstractTableModel *model_{};
QHBoxLayout *buttons_{};
void moveRow(int dir);
};
} // namespace chatterino