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:
Jens Bache-Wiig
2010-03-02 18:38:58 +01:00
parent 9426caeeed
commit 35a09f2efe
2 changed files with 14 additions and 0 deletions

View File

@@ -426,6 +426,19 @@ void MiniProjectTargetSelector::setVisible(bool visible)
m_projectAction->setChecked(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) void MiniProjectTargetSelector::addProject(ProjectExplorer::Project* project)
{ {
QTC_ASSERT(project, return); QTC_ASSERT(project, return);

View File

@@ -132,6 +132,7 @@ private slots:
void changeStartupProject(ProjectExplorer::Project *project); void changeStartupProject(ProjectExplorer::Project *project);
void updateAction(); void updateAction();
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *);
private: private:
int indexFor(ProjectExplorer::Project *project) const; int indexFor(ProjectExplorer::Project *project) const;