From d0f81a70688241adab6327cc55049bc0b1bbf848 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 25 Jul 2020 07:54:35 +0200 Subject: Open movie properties dialog on doubleclick When searching for actors, show a MoviePropertiesDialog instead of expanding the item. --- searchdialog.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'searchdialog.cpp') diff --git a/searchdialog.cpp b/searchdialog.cpp index 79a9c37..52bdc1b 100644 --- a/searchdialog.cpp +++ b/searchdialog.cpp @@ -24,6 +24,7 @@ #include #include +#include "moviepropertiesdialog.h" #include "smtreeview.h" #include "smtreeitem.h" #include "smtreemodel.h" @@ -160,6 +161,8 @@ ActorsAndMore::ActorsAndMore(QWidget *parent, Qt::WindowFlags flags) : QWidget(p QSortFilterProxyModel *dataProxy = new QSortFilterProxyModel; dataProxy->setSourceModel(mDataModel); mDataView = new QTreeView; + mDataView->setExpandsOnDoubleClick(false); + connect(mDataView, &QTreeView::doubleClicked, this, &ActorsAndMore::dataDoubleClicked); mDataView->setModel(dataProxy); QHBoxLayout *resultHBL = new QHBoxLayout; resultHBL->addWidget(mResultView); @@ -237,6 +240,19 @@ void ActorsAndMore::doData(const QModelIndex &cur, const QModelIndex &prev){ } } +void ActorsAndMore::dataDoubleClicked(const QModelIndex &index){ + QModelIndex cur = index; + while(cur.parent().isValid()){ + cur = cur.parent(); + } + int searchType = mTypeSel->currentData().toInt(); + if(searchType == Actor){ + MoviePropertiesDialog propDlg(this); + propDlg.init(cur.data(IdRole).toInt()); + propDlg.exec(); + } +} + void ActorsAndMore::getDataForActor(QModelIndex cur){ mDataModel->clear(); mDataModel->setColumnCount(1); -- cgit v1.2.3-70-g09d2