mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-27 01:54:20 +01:00
Don't expand items on a double click now that we expand them on single clicks instead
This commit is contained in:
parent
a739ff2714
commit
0aa3cb4308
@ -24,10 +24,14 @@ const int AutoExpandingTreeView::kRowsToShow = 50;
|
|||||||
AutoExpandingTreeView::AutoExpandingTreeView(QWidget *parent)
|
AutoExpandingTreeView::AutoExpandingTreeView(QWidget *parent)
|
||||||
: QTreeView(parent),
|
: QTreeView(parent),
|
||||||
auto_open_(true),
|
auto_open_(true),
|
||||||
expand_on_reset_(true)
|
expand_on_reset_(true),
|
||||||
|
ignore_next_click_(false)
|
||||||
{
|
{
|
||||||
|
setExpandsOnDoubleClick(false);
|
||||||
|
|
||||||
connect(this, SIGNAL(expanded(QModelIndex)), SLOT(ItemExpanded(QModelIndex)));
|
connect(this, SIGNAL(expanded(QModelIndex)), SLOT(ItemExpanded(QModelIndex)));
|
||||||
connect(this, SIGNAL(clicked(QModelIndex)), SLOT(ItemClicked(QModelIndex)));
|
connect(this, SIGNAL(clicked(QModelIndex)), SLOT(ItemClicked(QModelIndex)));
|
||||||
|
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(ItemDoubleClicked(QModelIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoExpandingTreeView::reset() {
|
void AutoExpandingTreeView::reset() {
|
||||||
@ -72,5 +76,14 @@ void AutoExpandingTreeView::ItemExpanded(const QModelIndex& index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AutoExpandingTreeView::ItemClicked(const QModelIndex& index) {
|
void AutoExpandingTreeView::ItemClicked(const QModelIndex& index) {
|
||||||
|
if (ignore_next_click_) {
|
||||||
|
ignore_next_click_ = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setExpanded(index, !isExpanded(index));
|
setExpanded(index, !isExpanded(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoExpandingTreeView::ItemDoubleClicked(const QModelIndex& index) {
|
||||||
|
ignore_next_click_ = true;
|
||||||
|
}
|
||||||
|
@ -43,6 +43,7 @@ class AutoExpandingTreeView : public QTreeView {
|
|||||||
private slots:
|
private slots:
|
||||||
void ItemExpanded(const QModelIndex& index);
|
void ItemExpanded(const QModelIndex& index);
|
||||||
void ItemClicked(const QModelIndex& index);
|
void ItemClicked(const QModelIndex& index);
|
||||||
|
void ItemDoubleClicked(const QModelIndex& index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool RecursivelyExpand(const QModelIndex& index, int* count);
|
bool RecursivelyExpand(const QModelIndex& index, int* count);
|
||||||
@ -50,6 +51,8 @@ class AutoExpandingTreeView : public QTreeView {
|
|||||||
private:
|
private:
|
||||||
bool auto_open_;
|
bool auto_open_;
|
||||||
bool expand_on_reset_;
|
bool expand_on_reset_;
|
||||||
|
|
||||||
|
bool ignore_next_click_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AUTOEXPANDINGTREEVIEW_H
|
#endif // AUTOEXPANDINGTREEVIEW_H
|
||||||
|
Loading…
Reference in New Issue
Block a user