PDA

View Full Version : New user of QT



alvarovac
1st March 2010, 13:31
Hi,

I am a very new user of Qt, I've just downloaded QT Creator and did this simple form to test what QT was about:

http://usamutt.com/alvarovac/test1.jpg

It is a simple form, with a window and a GraphicsView in it ...

I have been checking the souce files, I cannot see that GraphicsView anywhere.

How can I rewrite the paint mathod of that object ???

I am used to work with Visual Basic, and it's surprising for me I cannot access through the IDE to the paint method or any other method of that object ...
Thanks.

navid
1st March 2010, 17:39
graphics (now you name them widgets!) are in .ui file
you can simply create widgets and other objects, both in run time and using Qt Designer

work with examples and read helps

JD2000
1st March 2010, 19:27
Iif you double click your mainwindow.ui file you will see a visual representation of your gui.

If you right click the GraphicsView object you can select 'Goto slot' to begin programming the objects signals & slots.


Click on the GraphicsView and you can see its properties on the right hand side.

The object's name is probably graphicsView in this case

Back in mainwindow.cpp you can access / programme this objects methods and members:


#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->graphicsView->setDragMode(QGraphicsView::ScrollHandDrag);

}