1 year ago

#260268

test-img

tushar

QObject::connect: Cannot connect (particular signals) to (null)

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 ?

c++

qt

qt5

qdockwidget

0 Answers

Your Answer

Accepted video resources