#define TEST_EVENT QEvent::User + 100
class CVxActuatorMain : public QMainWindow
{
protected:
void customEvent(QEvent *event);
}
CVxActuatorMain::CVxActuatorMain(QWidget *parent, Qt::WFlags
flags)
: QMainWindow(parent, flags)
{
QEvent *event = new
QEvent(QEvent::Type(TEST_EVENT));
qApp->postEvent(this, event);
}
void CVxActuatorMain::customEvent(QEvent
*event)
{
int type =
event->type();
if (type ==
TEST_EVENT)
{
m_pEdt_Info->append(QObject::tr("Test"));
event->accept();
}
else
{
QMainWindow::customEvent(event);
}
}
QT 自定义消息,布布扣,bubuko.com
QT 自定义消息
原文:http://www.cnblogs.com/lvdongjie/p/3746940.html