Linux/QT
[QT] qthread에서 다른 위젯이나 다이얼로그를 불러올때
aucd29
2013. 9. 26. 20:44
http://doc.trolltech.com/3.3/qcustomevent.html
여기보시면, 사용법이 나와 있습니다.
class ColorChangeEvent : public QCustomEvent
{
public:
ColorChangeEvent( QColor color )
: QCustomEvent( 65432 ), c( color ) {}
QColor color() const { return c; }
private:
QColor c;
};
// To send an event of this custom event type:
ColorChangeEvent* ce = new ColorChangeEvent( blue );
QApplication::postEvent( receiver, ce ); // Qt will delete it when done
// To receive an event of this custom event type:
void MyWidget::customEvent( QCustomEvent * e )
{
if ( e->type() == 65432 ) { // It must be a ColorChangeEvent
ColorChangeEvent* ce = (ColorChangeEvent*)e;
newColor = ce->color();
}
} http://doc.trolltech.com/3.3/qcustomevent.html
여기보시면, 사용법이 나와 있습니다.
class ColorChangeEvent : public QCustomEvent
{
public:
ColorChangeEvent( QColor color )
: QCustomEvent( 65432 ), c( color ) {}
QColor color() const { return c; }
private:
QColor c;
};
// To send an event of this custom event type:
ColorChangeEvent* ce = new ColorChangeEvent( blue );
QApplication::postEvent( receiver, ce ); // Qt will delete it when done
// To receive an event of this custom event type:
void MyWidget::customEvent( QCustomEvent * e )
{
if ( e->type() == 65432 ) { // It must be a ColorChangeEvent
ColorChangeEvent* ce = (ColorChangeEvent*)e;
newColor = ce->color();
}
}
여기보시면, 사용법이 나와 있습니다.
class ColorChangeEvent : public QCustomEvent
{
public:
ColorChangeEvent( QColor color )
: QCustomEvent( 65432 ), c( color ) {}
QColor color() const { return c; }
private:
QColor c;
};
// To send an event of this custom event type:
ColorChangeEvent* ce = new ColorChangeEvent( blue );
QApplication::postEvent( receiver, ce ); // Qt will delete it when done
// To receive an event of this custom event type:
void MyWidget::customEvent( QCustomEvent * e )
{
if ( e->type() == 65432 ) { // It must be a ColorChangeEvent
ColorChangeEvent* ce = (ColorChangeEvent*)e;
newColor = ce->color();
}
} http://doc.trolltech.com/3.3/qcustomevent.html
여기보시면, 사용법이 나와 있습니다.
class ColorChangeEvent : public QCustomEvent
{
public:
ColorChangeEvent( QColor color )
: QCustomEvent( 65432 ), c( color ) {}
QColor color() const { return c; }
private:
QColor c;
};
// To send an event of this custom event type:
ColorChangeEvent* ce = new ColorChangeEvent( blue );
QApplication::postEvent( receiver, ce ); // Qt will delete it when done
// To receive an event of this custom event type:
void MyWidget::customEvent( QCustomEvent * e )
{
if ( e->type() == 65432 ) { // It must be a ColorChangeEvent
ColorChangeEvent* ce = (ColorChangeEvent*)e;
newColor = ce->color();
}
}