diff options
| author | Peter Penz <[email protected]> | 2008-02-02 20:53:35 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-02-02 20:53:35 +0000 |
| commit | a50c7b6bd1a924425a1f165e3b910209f005b35a (patch) | |
| tree | aaac2b4f6f75b81cfe24245dcab70c4dda4b9f38 /src/selectiontoggle.h | |
| parent | a3003c2c94e34abefe1974633aa7c22734202cf6 (diff) | |
Improve the selection toggle: Instead of a delay of one second until appearing, let it appear immediately but provide a smooth fade-in effect. This makes it usable from the start but is less obtrusive for the eyes.
svn path=/trunk/KDE/kdebase/apps/; revision=770115
Diffstat (limited to 'src/selectiontoggle.h')
| -rw-r--r-- | src/selectiontoggle.h | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/selectiontoggle.h b/src/selectiontoggle.h index 5815c5dae..653104ab5 100644 --- a/src/selectiontoggle.h +++ b/src/selectiontoggle.h @@ -20,12 +20,19 @@ #ifndef SELECTIONTOGGLE_H #define SELECTIONTOGGLE_H +#include <kfileitem.h> + #include <QAbstractButton> #include <QPixmap> -#include <QTimer> + +class QTimeLine; /** * @brief Toggle button for changing the selection of an hovered item. + * + * The toggle button is visually invisible until it is displayed at least + * for one second. + * * @see SelectionManager */ class SelectionToggle : public QAbstractButton @@ -37,6 +44,15 @@ public: virtual ~SelectionToggle(); virtual QSize sizeHint() const; + /** + * Resets the selection toggle so that it is hidden and stays + * visually invisible for at least one second after it is shown again. + */ + void reset(); + + void setFileItem(const KFileItem& item); + KFileItem fileItem() const; + public slots: virtual void setVisible(bool visible); @@ -47,13 +63,22 @@ protected: virtual void paintEvent(QPaintEvent* event); private slots: - void showIcon(); + /** + * Sets the alpha value for the fading animation and is + * connected with m_fadingTimeLine. + */ + void setFadingValue(int value); + +private: + void startFading(); + void stopFading(); private: - bool m_showIcon; bool m_isHovered; + int m_fadingValue; QPixmap m_icon; - QTimer* m_timer; + QTimeLine* m_fadingTimeLine; + KFileItem m_item; }; #endif |
