我正在编写一个程序,在构造函数中调用QWidget::winId()
:
debug_window::debug_window(QWidget *parent) :
QDialog(parent),
ui(new Ui::debug_window),
hk(NULL)
{
this->ui->setupUi(this);
this->hk = new TestClass(this, this->winId())
}
但这将导致我的程序崩溃,甚至在创建窗口之前。我已经发现winId的调用导致了崩溃,可能是因为此时没有窗口。(如果我错了,请纠正我)。遗憾的是,没有信号"windowCreated()“或类似的东西。那么,有没有办法找出窗口是创建的,或者一般情况下如何解决这个问题?
谢谢你的帮助。
发布于 2014-09-14 22:04:41
创建信号并在构造函数结束时发出它。
https://stackoverflow.com/questions/25838427
复制相似问题