Ignore:
Timestamp:
05/10/13 11:59:29 (11 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixed placement of popup category menu widgets.

They now popup to the right or left of the toolbar.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/application/canvasmain.py

    r11496 r11502  
    1717    QFileDialog, QMessageBox, QVBoxLayout, QSizePolicy, QColor, QKeySequence, 
    1818    QIcon, QToolBar, QToolButton, QDockWidget, QDesktopServices, QApplication, 
    19     QCursor 
    2019) 
    2120 
     
    4241 
    4342from .canvastooldock import CanvasToolDock, QuickCategoryToolbar, \ 
    44                             CategoryPopupMenu 
     43                            CategoryPopupMenu, popup_position_from_source 
    4544from .aboutdialog import AboutDialog 
    4645from .schemeinfo import SchemeInfoDialog 
     
    773772        if self.use_popover: 
    774773            # Show a popup menu with the widgets in the category 
    775             m = CategoryPopupMenu(self.quick_category) 
     774            popup = CategoryPopupMenu(self.quick_category) 
    776775            reg = self.widget_registry.model() 
    777776            i = index(self.widget_registry.categories(), category, 
    778777                      predicate=lambda name, cat: cat.name == name) 
    779778            if i != -1: 
    780                 m.setCategoryItem(reg.item(i)) 
    781                 action = m.exec_(QCursor.pos()) 
     779                popup.setCategoryItem(reg.item(i)) 
     780                button = self.quick_category.buttonForAction(action) 
     781                pos = popup_position_from_source(popup, button) 
     782                action = popup.exec_(pos) 
    782783                if action is not None: 
    783784                    self.on_tool_box_widget_activated(action) 
Note: See TracChangeset for help on using the changeset viewer.