]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/selectionmode/topbar.h
Merge remote-tracking branch 'upstream/master' into work/zakharafoniam/useful-groups
[dolphin.git] / src / selectionmode / topbar.h
index 028fc49855baae6d924f6e5d23c476dd4fa9ba88..1f9cfdb18ae59d6ac20d9f395fd9e55c4f024f5c 100644 (file)
@@ -8,17 +8,11 @@
 #ifndef SELECTIONMODETOPBAR_H
 #define SELECTIONMODETOPBAR_H
 
-#include "global.h"
+#include "animatedheightwidget.h"
 
-#include <QPointer>
-#include <QPropertyAnimation>
-#include <QWidget>
-
-class QHideEvent;
 class QLabel;
 class QPushButton;
 class QResizeEvent;
-class QShowEvent;
 
 namespace SelectionMode
 {
@@ -26,20 +20,13 @@ namespace SelectionMode
 /**
  * @brief A bar appearing at the top of the view when in selection mode to make users aware of the selection mode state of the application.
  */
-class TopBar : public QWidget
+class TopBar : public AnimatedHeightWidget
 {
     Q_OBJECT
 
 public:
     TopBar(QWidget *parent);
 
-    /**
-     * Plays a show or hide animation while changing visibility.
-     * Therefore, if this method is used to hide this widget, the actual hiding will be postponed until the animation finished.
-     * @see QWidget::setVisible()
-     */
-    void setVisible(bool visible, Animated animated);
-
 Q_SIGNALS:
     void selectionModeLeavingRequested();
 
@@ -48,11 +35,15 @@ protected:
     void resizeEvent(QResizeEvent *resizeEvent) override;
 
 private:
-    using QWidget::setVisible; // Makes sure that the setVisible() declaration above doesn't hide the one from QWidget so we can still use it privately.
-
     /** Decides whether the m_fullLabelString or m_shortLabelString should be used based on available width. */
     void updateLabelString();
 
+    /** @see AnimatedHeightWidget::preferredHeight() */
+    inline int preferredHeight() const override
+    {
+        return m_preferredHeight;
+    };
+
 private:
     QLabel *m_label;
     QPushButton *m_closeButton;
@@ -63,8 +54,6 @@ private:
     QString m_shortLabelString;
 
     int m_preferredHeight;
-
-    QPointer<QPropertyAnimation> m_heightAnimation;
 };
 
 }