[Qt-interest] QGraphicsView coordinates

Leonardo Bispo leonardo.bispo at corp.orolix.com
Tue Dec 16 11:46:24 CET 2008


Hi,

QFrame inherits QWidget, and QWidget inherits QPaintDevice, so you can create a painter to draw inside a paint device.

I think what is wrong in your code is that you are passing two arguments to constructor

QPainter paint(mapFrame,this);

In documentation you must pass only the painter device or none

QPainter ()
QPainter ( QPaintDevice * device )

http://doc.trolltech.com/4.4/qpainter.html

There are many differences between Qt3 and Qt4. You must check all this differences.

Best Regards,

Leonardo Bispo de Oliveira
Desenvolvimento de Sistemas - Analista Desenvolvedor
Tel: +55 11 5508 5887, +55 11 2122 0312
Fax: +55 11 5508 5880
http://www.orolix.com.br - leonardo.bispo at corp.orolix.com
Orolix. Você NAVEGA, a gente PAGA !!!



-----Original Message-----
From: qt-interest-bounces at trolltech.com on behalf of Phil
Sent: Tue 16/12/2008 06:50
To: qt-interest at trolltech.com
Subject: [Qt-interest] QGraphicsView coordinates
 
Thank you for reading this.

I'm trying to modernise an application that I created eight years ago and have 
run into a display problem. In that application I have displayed a map, some 
text and ploted a few points.

This is how I had achieved that using Qt3 but that option seems not to be 
available under Qt4. I can now only paint on a dialog and not a frame. The 
following now fails on the paint constructor. "mapFrame" is a frame on a main 
window dialog created with Designer and "paintMap" is a function that draws 
the pixmap graphic and adds the text.

void pest::paintEvent(QPaintEvent*)
{
  QPainter paint(mapFrame,this);

  paintMap(&paint);
}

If I can no longer paint on a frame (maybe I still can but with a different 
method) can I use QGraphicsView instead? If so, how do I pass coordinates to 
QGraphicsScene so that, for instance, I can place text at a particular fixed 
point?

-- 
Regards,
Phil.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081216/3a9cdb4e/attachment.html 


More information about the Qt-interest-old mailing list