2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2024 Felix Ernst <felixernst@kde.org>
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
11 #include "animatedheightwidget.h"
22 * @brief A bar appearing above the view while the user is acting with administrative privileges.
24 * It contains a warning and allows revoking this administrative mode by closing this bar.
26 class Bar
: public AnimatedHeightWidget
31 explicit Bar(QWidget
*parent
);
33 /** Used to recolor this bar when this application's color scheme changes. */
34 bool event(QEvent
*event
) override
;
40 /** Calls updateLabelString() */
41 void resizeEvent(QResizeEvent
*resizeEvent
) override
;
44 /** Recolors this bar based on the current color scheme. */
47 /** Decides whether the m_fullLabelString or m_shortLabelString should be used based on available width. */
48 void updateLabelString();
50 /** @see AnimatedHeightWidget::preferredHeight() */
51 inline int preferredHeight() const override
53 return m_preferredHeight
;
57 /** The text on this bar */
58 QLabel
*m_label
= nullptr;
59 /** Shows a warning about the dangers of acting with administrative privileges. */
60 QToolButton
*m_warningButton
= nullptr;
61 /** Closes this bar and exits the administrative mode. */
62 QPushButton
*m_closeButton
= nullptr;
64 /** @see updateLabelString() */
65 QString m_fullLabelString
;
66 /** @see updateLabelString() */
67 QString m_shortLabelString
;
69 /** @see preferredHeight() */
70 int m_preferredHeight
;