From 980b92a27f64804de24f027d80d8d27f17be8a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Fri, 29 Sep 2017 22:53:29 +0200 Subject: [PATCH] Fixed add label, begin/end insert rows used to fail in this case, probably it was a qt bug, not it works as intended. --- YACReaderLibrary/db/reading_list_model.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/YACReaderLibrary/db/reading_list_model.cpp b/YACReaderLibrary/db/reading_list_model.cpp index 6defb5de..5bff8e81 100644 --- a/YACReaderLibrary/db/reading_list_model.cpp +++ b/YACReaderLibrary/db/reading_list_model.cpp @@ -390,15 +390,9 @@ void ReadingListModel::addNewLabel(const QString &name, YACReader::LabelColors c QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath); qulonglong id = DBHelper::insertLabel(name, color, db); - Q_UNUSED(id); + int newPos = addLabelIntoList(new LabelItem(QList() << name << YACReader::colorToName(color) << id << color)); + beginInsertRows(QModelIndex(),specialLists.count()+1+newPos+1, specialLists.count()+1+newPos+1); - beginInsertRows(QModelIndex(),0, 0); - - // using the specfic row pos for inserting doesnt work - // int newPos = addLabelIntoList(new LabelItem(QList() << name << YACReader::colorToName(color) << id << color)); - // beginInsertRows(QModelIndex(),specialLists.count()+1+newPos+1, specialLists.count()+1+newPos+1); - - // endInsertRows(); endInsertRows();