Forráskód Böngészése

Merge branch 'qttesting'

* qttesting:
  Fix ctkMenuComboBoxTranslator to not record event on the Completer associated
  Update QtTesting git tag : Fix crash when no Object found
Benjamin Long 13 éve
szülő
commit
af18fe4f31

+ 1 - 1
CMakeExternals/QtTesting.cmake

@@ -23,7 +23,7 @@ if(CTK_USE_QTTESTING)
 
 
     if(NOT DEFINED QtTesting_DIR)
     if(NOT DEFINED QtTesting_DIR)
 
 
-      set(revision_tag 4c01c5e7cde0fdeae15c082c0cdd2efcb926675f)
+      set(revision_tag 7dbef1003157941e7315220f53cf4e17d78b5e28)
       if(${proj}_REVISION_TAG)
       if(${proj}_REVISION_TAG)
         set(revision_tag ${${proj}_REVISION_TAG})
         set(revision_tag ${${proj}_REVISION_TAG})
       endif()
       endif()

+ 9 - 0
Libs/Widgets/ctkMenuComboBoxEventTranslator.cpp

@@ -19,6 +19,7 @@
 =========================================================================*/
 =========================================================================*/
 
 
 // Qt includes
 // Qt includes
+#include <QAbstractItemView>
 #include <QComboBox>
 #include <QComboBox>
 #include <QDebug>
 #include <QDebug>
 #include <QEvent>
 #include <QEvent>
@@ -36,6 +37,7 @@ ctkMenuComboBoxEventTranslator::ctkMenuComboBoxEventTranslator(QObject *parent)
   : pqWidgetEventTranslator(parent)
   : pqWidgetEventTranslator(parent)
 {
 {
   this->CurrentObject = 0;
   this->CurrentObject = 0;
+  this->CurrentView = 0;
 }
 }
 
 
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
@@ -45,6 +47,12 @@ bool ctkMenuComboBoxEventTranslator::translateEvent(QObject *Object,
 {
 {
   Q_UNUSED(Error);
   Q_UNUSED(Error);
   ctkMenuComboBox* menuCombo = NULL;
   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())
   for(QObject* test = Object; menuCombo == NULL && test != NULL; test = test->parent())
     {
     {
     menuCombo = qobject_cast<ctkMenuComboBox*>(test);
     menuCombo = qobject_cast<ctkMenuComboBox*>(test);
@@ -64,6 +72,7 @@ bool ctkMenuComboBoxEventTranslator::translateEvent(QObject *Object,
         disconnect(this->CurrentObject, 0, this, 0);
         disconnect(this->CurrentObject, 0, this, 0);
         }
         }
       this->CurrentObject = Object;
       this->CurrentObject = Object;
+      this->CurrentView = menuCombo->searchCompleter()->popup();
 
 
       connect(menuCombo, SIGNAL(destroyed(QObject*)),
       connect(menuCombo, SIGNAL(destroyed(QObject*)),
               this, SLOT(onDestroyed()));
               this, SLOT(onDestroyed()));

+ 3 - 1
Libs/Widgets/ctkMenuComboBoxEventTranslator.h

@@ -29,6 +29,7 @@
 #include "ctkWidgetsExport.h"
 #include "ctkWidgetsExport.h"
 
 
 class QAction;
 class QAction;
+class QAbstractItemView;
 class QMenu;
 class QMenu;
 
 
 /// Translate low-level Qt events into high-level events for QtTesting
 /// Translate low-level Qt events into high-level events for QtTesting
@@ -47,7 +48,8 @@ private:
   ctkMenuComboBoxEventTranslator(const ctkMenuComboBoxEventTranslator&); // NOT implemented
   ctkMenuComboBoxEventTranslator(const ctkMenuComboBoxEventTranslator&); // NOT implemented
   ctkMenuComboBoxEventTranslator& operator=(const ctkMenuComboBoxEventTranslator&); // NOT implemented
   ctkMenuComboBoxEventTranslator& operator=(const ctkMenuComboBoxEventTranslator&); // NOT implemented
 
 
-  QObject* CurrentObject;
+  QObject*            CurrentObject;
+  QAbstractItemView*  CurrentView;
 
 
   void connectAllMenu(QMenu* menu);
   void connectAllMenu(QMenu* menu);