Без опису

12345678910111213141516171819202122232425262728293031323334
  1. // RAN [2014-06-03]
  2. // - Set initial size of the window to 1000,1000. Adjust the
  3. // mainView and scene accordingly.
  4. #include "mainwindow.h"
  5. #include "ui_mainwindow.h"
  6. MainWindow::MainWindow(QWidget *parent) :
  7. QMainWindow(parent),
  8. ui(new Ui::MainWindow)
  9. {
  10. ui->setupUi(this);
  11. resize(1000,1000);
  12. scene = new QGraphicsScene(this) ;
  13. ui->mainView->resize(width()*.95,height()*.95);
  14. scene->setSceneRect(QRectF(QPoint(0,0), QPoint(width()*.95,height()*.95))) ;
  15. ui->mainView->setScene(scene) ;
  16. ui->mainView->setAlignment((Qt::AlignLeft | Qt::AlignTop));
  17. }
  18. MainWindow::~MainWindow()
  19. {
  20. delete ui;
  21. delete scene;
  22. }
  23. void MainWindow::addBird(int x, int y, Bird &b){
  24. scene->addWidget(&b) ;
  25. b.move(x,y) ;
  26. }
  27. void MainWindow::addBird(Bird &b){
  28. scene->addWidget(&b) ;
  29. }