#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);
}
}
阅读(4774) | 评论(0) | 转发(2) |