[Qt-interest] Basic update() paint - more info

Phil phillor at telstra.com
Fri Jan 30 06:41:35 CET 2009


On Friday 30 January 2009 10:36:11 andrew.m.goth at l-3com.com wrote:

Thanks again for your time Andy.

I've had a couple of days to think about this and to experiment further and 
now I defiantly know where the problem lies but I cannot find a solution. I'm 
back where I started; I seem to have made an error after I promoted the frame 
widget to my map class.

This is from my base class constructor:

Base::Base ( QWidget* parent, Qt::WFlags fl )
  : QMainWindow ( parent, fl ), Ui::MainWindow()
{
  setupUi ( this );

  map = new Map(mapFrame);
}

The following statement calls the map class functonX() where I simply have an 
update() statement;

map->functionX();

This triggers the paint event as I described previously; the two rectangles 
are not alternatively painted in magenta and yellow. If I omit the  map = new 
Map(mapFrame) statement and include a timer signal / update slot instead in my 
map class then the rectangles are displayed correctly. Also, the window, 
including the frame, is repainted correctly if it's resized or uncovered but 
only if I omit the Map(mapFrame) statement. This must mean the the error has 
to do with the promotion of the frame or something omited from the map 
constructor itself, perhaps.

This is the map class constructor:

Map::Map(QWidget *parent)
 : QFrame(parent)

Does any of this make any sense at all and show where I've made an error?

-- 
Regards,
Phil.



More information about the Qt-interest-old mailing list