Add hover and click support to PartitionBarsView.

This commit is contained in:
Teo Mrnjavac 2015-12-04 18:02:19 +01:00
parent a9e241d288
commit cc5520edda
2 changed files with 135 additions and 18 deletions

View file

@ -54,11 +54,24 @@ protected:
QModelIndex moveCursor( CursorAction cursorAction, Qt::KeyboardModifiers modifiers ) override;
void setSelection( const QRect& rect, QItemSelectionModel::SelectionFlags flags ) override;
void mouseMoveEvent( QMouseEvent* event ) override;
void leaveEvent( QEvent* event ) override;
protected slots:
void updateGeometries() override;
private:
void drawPartitions( QPainter* painter, const QRect& rect, const QModelIndex& parent );
void drawSection( QPainter* painter, const QRect& rect_, int x, int width, const QModelIndex& index );
QModelIndex indexAt( const QPoint& point, const QRect& rect, const QModelIndex& parent ) const;
struct Item
{
qreal size;
QModelIndex index;
};
inline QPair< QVector< Item >, qreal > computeItemsVector( const QModelIndex& parent ) const;
int m_hoveredRow;
};
#endif /* PARTITIONPREVIEW_H */