1
/****************************************************************************
3
** Copyright (C) 2016 The Qt Company Ltd.
4
** Contact: https://www.qt.io/licensing/
6
** This file is part of the test suite module of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and The Qt Company. For licensing terms
14
** and conditions see https://www.qt.io/terms-conditions. For further
15
** information use the contact form at https://www.qt.io/contact-us.
17
** GNU General Public License Usage
18
** Alternatively, this file may be used under the terms of the GNU
19
** General Public License version 3 as published by the Free Software
20
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21
** included in the packaging of this file. Please review the following
22
** information to ensure the GNU General Public License requirements will
23
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
27
****************************************************************************/
29
#include <QApplication>
30
#include <QPushButton>
31
#include <QPlainTextEdit>
32
#include <QCalendarWidget>
33
#include <QVBoxLayout>
35
class Widget : public QWidget
41
QWidget *stackWidget = new QWidget;
42
stackWidget->setFixedSize(400, 300);
43
button = new QPushButton("pushbutton", stackWidget);
44
plainTextEdit = new QPlainTextEdit(stackWidget);
45
plainTextEdit->setWordWrapMode(QTextOption::NoWrap);
46
QString s = "foo bar bar foo foo bar bar foo";
47
for (int i = 0; i < 10; ++i) {
48
plainTextEdit->appendPlainText(s);
51
calendar = new QCalendarWidget(stackWidget);
53
button->resize(100, 100);
54
plainTextEdit->move(30, 70);
55
plainTextEdit->resize(100, 100);
56
calendar->move(80, 40);
58
QWidget *buttonOps = new QWidget;
59
QVBoxLayout *l = new QVBoxLayout(buttonOps);
60
QPushButton *lower = new QPushButton("button: lower");
61
connect(lower, SIGNAL(clicked()), button, SLOT(lower()));
63
QPushButton *raise = new QPushButton("button: raise");
64
connect(raise, SIGNAL(clicked()), button, SLOT(raise()));
67
lower = new QPushButton("calendar: lower");
68
connect(lower, SIGNAL(clicked()), calendar, SLOT(lower()));
70
raise = new QPushButton("calendar: raise");
71
connect(raise, SIGNAL(clicked()), calendar, SLOT(raise()));
73
QPushButton *stackUnder = new QPushButton("calendar: stack under textedit");
74
connect(stackUnder, SIGNAL(clicked()), this, SLOT(stackCalendarUnderTextEdit()));
75
l->addWidget(stackUnder);
77
lower = new QPushButton("lower textedit");
78
connect(lower, SIGNAL(clicked()), plainTextEdit, SLOT(lower()));
80
raise = new QPushButton("raise textedit");
81
connect(raise, SIGNAL(clicked()), plainTextEdit, SLOT(raise()));
84
QHBoxLayout *mainLayout = new QHBoxLayout(this);
85
mainLayout->addWidget(buttonOps);
86
mainLayout->addWidget(stackWidget);
90
void stackCalendarUnderTextEdit()
92
calendar->stackUnder(plainTextEdit);
97
QPlainTextEdit *plainTextEdit;
98
QCalendarWidget *calendar;
101
int main(int argc, char **argv)
103
QApplication app(argc, argv);