QObject::connect:无法连接(特定信号)到(空)
我试图在 QDockWidget 中添加多个选项卡,该选项卡由 sView 类继承。为此,我编写了定制的信号和槽。
但我收到以下错误。
QObject::connect: Cannot connect myView::EnableWindow() to (null)::ShowWindow()
mainWindow.h
class mainWindow : public mainWindow
Q_OBJECT
public slots:
void ShowWindow();
mainWindow.cpp
void mainWindow::ShowWindow()
{
if (!_sView->isHidden())
{
sView* newObject = new sView();
addDockWidget(Qt::BottomDockWidgetArea,newObject );
tabifyDockWidget(sView,newObject);
}
}
sView.h
class sView : public QDockWidget
{
Q_OBJECT
signals:
void EnableWindow();
}
sView.cpp
sView::sView()
{
connect(this, SIGNAL(EnableWindow()), GetInstance()->GetMainWindowObj(),SLOT(ShowWindow()));
}
如何解决这个问题?
I am trying to add multiple tab in QDockWidget which was inherited by class sView. For that I have written custom made signals and slots.
But I am getting following error.
QObject::connect: Cannot connect myView::EnableWindow() to (null)::ShowWindow()
mainWindow.h
class mainWindow : public mainWindow
Q_OBJECT
public slots:
void ShowWindow();
mainWindow.cpp
void mainWindow::ShowWindow()
{
if (!_sView->isHidden())
{
sView* newObject = new sView();
addDockWidget(Qt::BottomDockWidgetArea,newObject );
tabifyDockWidget(sView,newObject);
}
}
sView.h
class sView : public QDockWidget
{
Q_OBJECT
signals:
void EnableWindow();
}
sView.cpp
sView::sView()
{
connect(this, SIGNAL(EnableWindow()), GetInstance()->GetMainWindowObj(),SLOT(ShowWindow()));
}
How to solve this problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论