adding selectionModel and small ui tweaks
This commit is contained in:
parent
1a8a57012a
commit
74e9bd2f6e
1 changed files with 26 additions and 4 deletions
|
@ -7,7 +7,6 @@ import QtQml.Models 2.15
|
||||||
import org.kde.kirigami 2.13 as Kirigami
|
import org.kde.kirigami 2.13 as Kirigami
|
||||||
import "./" as Presenter
|
import "./" as Presenter
|
||||||
import org.presenter 1.0
|
import org.presenter 1.0
|
||||||
import mpv 1.0
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
@ -152,7 +151,7 @@ Item {
|
||||||
onSelectionChanged: {
|
onSelectionChanged: {
|
||||||
showPassiveNotification("deslected: " + deselected);
|
showPassiveNotification("deslected: " + deselected);
|
||||||
showPassiveNotification("selected: " + selected);
|
showPassiveNotification("selected: " + selected);
|
||||||
console.log(selected);
|
/* console.log(selected); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delegate: songDelegate
|
delegate: songDelegate
|
||||||
|
@ -277,7 +276,7 @@ Item {
|
||||||
rightClickSongMenu.popup()
|
rightClickSongMenu.popup()
|
||||||
else if ((mouse.button === Qt.LeftButton) &&
|
else if ((mouse.button === Qt.LeftButton) &&
|
||||||
(mouse.modifiers === Qt.ShiftModifier)) {
|
(mouse.modifiers === Qt.ShiftModifier)) {
|
||||||
selectSongs(index);
|
songLibraryList.selectSongs(index);
|
||||||
} else {
|
} else {
|
||||||
songSelectionModel.select(songProxyModel.idx(index),
|
songSelectionModel.select(songProxyModel.idx(index),
|
||||||
ItemSelectionModel.ClearAndSelect);
|
ItemSelectionModel.ClearAndSelect);
|
||||||
|
@ -332,6 +331,26 @@ Item {
|
||||||
editType = "song";
|
editType = "song";
|
||||||
editSwitch(songLibraryList.currentIndex);
|
editSwitch(songLibraryList.currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectSongs(row) {
|
||||||
|
/* console.log("SELECT SOME SONGS!") */
|
||||||
|
let currentRow = songSelectionModel.selectedIndexes[0].row;
|
||||||
|
if (row === currentRow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (row > currentRow) {
|
||||||
|
for (var i = currentRow; i <= row; i++) {
|
||||||
|
let idx = songProxyModel.idx(i);
|
||||||
|
songSelectionModel.select(idx, ItemSelectionModel.Select);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var i = row; i <= currentRow; i++) {
|
||||||
|
let idx = songProxyModel.idx(i);
|
||||||
|
songSelectionModel.select(idx, ItemSelectionModel.Select);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -1105,7 +1124,10 @@ Item {
|
||||||
height: selectedLibrary == "presentations" ? 50 : 0
|
height: selectedLibrary == "presentations" ? 50 : 0
|
||||||
clip: true
|
clip: true
|
||||||
label: title
|
label: title
|
||||||
icon: "x-office-presentation-symbolic"
|
icon: Kirigami.Icon {
|
||||||
|
source: "x-office-presentation-symbolic"
|
||||||
|
fallback: "x-office-presentation"
|
||||||
|
}
|
||||||
iconSize: Kirigami.Units.gridUnit
|
iconSize: Kirigami.Units.gridUnit
|
||||||
subtitle: {
|
subtitle: {
|
||||||
if (fileValidation)
|
if (fileValidation)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue