Permalink
Browse files

Merge branch 'qttesting'

* qttesting:
  Fix ctkMenuComboBoxTranslator to not record event on the Completer associated
  Update QtTesting git tag : Fix crash when no Object found
  • Loading branch information...
2 parents 294a181 + 81f9274 commit af18fe4f31c9c1d41db6b965533665c473ee0248 @benjaminlong benjaminlong committed Jun 27, 2012
@@ -23,7 +23,7 @@ if(CTK_USE_QTTESTING)
if(NOT DEFINED QtTesting_DIR)
- set(revision_tag 4c01c5e7cde0fdeae15c082c0cdd2efcb926675f)
+ set(revision_tag 7dbef1003157941e7315220f53cf4e17d78b5e28)
if(${proj}_REVISION_TAG)
set(revision_tag ${${proj}_REVISION_TAG})
endif()
@@ -19,6 +19,7 @@
=========================================================================*/
// Qt includes
+#include <QAbstractItemView>
#include <QComboBox>
#include <QDebug>
#include <QEvent>
@@ -36,6 +37,7 @@ ctkMenuComboBoxEventTranslator::ctkMenuComboBoxEventTranslator(QObject *parent)
: pqWidgetEventTranslator(parent)
{
this->CurrentObject = 0;
+ this->CurrentView = 0;
}
// ----------------------------------------------------------------------------
@@ -45,6 +47,12 @@ bool ctkMenuComboBoxEventTranslator::translateEvent(QObject *Object,
{
Q_UNUSED(Error);
ctkMenuComboBox* menuCombo = NULL;
+ if (this->CurrentView &&
+ qobject_cast<QAbstractItemView*>(Object) == this->CurrentView)
+ {
+ return true;
+ }
+
for(QObject* test = Object; menuCombo == NULL && test != NULL; test = test->parent())
{
menuCombo = qobject_cast<ctkMenuComboBox*>(test);
@@ -64,6 +72,7 @@ bool ctkMenuComboBoxEventTranslator::translateEvent(QObject *Object,
disconnect(this->CurrentObject, 0, this, 0);
}
this->CurrentObject = Object;
+ this->CurrentView = menuCombo->searchCompleter()->popup();
connect(menuCombo, SIGNAL(destroyed(QObject*)),
this, SLOT(onDestroyed()));
@@ -29,6 +29,7 @@
#include "ctkWidgetsExport.h"
class QAction;
+class QAbstractItemView;
class QMenu;
/// Translate low-level Qt events into high-level events for QtTesting
@@ -47,7 +48,8 @@ class CTK_WIDGETS_EXPORT ctkMenuComboBoxEventTranslator :
ctkMenuComboBoxEventTranslator(const ctkMenuComboBoxEventTranslator&); // NOT implemented
ctkMenuComboBoxEventTranslator& operator=(const ctkMenuComboBoxEventTranslator&); // NOT implemented
- QObject* CurrentObject;
+ QObject* CurrentObject;
+ QAbstractItemView* CurrentView;
void connectAllMenu(QMenu* menu);

0 comments on commit af18fe4

Please sign in to comment.