Debian Codegraph @

tests/manual/wasm/a11y/basic_widgets/tabswidget.cpp

raw
1 // Copyright (C) 2021 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #include "tabswidget.h"
5
6 GeneralTab::GeneralTab(QWidget *parent)
7 : QWidget(parent)
8 {
9 QVBoxLayout *layout = new QVBoxLayout();
10 layout->setSizeConstraint(QLayout::SetMaximumSize);
11
12 layout->addWidget(new QLabel("This is a text label"));
13
14 QPushButton *btn = new QPushButton("This is a push button");
15 layout->addWidget(btn);
16 connect(btn, &QPushButton::released, this, [=] () {
17 btn->setText("You clicked me");
18 });
19
20 layout->addWidget(new QCheckBox("This is a check box"));
21
22 layout->addWidget(new QRadioButton("Radio 1"));
23 layout->addWidget(new QRadioButton("Radio 2"));
24
25 QSlider *slider = new QSlider(Qt::Horizontal);
26 slider->setTickInterval(10);
27 slider->setTickPosition(QSlider::TicksAbove);
28 layout->addWidget(slider);
29
30 QSpinBox *spin = new QSpinBox();
31 spin->setValue(10);
32 spin->setSingleStep(1);
33 layout->addWidget(spin);
34 layout->addStretch();
35
36 QScrollBar *scrollBar = new QScrollBar(Qt::Horizontal);
37 scrollBar->setFocusPolicy(Qt::StrongFocus);
38 layout->addWidget(scrollBar);
39
40 setLayout(layout);
41 }
42
43
44 EditViewTab::EditViewTab(QWidget *parent) :
45 QWidget(parent)
46 {
47 QVBoxLayout *layout = new QVBoxLayout();
48 layout->setSizeConstraint(QLayout::SetMaximumSize);
49 textEdit = new QPlainTextEdit();
50 textEdit->setPlaceholderText("Enter Text here");
51 layout->addWidget(textEdit);
52 setLayout(layout);
53
54 }
55
56 void EditViewTab::showEvent( QShowEvent* event ) {
57 if (!b_connected)
58 {
59 emit connectToToolBar();
60 b_connected=true;
61 }
62 QWidget::showEvent( event );
63 }