crazyFlyZoneTab.cpp 1.02 KB
Newer Older
1
2
3
4
5
6
7
8
#include <crazyFlyZoneTab.h>

#include <QLayout>

crazyFlyZoneTab::crazyFlyZoneTab(int index, QWidget *parent)
    : QWidget(parent)
{
    _index = index;
roangel's avatar
roangel committed
9
10
    _num_rows = 3;
    _num_columns = 3;
11
    center_button = new QPushButton("Fit view");
roangel's avatar
roangel committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    QGridLayout *mainLayout = new QGridLayout;
    // mainLayout->setRowMinimumHeight(1, 25);
    // mainLayout->setRowMinimumHeight(2, 25);
    // mainLayout->setRowStretch(1);
    // mainLayout->setColumnMinimumWidth(5);
    for(int i = 0; i < _num_rows; i++)
    {
        mainLayout->setRowStretch(i, 1);
    }

    for(int i = 0; i < _num_columns; i++)
    {
        mainLayout->setColumnStretch(i, 1);
    }

    mainLayout->addWidget(center_button, _num_rows - 1, _num_columns - 1);
28
29
30
31
32
33
34
35
36
37
    setLayout(mainLayout);
    QObject::connect(center_button, SIGNAL(clicked()), this, SLOT(centerButtonClicked()));
    qDebug("tab widget created, index: %d", _index);
}

void crazyFlyZoneTab::centerButtonClicked()
{
    qDebug("index clicked: %d", _index);
    emit centerButtonClickedSignal(_index);
}