diff --git a/ChangeLog b/ChangeLog index 2d7a2094d..bdc0f7f14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -50,6 +50,8 @@ (asf/wmv/mp4v) - these seem to crash TagLib. 34. When using MPRISv2 interface, dont attempt to play a song if the playqueue is empty! +35. Use SH_ItemView_ActivateItemOnSingleClick to detect single click mode in Qt + build. 0.5.1 ----- diff --git a/gui/playlistspage.cpp b/gui/playlistspage.cpp index 2a12677b5..0c82dd285 100644 --- a/gui/playlistspage.cpp +++ b/gui/playlistspage.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #endif PlaylistsPage::PlaylistsPage(MainWindow *p) @@ -282,9 +283,11 @@ void PlaylistsPage::itemDoubleClicked(const QModelIndex &index) { if ( #ifdef ENABLE_KDE_SUPPORT - KGlobalSettings::singleClick() || + KGlobalSettings::singleClick() + #else + style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this) #endif - !static_cast(proxy.mapToSource(index).internalPointer())->isPlaylist()) { + || !static_cast(proxy.mapToSource(index).internalPointer())->isPlaylist()) { QModelIndexList indexes; indexes.append(index); addItemsToPlayQueue(indexes, false); diff --git a/widgets/itemview.cpp b/widgets/itemview.cpp index 3cbb2a413..ed6b9761c 100644 --- a/widgets/itemview.cpp +++ b/widgets/itemview.cpp @@ -40,6 +40,12 @@ #include #endif +#ifdef ENABLE_KDE_SUPPORT +#define SINGLE_CLICK KGlobalSettings::singleClick() +#else +#define SINGLE_CLICK style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this) +#endif + EscapeKeyEventHandler::EscapeKeyEventHandler(QAbstractItemView *v, QAction *a) : QObject(v) , view(v) @@ -364,11 +370,9 @@ void ItemView::allowGroupedView() groupedView->setAutoExpand(false); treeLayout->addWidget(groupedView); connect(groupedView, SIGNAL(itemsSelected(bool)), this, SIGNAL(itemsSelected(bool))); - #ifdef ENABLE_KDE_SUPPORT - if (KGlobalSettings::singleClick()) { + if (SINGLE_CLICK) { connect(groupedView, SIGNAL(activated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &))); } - #endif connect(groupedView, SIGNAL(doubleClicked(const QModelIndex &)), this, SIGNAL(doubleClicked(const QModelIndex &))); connect(groupedView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(itemClicked(const QModelIndex &))); } @@ -394,11 +398,9 @@ void ItemView::init(QAction *a1, QAction *a2, QAction *t, int actionLevel) connect(listSearch, SIGNAL(returnPressed()), this, SLOT(delaySearchItems())); connect(listSearch, SIGNAL(textChanged(const QString)), this, SLOT(delaySearchItems())); connect(treeView, SIGNAL(itemsSelected(bool)), this, SIGNAL(itemsSelected(bool))); -#ifdef ENABLE_KDE_SUPPORT - if (KGlobalSettings::singleClick()) { + if (SINGLE_CLICK) { connect(treeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &))); } -#endif connect(treeView, SIGNAL(doubleClicked(const QModelIndex &)), this, SIGNAL(doubleClicked(const QModelIndex &))); connect(treeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(itemClicked(const QModelIndex &))); connect(listView, SIGNAL(itemsSelected(bool)), this, SIGNAL(itemsSelected(bool)));