X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/95542a389112491abf3a31c338e7d78f7785f48e..c1e71289082ec7416ac19c822393ea70f63d1b75:/src/kitemviews/kitemlistwidget.h diff --git a/src/kitemviews/kitemlistwidget.h b/src/kitemviews/kitemlistwidget.h index e254292c0..b87a3b34e 100644 --- a/src/kitemviews/kitemlistwidget.h +++ b/src/kitemviews/kitemlistwidget.h @@ -52,8 +52,6 @@ class DOLPHIN_EXPORT KItemListWidget : public QGraphicsWidget { Q_OBJECT - Q_PROPERTY(int iconSize READ iconSize WRITE setIconSize) - public: KItemListWidget(KItemListWidgetInformant *informant, QGraphicsItem *parent); ~KItemListWidget() override; @@ -63,6 +61,7 @@ public: void setData(const QHash &data, const QSet &roles = QSet()); QHash data() const; + QVariant value(const QByteArray &key) const; /** * Draws the hover-rectangle if the item is hovered. Overwrite this method @@ -99,6 +98,10 @@ public: void setHovered(bool hovered); bool isHovered() const; + /** Sets a purely visual pressed highlight effect. */ + void setPressed(bool enabled); + bool isPressed() const; + void setExpansionAreaHovered(bool hover); bool expansionAreaHovered() const; @@ -138,18 +141,13 @@ public: int iconSize() const; /** - * @return True if \a point is inside KItemListWidget::hoverRect(), - * KItemListWidget::textRect(), KItemListWidget::selectionToggleRect() + * @return True if \a point is inside KItemListWidget::selectionRectFull(), + * KItemListWidget::selectionToggleRect() * or KItemListWidget::expansionToggleRect(). * @reimp */ bool contains(const QPointF &point) const override; - /** - * @return Rectangle for the area that shows the icon. - */ - virtual QRectF iconRect() const = 0; - /** * @return Rectangle for the area that contains the text-properties. */ @@ -165,9 +163,17 @@ public: virtual QRectF textFocusRect() const; /** - * @return Rectangle around which a selection box should be drawn if the item is selected. + * Used for drawing the visuals, and situations where we want the behavior of the + * selection to match the visuals. + * + * @return The rectangle around selection. */ - virtual QRectF selectionRect() const = 0; + virtual QRectF selectionRectFull() const = 0; + + /** + * @return The core area of the item. All of it reacts exactly the same way to mouse clicks. + */ + virtual QRectF selectionRectCore() const = 0; /** * @return Rectangle for the selection-toggle that is used to select or deselect an item. @@ -251,8 +257,6 @@ private: void drawItemStyleOption(QPainter *painter, QWidget *widget, QStyle::State styleState); private: - Q_PROPERTY(qreal hoverOpacity READ hoverOpacity WRITE setHoverOpacity) - KItemListWidgetInformant *m_informant; int m_index; bool m_selected; @@ -261,6 +265,7 @@ private: bool m_expansionAreaHovered; bool m_alternateBackground; bool m_enabledSelectionToggle; + bool m_clickHighlighted; QHash m_data; QList m_visibleRoles; QHash m_columnWidths;