mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fix #2106
This commit is contained in:
parent
8bc3025a77
commit
4d676b4c51
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
EditableModelView::EditableModelView(QAbstractTableModel *model)
|
||||
EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
|
||||
: tableView_(new QTableView(this))
|
||||
, model_(model)
|
||||
{
|
||||
|
@ -56,17 +56,20 @@ EditableModelView::EditableModelView(QAbstractTableModel *model)
|
|||
model_->removeRow(row);
|
||||
});
|
||||
|
||||
// move up
|
||||
QPushButton *moveUp = new QPushButton("Move up");
|
||||
buttons->addWidget(moveUp);
|
||||
QObject::connect(moveUp, &QPushButton::clicked, this,
|
||||
[this] { this->moveRow(-1); });
|
||||
if (movable)
|
||||
{
|
||||
// move up
|
||||
QPushButton *moveUp = new QPushButton("Move up");
|
||||
buttons->addWidget(moveUp);
|
||||
QObject::connect(moveUp, &QPushButton::clicked, this,
|
||||
[this] { this->moveRow(-1); });
|
||||
|
||||
// move down
|
||||
QPushButton *moveDown = new QPushButton("Move down");
|
||||
buttons->addWidget(moveDown);
|
||||
QObject::connect(moveDown, &QPushButton::clicked, this,
|
||||
[this] { this->moveRow(1); });
|
||||
// move down
|
||||
QPushButton *moveDown = new QPushButton("Move down");
|
||||
buttons->addWidget(moveDown);
|
||||
QObject::connect(moveDown, &QPushButton::clicked, this,
|
||||
[this] { this->moveRow(1); });
|
||||
}
|
||||
|
||||
buttons->addStretch();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace chatterino {
|
|||
class EditableModelView : public QWidget
|
||||
{
|
||||
public:
|
||||
EditableModelView(QAbstractTableModel *model);
|
||||
EditableModelView(QAbstractTableModel *model, bool movable = true);
|
||||
|
||||
void setTitles(std::initializer_list<QString> titles);
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@ AccountsPage::AccountsPage()
|
|||
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
||||
|
||||
EditableModelView *view =
|
||||
layout.emplace<EditableModelView>(app->accounts->createModel(nullptr))
|
||||
layout
|
||||
.emplace<EditableModelView>(app->accounts->createModel(nullptr),
|
||||
false)
|
||||
.getElement();
|
||||
|
||||
view->getTableView()->horizontalHeader()->setVisible(false);
|
||||
|
|
Loading…
Reference in a new issue