KWidgetsAddons

ksplittercollapserbutton.h
1/*
2 SPDX-FileCopyrightText: 2014 Montel Laurent <montel@kde.org>
3 based on code:
4 SPDX-FileCopyrightText: 2009 Aurélien Gâteau <agateau@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8#ifndef KSPLITTERCOLLAPSERBUTTON_H
9#define KSPLITTERCOLLAPSERBUTTON_H
10
11// Qt
12#include <QToolButton>
13#include <kwidgetsaddons_export.h>
14#include <memory>
15
16class QSplitter;
17
18/**
19 * @class KSplitterCollapserButton ksplittercollapserbutton.h KSplitterCollapserButton
20 *
21 * A button which appears on the side of a splitter handle and allows easy
22 * collapsing of the widget on the opposite side
23 * @since 5.5
24 */
25class KWIDGETSADDONS_EXPORT KSplitterCollapserButton : public QToolButton
26{
27 Q_OBJECT
28public:
29 /**
30 * @brief KSplitterCollapserButton create a splitter collapser
31 * @param childWidget the widget, child of the splitter, whose size is controlled by this collapser
32 * @param splitter the splitter which this collapser should be associated with.
33 */
34 explicit KSplitterCollapserButton(QWidget *childWidget, QSplitter *splitter);
35
36 /**
37 * Destructor
38 */
40
41 /**
42 * @brief isWidgetCollapsed
43 * @return true if splitter is collapsed.
44 */
45 bool isWidgetCollapsed() const;
46
47 QSize sizeHint() const override;
48
49public Q_SLOTS:
50 /**
51 * @brief collapse, this function collapses the splitter if splitter is not collapsed.
52 */
53 void collapse();
54 /**
55 * @brief restore, call this function to restore previous splitter position.
56 */
57 void restore();
58 /**
59 * @brief setCollapsed, this function allows to collapse or not the splitter.
60 * @param collapsed if the splitter should be collapsed
61 */
62 void setCollapsed(bool collapsed);
63
64private Q_SLOTS:
65 KWIDGETSADDONS_NO_EXPORT void slotClicked();
66
67protected:
68 bool eventFilter(QObject *, QEvent *) override;
69 void paintEvent(QPaintEvent *) override;
70 void enterEvent(QEnterEvent *event) override;
71 void leaveEvent(QEvent *event) override;
72 void showEvent(QShowEvent *event) override;
73
74private:
75 std::unique_ptr<class KSplitterCollapserButtonPrivate> const d;
76};
77
78#endif /* KSPLITTERCOLLAPSERBUTTON_H */
A button which appears on the side of a splitter handle and allows easy collapsing of the widget on t...
~KSplitterCollapserButton() override
Destructor.
Q_SLOTSQ_SLOTS
virtual bool eventFilter(QObject *watched, QEvent *event)
virtual void enterEvent(QEnterEvent *e) override
virtual void leaveEvent(QEvent *e) override
virtual void paintEvent(QPaintEvent *event) override
virtual QSize sizeHint() const const override
virtual void showEvent(QShowEvent *event)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.