PDA

View Full Version : [SOLVED] problem in signal/slot for QPushButton



kamlmish
13th December 2010, 09:41
Hi
I have a button created in mainwindow and I connect the button "clicked " signal to the slot.
But I think Theres issue in the connection , thats the reason the slot is not called for the same



MainWindow::MainWindow()
{
//window specs
setWindowTitle(tr("GALLERY"));
resize(1350,1700);
//Allocation of items
settTree = new SettingsTree(this);
settTree->setGeometry(10,10,250,420);
listwidget = new QListWidget(this);
grid_button = new QPushButton(this);
grid_button->setGeometry(39,670,31,22);
list_button = new QPushButton(this);
addbutton = new QPushButton(this);
deletebutton = new QPushButton(this);
objectbutton = new QPushButton(this);
pf = new PanelFrame(this);
m_CheckBox = new QCheckBox(this);
m_CheckBox->setGeometry(230,14,21,21);
state = Qt::Unchecked;
m_Slider = new QSlider(Qt::Horizontal,this);
m_Slider->setGeometry(160,672,101,21);

//previewpane
/* previewpane = new QStandardItemModel(8,3,this);
setupmodel();
setupview();
*/

//functions to be called
Menu();

//connections:signal & slots
connect(list_button,SIGNAL(clicked()),this,SLOT(li stdisplay()),Qt::DirectConnection);
connect(m_CheckBox,SIGNAL(stateChanged(int)),this, SLOT(isMainWindowDocked()),Qt::AutoConnection);
connect(addbutton,SIGNAL(clicked()),this,SLOT(appL auncher()),Qt::DirectConnection);
//connect(&process,SIGNAL(error(QProcess::ProcessError)),this ,SLOT(processerror(QProcess::ProcessError)),Qt::Au toConnection);

}

SLOT function



void MainWindow::appLauncher()
{
qDebug()<<"App Launcher";
QString app = "/home/kamlesh/Gall/AddFolder/AddFolder-build-desktop/AddFolder";
process.start(app);
}

franz
13th December 2010, 09:49
What's the result of the relevant connect call, and do you see any run-time errors about signals or slots not existing?

kamlmish
13th December 2010, 10:31
For existing signal/slot mechanisms, there are no issues


connect(list_button,SIGNAL(clicked()),this,SLOT(li stdisplay()),Qt::DirectConnection);
connect(m_CheckBox,SIGNAL(stateChanged(int)),this, SLOT(isMainWindowDocked()),Qt::AutoConnection);


The above two work perfectly

While debugging, when I click the button specified, it should go to the SLOT function specified as expected. but nothing happens

Added after 39 minutes:

[SOLVED]
I have fixed the issue