2017-08-03 01:18:21 +03:00
|
|
|
#include "pagewithbackbutton.h"
|
2017-08-20 05:22:30 +03:00
|
|
|
#include "QVBoxLayout"
|
|
|
|
#include "QHBoxLayout"
|
|
|
|
#include "QPushButton"
|
2017-08-03 01:18:21 +03:00
|
|
|
|
2017-08-20 05:22:30 +03:00
|
|
|
PageWithBackButton::PageWithBackButton(QWidget *parent, QWidget* child) : QWidget(parent)
|
2017-08-03 01:18:21 +03:00
|
|
|
{
|
2017-08-20 05:22:30 +03:00
|
|
|
QVBoxLayout * layout = new QVBoxLayout();
|
|
|
|
setLayout(layout);
|
|
|
|
QWidget * topBar = new QWidget();
|
|
|
|
QHBoxLayout * topBarLayout = new QHBoxLayout();
|
|
|
|
topBar->setLayout(topBarLayout);
|
|
|
|
layout->addWidget(topBar);
|
|
|
|
layout->addWidget(child);
|
2017-08-03 01:18:21 +03:00
|
|
|
|
2017-08-20 05:22:30 +03:00
|
|
|
QPushButton * backButton = new QPushButton(topBar);
|
|
|
|
backButton->setText("< Back");
|
|
|
|
topBarLayout->addWidget(backButton);
|
|
|
|
connect(backButton, SIGNAL(released()), this, SLOT(backReleasedSlot()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void PageWithBackButton::backReleasedSlot() {
|
|
|
|
emit backReleased();
|
2017-08-03 01:18:21 +03:00
|
|
|
}
|