fix #2106
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
EditableModelView::EditableModelView(QAbstractTableModel *model)
|
EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
|
||||||
: tableView_(new QTableView(this))
|
: tableView_(new QTableView(this))
|
||||||
, model_(model)
|
, model_(model)
|
||||||
{
|
{
|
||||||
@@ -56,17 +56,20 @@ EditableModelView::EditableModelView(QAbstractTableModel *model)
|
|||||||
model_->removeRow(row);
|
model_->removeRow(row);
|
||||||
});
|
});
|
||||||
|
|
||||||
// move up
|
if (movable)
|
||||||
QPushButton *moveUp = new QPushButton("Move up");
|
{
|
||||||
buttons->addWidget(moveUp);
|
// move up
|
||||||
QObject::connect(moveUp, &QPushButton::clicked, this,
|
QPushButton *moveUp = new QPushButton("Move up");
|
||||||
[this] { this->moveRow(-1); });
|
buttons->addWidget(moveUp);
|
||||||
|
QObject::connect(moveUp, &QPushButton::clicked, this,
|
||||||
|
[this] { this->moveRow(-1); });
|
||||||
|
|
||||||
// move down
|
// move down
|
||||||
QPushButton *moveDown = new QPushButton("Move down");
|
QPushButton *moveDown = new QPushButton("Move down");
|
||||||
buttons->addWidget(moveDown);
|
buttons->addWidget(moveDown);
|
||||||
QObject::connect(moveDown, &QPushButton::clicked, this,
|
QObject::connect(moveDown, &QPushButton::clicked, this,
|
||||||
[this] { this->moveRow(1); });
|
[this] { this->moveRow(1); });
|
||||||
|
}
|
||||||
|
|
||||||
buttons->addStretch();
|
buttons->addStretch();
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace chatterino {
|
|||||||
class EditableModelView : public QWidget
|
class EditableModelView : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EditableModelView(QAbstractTableModel *model);
|
EditableModelView(QAbstractTableModel *model, bool movable = true);
|
||||||
|
|
||||||
void setTitles(std::initializer_list<QString> titles);
|
void setTitles(std::initializer_list<QString> titles);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ AccountsPage::AccountsPage()
|
|||||||
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
||||||
|
|
||||||
EditableModelView *view =
|
EditableModelView *view =
|
||||||
layout.emplace<EditableModelView>(app->accounts->createModel(nullptr))
|
layout
|
||||||
|
.emplace<EditableModelView>(app->accounts->createModel(nullptr),
|
||||||
|
false)
|
||||||
.getElement();
|
.getElement();
|
||||||
|
|
||||||
view->getTableView()->horizontalHeader()->setVisible(false);
|
view->getTableView()->horizontalHeader()->setVisible(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user