forked from qt-creator/qt-creator
ProjectExplorer: Do not activate kits via right click
... in the target selector. When requesting the kit context menu by right-clicking, we get extra mouse events on Windows that activate the kit, which is annoying to users. Suppress these events. Fixes: QTCREATORBUG-24156 Change-Id: I8a5de927634dfdfafb54d265ab31763c6120a527 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/basetreeview.h>
|
#include <utils/basetreeview.h>
|
||||||
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/navigationtreeview.h>
|
#include <utils/navigationtreeview.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/styledbar.h>
|
#include <utils/styledbar.h>
|
||||||
@@ -341,11 +342,31 @@ public:
|
|||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
// remove branch indicators
|
// remove branch indicators
|
||||||
void drawBranches(QPainter *, const QRect &, const QModelIndex &) const final
|
void drawBranches(QPainter *, const QRect &, const QModelIndex &) const final
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool userWantsContextMenu(const QMouseEvent *e) const
|
||||||
|
{
|
||||||
|
// On Windows, we get additional mouse events for the item view when right-clicking,
|
||||||
|
// causing unwanted kit activation (QTCREATORBUG-24156). Let's suppress these.
|
||||||
|
return HostOsInfo::isWindowsHost() && e->button() == Qt::RightButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mousePressEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
|
if (!userWantsContextMenu(e))
|
||||||
|
BaseTreeView::mousePressEvent(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouseReleaseEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
|
if (!userWantsContextMenu(e))
|
||||||
|
BaseTreeView::mouseReleaseEvent(e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ComboBoxItem : public TreeItem
|
class ComboBoxItem : public TreeItem
|
||||||
|
Reference in New Issue
Block a user