PDA

View Full Version : resize event



wirasto
16th July 2009, 09:15
How use resize event for QDialog ? I try like this, but not work.



...............
...............
connect(this, SIGNAL(resizeEvent ( QResizeEvent * event )), this, SLOT(coba( QResizeEvent * event )));
...............
...............

void myDialog::coba( QResizeEvent * event )
{
qDebug() << size();
}

nish
16th July 2009, 09:19
resizeEvent is not a signal... its a virtual function... use it directly..(first declare it in your class)

void myDialog::resizeEvent(QResizeEvent*)

Lykurg
16th July 2009, 09:21
class myDialog
{
protected:
void resizeEvent(QResizeEvent *event);
};

void myDialog::resizeEvent(QResizeEvent *event)
{
qDebug() << event->size() << event->oldSize();
}

EDIT: too late...

caduel
16th July 2009, 09:22
i) resizeEvent is a regular virtual protected function, just overload it in your class and handle the event
ii) if it was a signal (it is not), your syntax would be wrong:

connect(this, SIGNAL(resizeEvent ( QResizeEvent * event )), this, SLOT(coba( QResizeEvent * event )));

you must not have argument names in there, it would be
connect(this, SIGNAL(resizeEvent(QResizeEvent*)), this, SLOT(coba(QResizeEvent*)));

(Of course, this will not work, as resizeEvent is NOT a signal.)

HTH

nish
16th July 2009, 09:23
EDIT: too late...
better luck next time brother:)

nish
16th July 2009, 09:24
boy!! this guy is really lucky..!! he got three replies.!!

wirasto
16th July 2009, 10:01
Wow, this is amazing... :D
So many reply...

Well, work now. Thank's for your help :)