add activate function properly

While the previous function technically worked, the connections
weren't setup properly. Also the row_count function wasn't running
because it requires a QModelIndex parameter. Added a simple count
function to make sure we know how many slides there are in QML.
This commit is contained in:
Chris Cochrun 2023-03-31 13:13:20 -05:00
parent b8bfa4b108
commit 0a9c17cdde
4 changed files with 59 additions and 23 deletions

View file

@ -15,7 +15,7 @@ Controls.Page {
property int currentServiceItem
property int currentSlide
property int totalServiceItems: ServiceItemModel.rowCount()
property int totalSlides: SlideMod.rowCount()
property int totalSlides: SlideMod.count()
property url imageBackground: presentation.imageBackground
property url videoBackground: presentation.vidBackground
property string currentText: presentation.text

View file

@ -365,6 +365,7 @@ FocusScope {
function nextSlideAction() {
keyHandler.forceActiveFocus();
console.log(currentServiceItem);
console.log(totalSlides);
const nextSlideIdx = currentSlide + 1;
if (nextSlideIdx > totalSlides || nextSlideIdx < 0)
return;

View file

@ -71,7 +71,7 @@ Item {
Connections {
target: SlideModel
target: SlideMod
function onDataChanged() {
if (active) {
previewSlidesList.currentIndex = index;