Changeset 11523:8a3d9995ccd7 in orange


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

Selection follows mouse cursor in MenuPage widget.

Location:
Orange/OrangeCanvas
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/document/quickmenu.py

    r11519 r11523  
    2121    QStandardItemModel, QSortFilterProxyModel, QStyleOptionToolButton, 
    2222    QStylePainter, QStyle, QApplication, QStyledItemDelegate, 
    23     QStyleOptionViewItemV4, QSizeGrip, QCursor, QPolygon, QRegion 
     23    QStyleOptionViewItemV4, QSizeGrip, QPolygon, QRegion, QItemSelectionModel 
    2424) 
    2525 
     
    7979 
    8080        self.view().setItemDelegate(_MenuItemDelegate(self.view())) 
     81        self.view().entered.connect(self.__onEntered) 
     82        self.view().viewport().setMouseTracking(True) 
    8183        # Make sure the initial model is wrapped in a ItemDisableFilter. 
    8284        self.setModel(self.model()) 
     
    165167            height = 0 
    166168        return QSize(width, height) 
     169 
     170    def __onEntered(self, index): 
     171        self.view().selectionModel().select( 
     172            index, 
     173            QItemSelectionModel.ClearAndSelect 
     174        ) 
     175        self.view().setCurrentIndex(index) 
    167176 
    168177 
  • Orange/OrangeCanvas/styles/orange.qss

    r11500 r11523  
    114114} 
    115115 
    116 CategoryPopupMenu QTreeView::item:hover { 
     116CategoryPopupMenu QTreeView::item:selected { 
    117117    background: qlineargradient( 
    118118        x1: 0, y1: 0, x2: 0, y2: 1, 
     
    124124} 
    125125 
    126 CategoryPopupMenu QTreeView::item:selected { 
    127     background-color: blue; 
    128     color: white; 
    129 } 
    130  
    131126 
    132127/* Canvas Dock Header */ 
     
    374369} 
    375370 
    376 QuickMenu ToolTree QTreeView::item { 
     371QuickMenu QTreeView::item { 
    377372    border-bottom: 1px solid #e9eff2; 
    378373} 
    379374 
    380 QuickMenu QTreeView::item:hover { 
     375QuickMenu QTreeView::item:selected { 
    381376    background: qlineargradient( 
    382377        x1: 0, y1: 0, x2: 0, y2: 1, 
     
    385380        stop: 1.0 #2D68F3 
    386381    ); 
    387     color: white; 
    388 } 
    389  
    390 QuickMenu QTreeView::item:selected { 
    391     background-color: blue; 
    392382    color: white; 
    393383} 
Note: See TracChangeset for help on using the changeset viewer.