diff options
author | Arno <arno@disconnect.de> | 2020-07-25 07:54:35 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2020-07-25 07:54:35 +0200 |
commit | d0f81a70688241adab6327cc55049bc0b1bbf848 (patch) | |
tree | 5612ec1984146f51778a69912619cf9a2b814bd7 | |
parent | ca5f4d90b5080cecf7ba467405296ef1e24bce64 (diff) | |
download | SheMov-d0f81a70688241adab6327cc55049bc0b1bbf848.tar.gz SheMov-d0f81a70688241adab6327cc55049bc0b1bbf848.tar.bz2 SheMov-d0f81a70688241adab6327cc55049bc0b1bbf848.zip |
Open movie properties dialog on doubleclick
When searching for actors, show a MoviePropertiesDialog instead of
expanding the item.
-rw-r--r-- | searchdialog.cpp | 16 | ||||
-rw-r--r-- | searchdialog.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/searchdialog.cpp b/searchdialog.cpp index 79a9c37..52bdc1b 100644 --- a/searchdialog.cpp +++ b/searchdialog.cpp @@ -24,6 +24,7 @@ #include <QStandardItemModel> #include <QSplitter> +#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); diff --git a/searchdialog.h b/searchdialog.h index ca7d859..ca16b79 100644 --- a/searchdialog.h +++ b/searchdialog.h @@ -52,6 +52,7 @@ class ActorsAndMore : public QWidget { public slots: void doSearch(); void doData(const QModelIndex &cur, const QModelIndex &prev); + void dataDoubleClicked(const QModelIndex &index); private: void searchActor(const QString &actor); |