浏览代码

The popup menu in ctkTreeComboBoxTest1 was not closed

It's because at the time the popup is asked to be closed, the popup is not
even visible (because of the scroll animation), disable the animation in
the example.
Julien Finet 14 年之前
父节点
当前提交
6102562bdc
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Libs/Widgets/Testing/Cpp/ctkTreeComboBoxTest1.cpp

+ 5 - 1
Libs/Widgets/Testing/Cpp/ctkTreeComboBoxTest1.cpp

@@ -51,9 +51,13 @@ int ctkTreeComboBoxTest1(int argc, char * argv [] )
     return EXIT_FAILURE;
     return EXIT_FAILURE;
     }
     }
   combo.show();
   combo.show();
-  
+  // if the effect UI_AnimateCombo is enabled, the popup doesn't have time
+  // to be visible when hidePopup() is called wich doesn't hide the popup.
+  bool oldEnabled = QApplication::isEffectEnabled(Qt::UI_AnimateCombo);
+  QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false);
   combo.showPopup();
   combo.showPopup();
   combo.hidePopup();
   combo.hidePopup();
+  QApplication::setEffectEnabled(Qt::UI_AnimateCombo, oldEnabled);
   
   
   if (argc < 2 || QString(argv[1]) != "-I" )
   if (argc < 2 || QString(argv[1]) != "-I" )
     {
     {