Commits

Aleš Erjavec committed 38efa0b

Initialize the search text with the pressed key.

Comments (0)

Files changed (2)

Orange/OrangeCanvas/document/interactions.py

             self.create_new(event.screenPos())
             self.end()
 
-    def create_new(self, pos):
+    def create_new(self, pos, search_text=""):
         """
         Create a new widget with a `QuickMenu` at `pos` (in screen
         coordinates).
         menu = self.document.quickMenu()
         menu.setFilterFunc(None)
 
-        action = menu.exec_(pos)
+        action = menu.exec_(pos, search_text)
         if action:
             item = action.property("item").toPyObject()
             desc = item.data(QtWidgetRegistry.WIDGET_DESC_ROLE).toPyObject()

Orange/OrangeCanvas/document/schemeedit.py

             return False
 
         handler = None
+        searchText = ""
         if (event.key() == Qt.Key_Space and \
                 self.__quickMenuTriggers & SchemeEditWidget.SpaceKey):
             handler = interactions.NewNodeAction(self)
         elif len(event.text()) and \
                 self.__quickMenuTriggers & SchemeEditWidget.AnyKey:
             handler = interactions.NewNodeAction(self)
+            searchText = unicode(event.text())
+
             # TODO: set the search text to event.text() and set focus on the
             # search line
 
             with nested(disabled(self.__removeSelectedAction),
                         disabled(self.__undoAction),
                         disabled(self.__redoAction)):
-                handler.create_new(QCursor.pos())
+                handler.create_new(QCursor.pos(), searchText)
 
             event.accept()
             return True