summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2025-05-09 11:11:22 +0200
committerArno <arno@disconnect.de>2025-05-09 11:11:22 +0200
commit3fb7be06d142c505f8bff014e9e9224e86cd562e (patch)
tree3ca3ed2f20f67128f328b59c165667639fca3be8
parent9276db1f7d466668b5e5a0dd13a05eb3cf328c70 (diff)
downloadSheMov-3fb7be06d142c505f8bff014e9e9224e86cd562e.tar.gz
SheMov-3fb7be06d142c505f8bff014e9e9224e86cd562e.tar.bz2
SheMov-3fb7be06d142c505f8bff014e9e9224e86cd562e.zip
Fix randomtab doubleclick
Long standing bug: use the actual QModelIndex instead of the first one.
-rw-r--r--randomtab.cpp12
-rw-r--r--randomtab.h2
2 files changed, 8 insertions, 6 deletions
diff --git a/randomtab.cpp b/randomtab.cpp
index 2d83d9e..5242a2a 100644
--- a/randomtab.cpp
+++ b/randomtab.cpp
@@ -416,6 +416,7 @@ void RandomTab::select(){
}
}
fData[5]->setText(fullPath);
+ fData[5]->setData(fullPath, RandomTab::FullPathRole);
}
fRootItem->appendRow(fData);
}
@@ -450,11 +451,12 @@ void RandomTab::playSelected(){
}
void RandomTab::playDoubleclicked(QModelIndex idx){
- QString fp = idx.sibling(0, FullPath).data().toString();
- logMessage(QString(tr("Doubleclick on %1")).arg(fp));
- QStringList f = QStringList() << fp;
- play(f);
-
+ if(idx.isValid()){
+ QModelIndex fpidx = idx.siblingAtColumn(FullPath);
+ QString fp = fpidx.data(RandomTab::FullPathRole).toString();
+ logMessage(QString(tr("Doubleclick on %1")).arg(fp));
+ play(QStringList() << fp);
+ }
}
void RandomTab::play(const QStringList &files){
diff --git a/randomtab.h b/randomtab.h
index c479ac3..10d25bd 100644
--- a/randomtab.h
+++ b/randomtab.h
@@ -28,7 +28,7 @@ class RandomFileView;
class RandomTab : public QWidget {
Q_OBJECT
public:
- enum CustomRoles { IdRole = Qt::UserRole + 1, SizeRole = Qt::UserRole + 2, DurationRole = Qt::UserRole + 3, DvdNoRole = Qt::UserRole + 4 };
+ enum CustomRoles { IdRole = Qt::UserRole + 1, SizeRole = Qt::UserRole + 2, DurationRole = Qt::UserRole + 3, DvdNoRole = Qt::UserRole + 4, FullPathRole = Qt::UserRole + 5 };
enum Columns { FileName = 0, Size = 1, Duration = 2, Md5 = 3, Location = 4, FullPath = 5 };
enum { ColumnCount = 6 };
explicit RandomTab(QWidget *parent = nullptr);