X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/8e55f2c2409fd6ca9ebc66a6568f4d3bcbef7576..9f233850beb60168e8773623e0b5ae052c5287e9:/src/selectionmode/topbar.h diff --git a/src/selectionmode/topbar.h b/src/selectionmode/topbar.h index e0cd34935..760c3da63 100644 --- a/src/selectionmode/topbar.h +++ b/src/selectionmode/topbar.h @@ -1,6 +1,6 @@ /* This file is part of the KDE project - SPDX-FileCopyrightText: 2022 Felix Ernst + SPDX-FileCopyrightText: 2022 Felix Ernst SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ @@ -8,18 +8,12 @@ #ifndef SELECTIONMODETOPBAR_H #define SELECTIONMODETOPBAR_H -#include "global.h" +#include "animatedheightwidget.h" -#include -#include -#include -#include - -class QHideEvent; +class KContextualHelpButton; class QLabel; class QPushButton; class QResizeEvent; -class QShowEvent; namespace SelectionMode { @@ -27,33 +21,33 @@ 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); - using QWidget::setVisible; // Makes sure that the setVisible() declaration above doesn't hide the one from QWidget. - Q_SIGNALS: - void leaveSelectionModeRequested(); + void selectionModeLeavingRequested(); protected: - void resizeEvent(QResizeEvent */* resizeEvent */) override; + /** Calls updateLabelString() */ + void resizeEvent(QResizeEvent *resizeEvent) override; private: /** 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; + KContextualHelpButton *m_contextualHelpButton; QPushButton *m_closeButton; /** @see updateLabelString() */ @@ -62,8 +56,6 @@ private: QString m_shortLabelString; int m_preferredHeight; - - QPointer m_heightAnimation; }; }