forked from qt-creator/qt-creator
Fix button toggle of the miniproject selector on Windows
The problem is that on windows, mouse events are replayed if you click outside a popup to close it. If you hit the project selector button to toggle it, this will cause the popup to reopen on mouse release. Which we do not want. Hence we set the DontReplay flag on mouseClick. A similar workaround can be found in QComboBox.
This commit is contained in:
@@ -426,6 +426,19 @@ void MiniProjectTargetSelector::setVisible(bool visible)
|
||||
m_projectAction->setChecked(visible);
|
||||
}
|
||||
|
||||
// This is a workaround for the problem that Windows
|
||||
// will let the mouse events through when you click
|
||||
// outside a popup to close it. This causes the popup
|
||||
// to open on mouse release if you hit the button, which
|
||||
//
|
||||
//
|
||||
// A similar case can be found in QComboBox
|
||||
void MiniProjectTargetSelector::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
setAttribute(Qt::WA_NoMouseReplay);
|
||||
QWidget::mousePressEvent(e);
|
||||
}
|
||||
|
||||
void MiniProjectTargetSelector::addProject(ProjectExplorer::Project* project)
|
||||
{
|
||||
QTC_ASSERT(project, return);
|
||||
|
||||
@@ -132,6 +132,7 @@ private slots:
|
||||
void changeStartupProject(ProjectExplorer::Project *project);
|
||||
void updateAction();
|
||||
void paintEvent(QPaintEvent *);
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
|
||||
private:
|
||||
int indexFor(ProjectExplorer::Project *project) const;
|
||||
|
||||
Reference in New Issue
Block a user