make feed list delegate SwipeListItem again

This commit is contained in:
Tobias Fella 2020-04-15 21:36:59 +02:00
parent 7dbcb4ccaf
commit 4412d1094f
3 changed files with 12 additions and 14 deletions

View File

@ -90,7 +90,7 @@ void FeedListModel::addFeed(QString url)
Database::instance().execute(query); Database::instance().execute(query);
} }
void FeedListModel::remove_feed(int index) void FeedListModel::removeFeed(int index)
{ {
Feed toRemove = feeds[index]; Feed toRemove = feeds[index];
QSqlQuery query; QSqlQuery query;

View File

@ -41,7 +41,7 @@ public:
QHash<int, QByteArray> roleNames() const override; QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE void addFeed(QString url); Q_INVOKABLE void addFeed(QString url);
Q_INVOKABLE void remove_feed(int index); Q_INVOKABLE void removeFeed(int index);
private: private:
QVector<Feed> feeds; QVector<Feed> feeds;

View File

@ -21,7 +21,6 @@
import QtQuick 2.14 import QtQuick 2.14
import QtQuick.Controls 2.10 as Controls import QtQuick.Controls 2.10 as Controls
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import org.kde.kirigami 2.8 as Kirigami import org.kde.kirigami 2.8 as Kirigami
import org.kde.alligator 1.0 import org.kde.alligator 1.0
@ -81,12 +80,10 @@ Kirigami.ScrollablePage {
} }
} }
delegate: Kirigami.AbstractListItem { delegate: Kirigami.SwipeListItem {
height: Kirigami.Units.gridUnit*2 height: Kirigami.Units.gridUnit*2
Item { Item {
height: parent.height
Kirigami.Icon { Kirigami.Icon {
id: icon id: icon
source: model.feed.image source: model.feed.image
@ -97,17 +94,18 @@ Kirigami.ScrollablePage {
Controls.Label { Controls.Label {
text: model.feed.name text: model.feed.name
height: parent.height height: parent.height
leftPadding: Kirigami.Units.gridUnit*0.5
anchors.left: icon.right anchors.left: icon.right
} leftPadding: 0.5*Kirigami.Units.gridUnit
MouseArea {
x: 0
y: 0
width: parent.width
height: parent.height
onClicked: pageStack.push("qrc:/EntryListPage.qml", {feed: model.feed})
} }
} }
actions: [
Kirigami.Action {
icon.name: "delete"
onTriggered: feedListModel.removeFeed(index)
}
]
} }
} }
} }