pagewithbackbutton.cpp 737 B

12345678910111213141516171819202122232425
  1. #include "pagewithbackbutton.h"
  2. #include "QVBoxLayout"
  3. #include "QHBoxLayout"
  4. #include "QPushButton"
  5. PageWithBackButton::PageWithBackButton(QWidget *parent, QWidget* child) : QWidget(parent)
  6. {
  7. QVBoxLayout * layout = new QVBoxLayout();
  8. setLayout(layout);
  9. QWidget * topBar = new QWidget();
  10. QHBoxLayout * topBarLayout = new QHBoxLayout();
  11. topBar->setLayout(topBarLayout);
  12. layout->addWidget(topBar);
  13. layout->addWidget(child);
  14. QPushButton * backButton = new QPushButton(topBar);
  15. backButton->setText("< Back");
  16. topBarLayout->addWidget(backButton);
  17. connect(backButton, SIGNAL(released()), this, SLOT(backReleasedSlot()));
  18. }
  19. void PageWithBackButton::backReleasedSlot() {
  20. emit backReleased();
  21. }