Minor preps for c++ ActivityListModel impl. in QML

This commit is contained in:
Dominique Fuchs 2019-11-29 17:06:35 +01:00
parent c6ff66be79
commit 03c0d8ba5a
2 changed files with 10 additions and 4 deletions

View file

@ -31,7 +31,7 @@ namespace OCC {
void Systray::showMessage(const QString &title, const QString &message, MessageIcon icon, int millisecondsTimeoutHint) void Systray::showMessage(const QString &title, const QString &message, MessageIcon icon, int millisecondsTimeoutHint)
{ {
#ifdef USE_FDO_NOTIFICATIONS #ifdef USE_FDO_NOTIFICATIONS
if(QDBusInterface(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE).isValid()) { if (QDBusInterface(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE).isValid()) {
QList<QVariant> args = QList<QVariant>() << APPLICATION_NAME << quint32(0) << APPLICATION_ICON_NAME QList<QVariant> args = QList<QVariant>() << APPLICATION_NAME << quint32(0) << APPLICATION_ICON_NAME
<< title << message << QStringList() << QVariantMap() << qint32(-1); << title << message << QStringList() << QVariantMap() << qint32(-1);
QDBusMessage method = QDBusMessage::createMethodCall(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE, "Notify"); QDBusMessage method = QDBusMessage::createMethodCall(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE, "Notify");

View file

@ -305,6 +305,10 @@ Window {
} }
} // Rectangle trayWindowHeaderBackground } // Rectangle trayWindowHeaderBackground
ListModel {
id: activityListModel
}
ListView { ListView {
id: activityListView id: activityListView
anchors.top: trayWindowHeaderBackground.bottom anchors.top: trayWindowHeaderBackground.bottom
@ -312,7 +316,7 @@ Window {
height: trayWindowBackground.height - trayWindowHeaderBackground.height height: trayWindowBackground.height - trayWindowHeaderBackground.height
clip: true clip: true
model: ListModel {} model: activityListModel
delegate: RowLayout { delegate: RowLayout {
id: activityItem id: activityItem
@ -388,8 +392,10 @@ Window {
} }
focus: true focus: true
Keys.onSpacePressed: model.insert(0, { "name": "Item " + model.count })
Keys.onTabPressed: model.remove(3) // For interactive ListView/Animation testing only
//Keys.onSpacePressed: model.insert(0, { "name": "Item " + model.count })
//Keys.onTabPressed: model.remove(3)
} }
} // Rectangle trayWindowBackground } // Rectangle trayWindowBackground