Package schrodinger :: Package application :: Package msv :: Package gui :: Module delegates :: Class BarHeightDelegate
[hide private]
[frames] | no frames]

Class BarHeightDelegate

           object --+                            
                    |                            
    sip.simplewrapper --+                        
                        |                        
              sip.wrapper --+                    
                            |                    
         PyQt4.QtCore.QObject --+                
                                |                
PyQt4.QtGui.QAbstractItemDelegate --+            
                                    |            
      PyQt4.QtGui.QStyledItemDelegate --+        
                                        |        
                          BaseRowDelegate --+    
                                            |    
                  DoubleElementHeightDelegate --+
                                                |
                                               BarHeightDelegate
Known Subclasses:

A BarHeightDelegate is responsible for displaying array-like model data as a series of scaled bars

Nested Classes [hide private]

Inherited from PyQt4.QtGui.QAbstractItemDelegate: EndEditHint

Instance Methods [hide private]
float
_getScalingFactor(self, min_val, max_val)
Get a scaling factor to adjust a data value by.
float
getScaledValue(self, index)
Return the value scaled for the height of the bar
tuple of QtCore.QPointF
getBarCoordinates(self, option, index)
Returns the coordinates for the bar to be drawn in the element at the specified index
basestr @return The text representation of the value or an empty string if None
_getSelectionText(self, index)
Return the selection text
 
_paintWithBrush(self, painter, option, index, background_brush)
Paint a bar with the specified painter in the location specified by option that matches the data at the specified index in the model
 
_paintSelection(self, painter, option, index)
We want the selection painted in the default way, but without colors
 
_paintDefault(self, painter, option, index)
Paints the default (non-selected) cell using the specified painter, option, and index

Inherited from DoubleElementHeightDelegate: __init__, sizeHint

Inherited from BaseRowDelegate: clearCache, helpEvent, initStyleOption, paint

Inherited from BaseRowDelegate (private): _getText

Inherited from PyQt4.QtGui.QStyledItemDelegate: createEditor, displayText, editorEvent, eventFilter, itemEditorFactory, setEditorData, setItemEditorFactory, setModelData, updateEditorGeometry

Inherited from PyQt4.QtGui.QAbstractItemDelegate: closeEditor, commitData, elidedText, sizeHintChanged

Inherited from PyQt4.QtCore.QObject: __getattr__, blockSignals, childEvent, children, connect, connectNotify, customEvent, deleteLater, destroyed, disconnect, disconnectNotify, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, emit, event, findChild, findChildren, inherits, installEventFilter, isWidgetType, killTimer, metaObject, moveToThread, objectName, parent, property, pyqtConfigure, receivers, removeEventFilter, sender, senderSignalIndex, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent, tr, trUtf8

Inherited from sip.simplewrapper: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from BaseRowDelegate: ANNOTATION_TYPE

Inherited from PyQt4.QtGui.QAbstractItemDelegate: EditNextItem, EditPreviousItem, NoHint, RevertModelCache, SubmitModelCache

Inherited from PyQt4.QtCore.QObject: staticMetaObject

Properties [hide private]

Inherited from DoubleElementHeightDelegate: element_height

Inherited from object: __class__

Method Details [hide private]

_getScalingFactor(self, min_val, max_val)

 

Get a scaling factor to adjust a data value by.

Parameters:
  • min_val (float) - Minimum value
  • max_val (float) - Max value
Returns: float
Scaling factor

getScaledValue(self, index)

 

Return the value scaled for the height of the bar

The value will be 0 if the data is None or if the range is None or 0.

Parameters:
  • index (QtCore.QModelIndex) - The index in the model
Returns: float
The value scaled appropriately to the full height of the bar

getBarCoordinates(self, option, index)

 

Returns the coordinates for the bar to be drawn in the element at the specified index

Parameters:
  • option (QtWidgets.QStyleOptionViewItem) - The option to modify with cached information
  • index (QtCore.QModelIndex) - The index in the model
Returns: tuple of QtCore.QPointF
The top left and bottom right coordinates of the bar

_getSelectionText(self, index)

 

Return the selection text

Subclasses can override this for custom selection behavior

Parameters:
  • index - The index in the model
Returns: basestr @return The text representation of the value or an empty string if None
Overrides: BaseRowDelegate._getSelectionText
(inherited documentation)

_paintWithBrush(self, painter, option, index, background_brush)

 

Paint a bar with the specified painter in the location specified by option that matches the data at the specified index in the model

If the data at the index cannot be converted to a bar, the parent's paint method is called

Parameters:
  • option (QtWidgets.QStyleOptionViewItem) - The option to modify with cached information
  • index (QtCore.QModelIndex) - The index in the model
  • background_brush (QtGui.QBrush) - The brush to use

_paintSelection(self, painter, option, index)

 

We want the selection painted in the default way, but without colors

Parameters:
  • painter - The painter for the cell
  • option - The option for the cell
  • index - The index in the table
Overrides: BaseRowDelegate._paintSelection

_paintDefault(self, painter, option, index)

 

Paints the default (non-selected) cell using the specified painter, option, and index

Note: This method is overridden in subclasses and should not be merged into paint().

Parameters:
  • painter - The painter for the cell
  • option - The option for the cell
  • index - The index in the table
  • selection_brush - The brush to use in painting
Overrides: BaseRowDelegate._paintDefault
(inherited documentation)