summaryrefslogtreecommitdiffstats
path: root/tests/manual/wasm/a11y/basic_widgets/tabswidget.cpp
blob: 63428c965ab24478f015289580b532b298161659 (plain)
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
58
59
60
61
62
63
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "tabswidget.h"

GeneralTab::GeneralTab(QWidget *parent)
    : QWidget(parent)
{
    QVBoxLayout *layout = new QVBoxLayout();
    layout->setSizeConstraint(QLayout::SetMaximumSize);

    layout->addWidget(new QLabel("This is a text label"));

    QPushButton *btn = new QPushButton("This is a push button");
    layout->addWidget(btn);
    connect(btn, &QPushButton::released, this, [=] () {
        btn->setText("You clicked me");
    });

    layout->addWidget(new QCheckBox("This is a check box"));

    layout->addWidget(new QRadioButton("Radio 1"));
    layout->addWidget(new QRadioButton("Radio 2"));

    QSlider *slider = new QSlider(Qt::Horizontal);
    slider->setTickInterval(10);
    slider->setTickPosition(QSlider::TicksAbove);
    layout->addWidget(slider);

    QSpinBox *spin = new QSpinBox();
    spin->setValue(10);
    spin->setSingleStep(1);
    layout->addWidget(spin);
    layout->addStretch();

    QScrollBar *scrollBar = new QScrollBar(Qt::Horizontal);
    scrollBar->setFocusPolicy(Qt::StrongFocus);
    layout->addWidget(scrollBar);

    setLayout(layout);
}


EditViewTab::EditViewTab(QWidget *parent) :
    QWidget(parent)
{
    QVBoxLayout *layout = new QVBoxLayout();
    layout->setSizeConstraint(QLayout::SetMaximumSize);
    textEdit = new QPlainTextEdit();
    textEdit->setPlaceholderText("Enter Text here");
    layout->addWidget(textEdit);
    setLayout(layout);

}

void EditViewTab::showEvent( QShowEvent* event ) {
  if (!b_connected)
  {
    emit connectToToolBar();
    b_connected=true;
  }
  QWidget::showEvent( event );
}