Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qcheckbox SLOT doesnot get called on clicked
Qt 6.11 is out! See what's new in the release blog

qcheckbox SLOT doesnot get called on clicked

Scheduled Pinned Locked Moved Solved General and Desktop
qcheckboxsignal & slot
12 Posts 5 Posters 6.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Sumit

    Hello everyone,
    this problem is supposed not to be a problem but i dont know how it arises.
    I added a check box widget and am trying to read it status in its slot (clicked).

    But its not going to its slot. I tried putting a break point on its slot function but it does not come to that point on being clicked.

    Kindly provide some solutions.

    Thanks

    dream_captainD Offline
    dream_captainD Offline
    dream_captain
    wrote on last edited by
    #2

    @Sumit
    Can you show us your code?

    S 1 Reply Last reply
    2
    • Pradeep KumarP Offline
      Pradeep KumarP Offline
      Pradeep Kumar
      wrote on last edited by
      #3

      HI,

      @Sumit

      1. Have u provided macro Q_OBJECT.?
      2. 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,

      Pradeep Kumar
      Qt,QML Developer

      1 Reply Last reply
      3
      • dream_captainD dream_captain

        @Sumit
        Can you show us your code?

        S Offline
        S Offline
        Sumit
        wrote on last edited by VRonin
        #4

        @dream_captain

        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 Qcheckbox

        code::
        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.

        1 Reply Last reply
        0
        • Pradeep KumarP Offline
          Pradeep KumarP Offline
          Pradeep Kumar
          wrote on last edited by
          #5

          Can u clean , run qmake and build it.

          Thanks,

          Pradeep Kumar
          Qt,QML Developer

          S 1 Reply Last reply
          0
          • Pradeep KumarP Pradeep Kumar

            Can u clean , run qmake and build it.

            Thanks,

            S Offline
            S Offline
            Sumit
            wrote on last edited by
            #6

            @Pradeep-Kumar tried many times

            1 Reply Last reply
            0
            • Pradeep KumarP Offline
              Pradeep KumarP Offline
              Pradeep Kumar
              wrote on last edited by
              #7

              Can u delete the build folder then compile once again,

              Thanks,

              Pradeep Kumar
              Qt,QML Developer

              S 1 Reply Last reply
              2
              • VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #8

                does some functions contain a constructor? if so, can you show it?
                Basically, slots are not magically connected, you have to call QObject::connect in the constructor (or let uic take care of connections based by name)

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                S 1 Reply Last reply
                1
                • Vinod KuntojiV Offline
                  Vinod KuntojiV Offline
                  Vinod Kuntoji
                  wrote on last edited by
                  #9

                  @Sumit ,

                  Where is your connect statement for 2nd slot.

                  C++, Qt, Qt Quick Developer,
                  PthinkS, Bangalore

                  1 Reply Last reply
                  1
                  • VRoninV VRonin

                    does some functions contain a constructor? if so, can you show it?
                    Basically, slots are not magically connected, you have to call QObject::connect in the constructor (or let uic take care of connections based by name)

                    S Offline
                    S Offline
                    Sumit
                    wrote on last edited by VRonin
                    #10

                    @VRonin

                    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)));
                    
                    1 Reply Last reply
                    0
                    • Pradeep KumarP Pradeep Kumar

                      Can u delete the build folder then compile once again,

                      Thanks,

                      S Offline
                      S Offline
                      Sumit
                      wrote on last edited by
                      #11

                      @Pradeep-Kumar

                      Thanks it worked.

                      deleted the whole folder and rebuild the project it started pointing to the break point.

                      1 Reply Last reply
                      1
                      • Pradeep KumarP Offline
                        Pradeep KumarP Offline
                        Pradeep Kumar
                        wrote on last edited by
                        #12

                        @Sumit

                        Glad u got the result,
                        Happy Coding,

                        Thanks,

                        Pradeep Kumar
                        Qt,QML Developer

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved