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.
Code:
#include <QtGui/QApplication> #include "mainwindow.h" int main(int argc, char *argv[]) { MainWindow w; w.show(); return a.exec(); }
Code:
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QGraphicsView> #include <QGraphicsScene> #include <QBrush> namespace Ui { class MainWindow; } Q_OBJECT public: ~MainWindow(); protected: private: Ui::MainWindow *ui; };
Code:
#include "mainwindow.h" #include "ui_mainwindow.h" ui(new Ui::MainWindow) { ui->setupUi(this); scene->setBackgroundBrush(Qt::red); view->setScene(scene); } MainWindow::~MainWindow() { delete ui; } { switch (e->type()) { ui->retranslateUi(this); break; default: break; } }
I'm insering the image also.Attachment 9859