PDA

View Full Version : width()



mickey
29th March 2006, 22:28
Hi, it happened a strange thing: I need to retrieve myWidget1 width and to uncover this I put code below inside mainForm constructor and MyWidget::paintGL()


cout << width() << endl; //in paintGL() print 101
cout << myWidget1->width() << endl; //in costructor of MainForm print 466 (truth)

I must obtain with from MainForm but I retieve 101 and it is wrong; why This? Thanks..

wysota
1st April 2006, 00:34
You shouldn't try to fetch widget size in the constructor as its size is not set then yet. It is being set when show() is executed.