File: slidecontainer_gui.cpp

package info (click to toggle)
ktextaddons 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,360 kB
  • sloc: cpp: 54,647; ansic: 6,591; xml: 2,630; sh: 11; makefile: 7
file content (57 lines) | stat: -rw-r--r-- 1,444 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
code based on source from Gwenview
SPDX-FileCopyrightText: 2007 Aurélien Gâteau <agateau@kde.org>

SPDX-License-Identifier: LGPL-2.0-or-later

*/
// Qt
#include <QApplication>
using namespace Qt::Literals::StringLiterals;

#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>

#include <TextAddonsWidgets/SlideContainer>

using namespace TextAddonsWidgets;

class Window : public QWidget
{
    Q_OBJECT
public:
    explicit Window(QWidget *parent = nullptr)
        : QWidget(parent)
    {
        auto container = new SlideContainer(this);

        auto inButton = new QPushButton(this);
        inButton->setText(u"Slide &In"_s);
        connect(inButton, &QPushButton::clicked, container, &SlideContainer::slideIn);

        auto outButton = new QPushButton(this);
        outButton->setText(u"Slide &Out"_s);
        connect(outButton, &QPushButton::clicked, container, &SlideContainer::slideOut);

        auto layout = new QVBoxLayout(this);
        layout->addWidget(inButton);
        layout->addWidget(outButton);
        layout->addWidget(container);

        auto content = new QLineEdit(container);
        content->setText(u"Some long text. Some long text. Some long text. Some long text."_s);
        container->setContent(content);
    }
};

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Window window;

    window.show();
    return app.exec();
}

#include "slidecontainer_gui.moc"