debugging the drop duplicating entries

This commit is contained in:
Chris Cochrun 2022-04-07 12:00:46 -05:00
parent deb620a2eb
commit 332c41de1b
3 changed files with 13 additions and 3 deletions

View file

@ -3,7 +3,7 @@
** TODO BUG in dropping and then selecting song will duplicate entries ** TODO BUG in dropping and then selecting song will duplicate entries
[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::Layout.fillHeight: true]] [[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::Layout.fillHeight: true]]
or at least turns the entry above it into the same as itself while retaining it's title. or at least turns the entry above it into the same as itself while retaining it's title?
** TODO Build out a slide preview system so we can see each slide in the song or image slideshow ** TODO Build out a slide preview system so we can see each slide in the song or image slideshow
[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]] [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]]

View file

@ -34,6 +34,7 @@ ColumnLayout {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
onDropped: { onDropped: {
print("DROPPED AT END");
appendItem(dragItemTitle, appendItem(dragItemTitle,
dragItemType, dragItemType,
dragItemBackground, dragItemBackground,
@ -136,6 +137,7 @@ ColumnLayout {
id: serviceDrop id: serviceDrop
anchors.fill: parent anchors.fill: parent
onDropped: { onDropped: {
print("DROPPED IN ITEM AREA");
addItem(index, addItem(index,
dragItemTitle, dragItemTitle,
dragItemType, dragItemType,
@ -174,7 +176,7 @@ ColumnLayout {
function appendItem(name, type, background, backgroundType, text, itemID) { function appendItem(name, type, background, backgroundType, text, itemID) {
let lyrics; let lyrics;
if (type == "song") { if (type === "song") {
lyrics = songsqlmodel.getLyricList(itemID); lyrics = songsqlmodel.getLyricList(itemID);
print(lyrics); print(lyrics);
} }

View file

@ -1,6 +1,7 @@
#include "serviceitemmodel.h" #include "serviceitemmodel.h"
#include "serviceitem.h" #include "serviceitem.h"
#include <qabstractitemmodel.h> #include <qabstractitemmodel.h>
#include <qglobal.h>
#include <qnamespace.h> #include <qnamespace.h>
#include <qvariant.h> #include <qvariant.h>
#include <qdebug.h> #include <qdebug.h>
@ -115,8 +116,15 @@ Qt::ItemFlags ServiceItemModel::flags(const QModelIndex &index) const {
void ServiceItemModel::addItem(ServiceItem *item) { void ServiceItemModel::addItem(ServiceItem *item) {
const int index = m_items.size(); const int index = m_items.size();
qDebug() << index;
// foreach (item, m_items) {
// qDebug() << item;
// }
beginInsertRows(QModelIndex(), index, index); beginInsertRows(QModelIndex(), index, index);
m_items.append(item); m_items.append(item);
foreach (item, m_items) {
qDebug() << item;
}
endInsertRows(); endInsertRows();
} }
@ -177,7 +185,7 @@ bool ServiceItemModel::move(int sourceIndex, int destIndex) {
qDebug() << "starting move of: " << "source: " << sourceIndex << "dest: " << destIndex; qDebug() << "starting move of: " << "source: " << sourceIndex << "dest: " << destIndex;
qDebug() << index(sourceIndex).row(); qDebug() << index(sourceIndex).row();
qDebug() << index(destIndex).row(); qDebug() << index(destIndex).row();
QModelIndex parent = index(sourceIndex).parent(); // QModelIndex parent = index(sourceIndex).parent();
// bool begsuc = beginMoveRows(parent, sourceIndex, sourceIndex, parent, destIndex); // bool begsuc = beginMoveRows(parent, sourceIndex, sourceIndex, parent, destIndex);
beginResetModel(); beginResetModel();
m_items.move(sourceIndex, destIndex); m_items.move(sourceIndex, destIndex);