qcheckbox SLOT doesnot get called on clicked
Solved
General and Desktop
-
HI,
- Have u provided macro Q_OBJECT.?
- And the function to be called, SLOT , is it under public /private SLOT() section, ?
And as @dream_captain said , can u provide the code.
Thanks,
-
This function was working previously.
I tried both the ways: Signal and slots and also through ui (right click and go to slot).
The below code is not as it is in my workspace. i had added the important info regarding Qcheckboxcode::
some.hpp#include <QWidget> #include "common/abs_includes.hpp" #include "core/abs_va_ucf_handler.hpp" #include <QtWidgets/QDialog> #include "qdialog.h" #include <QtWidgets/qwidget.h> #include "QtWidgets/QMessageBox" #include "QtWidgets/qcombobox.h" #include "QtWidgets/qformlayout.h" #include "QtWidgets/qspinbox.h" #include "QtWidgets/qradiobutton.h" #include "qstandarditemmodel.h" #include "userinterface/qcombocheckbox.hpp" #include "qlineedit.h" #include "qcheckbox.h" #include "qtextstream.h" #include "qgroupbox.h" #include "qlabel.h" class CAbsDptUIFilterPanel : public QWidget { Q_OBJECT public: some functions private slots: void on_checkBox_showGallery_clicked(); void onCheckBoxShowGalleryClicked(bool f_bool); } something.cpp void CAbsDptUIFilterPanel::on_checkBox_showGallery_clicked() { m_showGallerySamples = ui->checkBox_showGallery->isChecked(); } void CAbsDptUIFilterPanel::onCheckBoxShowGalleryClicked(bool f_bool) { m_showGallerySamples = f_bool; }
I had noticed that moc file for this this file is not getting generated.
-
Can u clean , run qmake and build it.
Thanks,
-
@Pradeep-Kumar tried many times
-
Can u delete the build folder then compile once again,
Thanks,
-
@Sumit ,
Where is your connect statement for 2nd slot.
-
CAbsDptUIFilterPanel::CAbsDptUIFilterPanel (CAbsDptController* f_dptController, QMainWindow *parent) : m_mainWindow(parent), m_dptController(f_dptController), ui(new Ui::CDPTUIFilterPanel) { ui->setupUi(this); this->setWindowTitle("Filter Panel"); //setWindowIcon(QIcon(":Images/Images/BAS_lcon.png")); //adding project name to the filter panel add_project_name_to_filter_panel_display(); ui->m_gallery_spinBox->setRange(0,100); ui->m_train_spinBox->setRange(0,100); ui->m_gallery_spinBox->setEnabled(true); ui->m_train_spinBox->setEnabled(true); m_showGallerySamples=true; ui->checkBox_showGallery->setChecked(true); CAbsDptController::getFilterTabNames(m_strFilterTabNames); createFilterTabs(); m_FilterPanelHolder_p = NULL; m_FilterPanelHolder_p = new QDockWidget("Filter View",m_mainWindow); m_FilterPanelHolder_p->setAllowedAreas(Qt::LeftDockWidgetArea); m_FilterPanelHolder_p->setFeatures(QDockWidget::AllDockWidgetFeatures); m_scrollArea = new QScrollArea(); CAbsDptWorkspace *l_workSpace_p = (CAbsDptWorkspace*)m_mainWindow; m_scrollArea->setGeometry(l_workSpace_p->geometry()); m_scrollArea->setWidgetResizable(true); this->setFixedWidth((m_mainWindow->width()/4)-30); m_scrollArea->setWidget(this); m_FilterPanelHolder_p->setWidget(m_scrollArea); m_FilterPanelHolder_p->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable); m_FilterPanelHolder_p->setMaximumWidth(m_mainWindow->width()/4); m_mainWindow->addDockWidget(Qt::LeftDockWidgetArea, m_FilterPanelHolder_p); connect(ui->checkBox_showGallery,SIGNAL(clicked(bool)), this,SLOT(onCheckBoxShowGalleryClicked(bool)));
-
Thanks it worked.
deleted the whole folder and rebuild the project it started pointing to the break point.
-