Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, February 2008
[qt4] paintEvent again


Message 1 in thread

Hi Everybody

Can anybody explain me paintEvent behaviour in one case, please?

Here is what I did, so you can reproduce very fast:
1. Create new Qt project with QDialog base class.
2. Redefine paintEvent for your dialod class with something like this
void test::paintEvent(QPaintEvent * p)
{
   QDialog::paintEvent(p);
   qDebug("paint event");
}
3. Put a pushbutton on the dialog. Double check that the FocusPolicy is 
Qt::StrongFocus (this is default)
4. Run this project.

In my case I have endlessly calls of paintEvent. I can stop this only if I 
change Qt::StrongFocus to Qt::NoFocus. I tried to put different controls on 
dialog with Qt::StrongFocus policy. But no one behaves accordinly to 
paintevent like PushButton does.

Is it unexpected bahaviour only for me or you also surprised?

Thanks, Sergey 

--
 [ signature omitted ]