Hi to all..I'm creating a application,object QMainWindow. I have created application.in UI form I have dragged QGraphicsView. I have created Graphic scene also. I'm posting the code.i'm able to get scene but it by deafult coming at topleft corner. other than coming inside QGraphicsView.suggest me,where I might have gone wrong.
Qt Code:
  1. #include <QtGui/QApplication>
  2. #include "mainwindow.h"
  3. int main(int argc, char *argv[])
  4. {
  5. QApplication a(argc, argv);
  6. MainWindow w;
  7. w.show();
  8. return a.exec();
  9. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5. #include <QGraphicsView>
  6. #include <QGraphicsScene>
  7. #include <QBrush>
  8.  
  9.  
  10. namespace Ui {
  11. class MainWindow;
  12. }
  13.  
  14. class MainWindow : public QMainWindow {
  15. Q_OBJECT
  16. public:
  17. MainWindow(QWidget *parent = 0);
  18. ~MainWindow();
  19.  
  20. protected:
  21. void changeEvent(QEvent *e);
  22.  
  23. private:
  24. Ui::MainWindow *ui;
  25. };
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3.  
  4. MainWindow::MainWindow(QWidget *parent) :
  5. QMainWindow(parent),
  6. ui(new Ui::MainWindow)
  7. {
  8. ui->setupUi(this);
  9.  
  10. QGraphicsView *view = new QGraphicsView(this);
  11. scene->setBackgroundBrush(Qt::red);
  12. view->setScene(scene);
  13. }
  14.  
  15. MainWindow::~MainWindow()
  16. {
  17. delete ui;
  18. }
  19.  
  20. void MainWindow::changeEvent(QEvent *e)
  21. {
  22. QMainWindow::changeEvent(e);
  23. switch (e->type()) {
  24. case QEvent::LanguageChange:
  25. ui->retranslateUi(this);
  26. break;
  27. default:
  28. break;
  29. }
  30. }
To copy to clipboard, switch view to plain text mode 

I'm insering the image also.image.png