KTextAddons

slidecontainer.h
1/*
2Gwenview: an image viewer
3SPDX-FileCopyrightText: 2007 Aurélien Gâteau <agateau@kde.org>
4
5SPDX-License-Identifier: GPL-2.0-or-later
6
7*/
8#pragma once
9
10// Qt
11#include <QFrame>
12#include <QPointer>
13
14#include "textaddonswidgets_export.h"
15
17
18namespace TextAddonsWidgets
19{
20/**
21 * This widget is design to contain one child widget, the "content" widget.
22 * It will start hidden by default. Calling slideIn() will slide in the content
23 * widget from the top border. Calling slideOut() will slide it out.
24 */
25class TEXTADDONSWIDGETS_EXPORT SlideContainer : public QFrame
26{
27 Q_OBJECT
28 Q_PROPERTY(int slideHeight READ slideHeight WRITE setSlideHeight)
29public:
30 explicit SlideContainer(QWidget *parent = nullptr);
31
32 /**
33 * Returns the content widget
34 */
35 QWidget *content() const;
36
37 /**
38 * Defines the content widget
39 */
40 void setContent(QWidget *content);
41
42 QSize sizeHint() const override;
43 QSize minimumSizeHint() const override;
44
45 [[nodiscard]] int slideHeight() const;
46
47 Q_INVOKABLE void setSlideHeight(int height);
48
49public Q_SLOTS:
50 /**
51 * Slides the content widget in.
52 * Calling it multiple times won't cause the animation to be replayed.
53 */
54 void slideIn();
55
56 /**
57 * Slides the content widget out.
58 * Calling it multiple times won't cause the animation to be replayed.
59 */
60 void slideOut();
61
62Q_SIGNALS:
63 void slidedIn();
64 void slidedOut();
65
66protected:
67 void resizeEvent(QResizeEvent *) override;
68 bool eventFilter(QObject *, QEvent *event) override;
69
70private:
71 TEXTADDONSWIDGETS_NO_EXPORT void slotAnimFinished();
72 TEXTADDONSWIDGETS_NO_EXPORT void adjustContentGeometry();
73
74 TEXTADDONSWIDGETS_NO_EXPORT void animTo(int height);
75 QPointer<QWidget> mContent;
77 bool mSlidingOut = false;
78};
79} /* namespace */
This widget is design to contain one child widget, the "content" widget.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.