Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 18th, 2010  |  syntax: C++  |  size: 0.77 KB  |  views: 79  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include "mainwindow.h"
  2. #include <QPushButton>
  3. #include <QDebug>
  4.  
  5. MainWindow::MainWindow(QWidget *parent): QMainWindow(parent)
  6.    {
  7.       Stack = new QStackedWidget;
  8.       Stack->addWidget(new QPushButton("qweqweqwe"));
  9.       Stack->addWidget(new QPushButton("asdasdasd"));
  10.  
  11.       Timer.singleShot(2000, this, SLOT(on_Timer_timeout()));
  12.  
  13.       setCentralWidget(Stack);
  14.    }
  15. void MainWindow::showEvent(QShowEvent *e)
  16.    {
  17.       Q_UNUSED(e);
  18.       qDebug() << "MainWindow::showEvent: Geometry of second button before show" << Stack->widget(1)->geometry();
  19.    }
  20. void MainWindow::on_Timer_timeout()
  21.    {
  22.       Stack->setCurrentIndex(1);
  23.       qDebug() << "MainWindow::on_Timer_timeout(): Geometry of second button after show" << Stack->currentWidget()->geometry();
  24.    }