diff --git a/app/settings/controllers/layoutscontroller.cpp b/app/settings/controllers/layoutscontroller.cpp index 0010362ae..5964b4dd9 100644 --- a/app/settings/controllers/layoutscontroller.cpp +++ b/app/settings/controllers/layoutscontroller.cpp @@ -68,6 +68,7 @@ Layouts::Layouts(QDialog *parent, Latte::Corona *corona, QTableView *view) loadLayouts(); connect(m_model, &QAbstractItemModel::dataChanged, this, &Layouts::dataChanged); + connect(m_model, &Model::Layouts::rowsInserted, this, &Layouts::dataChanged); } Layouts::~Layouts() diff --git a/app/settings/models/layoutsmodel.cpp b/app/settings/models/layoutsmodel.cpp index 2292202cd..e499d57b9 100644 --- a/app/settings/models/layoutsmodel.cpp +++ b/app/settings/models/layoutsmodel.cpp @@ -119,6 +119,8 @@ void Layouts::appendLayout(const Settings::Data::Layout &layout) beginInsertRows(QModelIndex(), m_layoutsTable.rowCount(), m_layoutsTable.rowCount()); m_layoutsTable << layout; endInsertRows(); + + emit rowsInserted(); } void Layouts::applyCurrentNames() @@ -140,7 +142,7 @@ void Layouts::removeLayout(const QString &id) if (index >= 0) { beginRemoveRows(QModelIndex(), index, index); m_layoutsTable.remove(index); - endInsertRows(); + endRemoveRows(); } } @@ -643,6 +645,8 @@ void Layouts::setCurrentData(Data::LayoutsTable &data) beginInsertRows(QModelIndex(), 0, data.rowCount() - 1); m_layoutsTable = data; endInsertRows(); + + emit rowsInserted(); } } diff --git a/app/settings/models/layoutsmodel.h b/app/settings/models/layoutsmodel.h index e41fc7b31..88fb42d47 100644 --- a/app/settings/models/layoutsmodel.h +++ b/app/settings/models/layoutsmodel.h @@ -101,6 +101,7 @@ public: signals: void inMultipleModeChanged(); + void rowsInserted(); private slots: void updateActiveStates();