Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Event happens when it shouldn't
Forum Updated to NodeBB v4.3 + New Features

Event happens when it shouldn't

Scheduled Pinned Locked Moved Qt Creator and other tools
9 Posts 2 Posters 2.4k 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.
  • A Offline
    A Offline
    aLMT
    wrote on last edited by
    #1

    Hi,

    It is my first post here and I hope it gonna make you laugh.!

    Well, this is not that easy to explain. In my code, there is a simple connection with a QPushButton which is supposed to shut down the program.

    connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));
    

    For a test (cause another button doesnt work), I removed this line BUT it is still working. So basically there is not SLOT on this button but for the program there is.

    Obviously, I compiled again and again, clean, qmake, quit Qtcreator and tried again and again... AND it is still here.

    Do you have any idea what could it be.?

    Thanks in advance.

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #2

      Hi, Welcome to DevNet.
      Do you add QPushButton with QtDesigner or manualy in code?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aLMT
        wrote on last edited by
        #3

        I did it manually

        here is the cpp concerned :

        #include "Win.h"
        #include "Result.h"

        Win::Win()
        {

        // ///////////////////////////////////////////////////////////////////
        //SETTLEMENT OF THE MAIN WINDOW
        // ///////////////////////////////////////////////////////////////////
        box11 = new QSpinBox();
        box11->setSuffix(" mm");
        box12 = new QSpinBox();
        box12->setSuffix(" mm");
        box13 = new QSpinBox();
        box13->setSuffix(" mm");
        box14 = new QSpinBox();
        box14->setSuffix(" mm");
        box15 = new QSpinBox();
        box15->setSuffix(" mm");
        box16 = new QSpinBox();
        box16->setSuffix(" mm");
        box17 = new QSpinBox();
        box17->setSuffix(" mm");
        box18 = new QSpinBox();
        box18->setSuffix(" mm");
        box21 = new QSpinBox();
        box21->setSuffix(" mm");
        box22 = new QSpinBox();
        box22->setSuffix(" mm");
        box23 = new QSpinBox();
        box23->setSuffix(" mm");
        box24 = new QSpinBox();
        box24->setSuffix(" mm");
        box25 = new QSpinBox();
        box25->setSuffix(" mm");
        box26 = new QSpinBox();
        box26->setSuffix(" mm");
        box27 = new QSpinBox();
        box27->setSuffix(" mm");
        box28 = new QSpinBox();
        box28->setSuffix(" mm");
        
        //initialisation of requirement spinboxes 1 and 2
        boxE2 = new QSpinBox();
        boxE2->setPrefix("E2>   ");
        boxE2->setRange(0, 400);
        boxE2->setValue(100);
        boxE2E1 = new QDoubleSpinBox();
        boxE2E1->setPrefix("E2/E1<   ");
        boxE2E1->setRange(0, 10);
        boxE2E1->setValue(2.5);
        
        
        //initialisation of pushbutton
        b_quit = new QPushButton("quit");
        calc = new QPushButton("calculate");
        
        // ///////////////////////////////////////
        //spinboxes 1 layout
        // ///////////////////////////////////////
        layout1 = new QFormLayout;
        layout1->addRow("0 kPa", box11);
        layout1->addRow("50 kPa", box12);
        layout1->addRow("100 kPa", box13);
        layout1->addRow("200 kPa", box14);
        layout1->addRow("300 kPa", box15);
        layout1->addRow("100 kPa", box16);
        layout1->addRow("50 kPa", box17);
        layout1->addRow("0 kPa", box18);
        
        //spinboxes 2 layout
        layout2 = new QFormLayout;
        layout2->addRow("0 kPa", box21);
        layout2->addRow("50 kPa", box22);
        layout2->addRow("100 kPa", box23);
        layout2->addRow("200 kPa", box24);
        layout2->addRow("300 kPa", box25);
        layout2->addRow("100 kPa", box26);
        layout2->addRow("50 kPa", box27);
        layout2->addRow("0 kPa", box28);
        
        biglayout1 = new QHBoxLayout;
        biglayout1->addLayout(layout1);
        biglayout1->addLayout(layout2);
        groupmeasures = new QGroupBox("Measurements");
        groupmeasures->setLayout(biglayout1);
        
        //requirement spinboxes 1 and 2 layout
        layout3 = new QHBoxLayout;
        layout3->addWidget(boxE2);
        layout3->addWidget(boxE2E1);
        grouprequirement = new QGroupBox("Requirement");
        grouprequirement->setLayout(layout3);
        
        //pushbutton layout
        layout4 = new QHBoxLayout;
        layout4->addWidget(calc);
        layout4->addWidget(b_quit);
        
        layoutgrid = new QGridLayout;
        layoutgrid->addWidget(groupmeasures,0,0,1,2);
        layoutgrid->addWidget(grouprequirement,1,0,1,2);
        layoutgrid->addLayout(layout4,2,0,1,2);
        
        // ///////////////////////////////////////////////////////////////////
        // MAIN WINDOW SETTLED
        // ///////////////////////////////////////////////////////////////////
        
        // pushbuttons connection
        connect(calc, SIGNAL(clicked()), qApp, SLOT(quit()));
        

        }

        void Win::ouvrirDialogue()
        {
        // Vous insérerez ici le code d'ouverture des boîtes de dialogue
        QMessageBox::information(this, "Titre de la fenêtre", "Bonjour et bienvenueà tous les Zéros !");

        }

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aLMT
          wrote on last edited by
          #4

          Well, i dont know how to post the code...!

          1 Reply Last reply
          0
          • A Offline
            A Offline
            aLMT
            wrote on last edited by
            #5

            @#include "Win.h"
            #include "Result.h"

            Win::Win()
            {

            // ///////////////////////////////////////////////////////////////////
            //SETTLEMENT OF THE MAIN WINDOW
            // ///////////////////////////////////////////////////////////////////
            box11 = new QSpinBox();
            box11->setSuffix(" mm");
            box12 = new QSpinBox();
            box12->setSuffix(" mm");
            box13 = new QSpinBox();
            box13->setSuffix(" mm");
            box14 = new QSpinBox();
            box14->setSuffix(" mm");
            box15 = new QSpinBox();
            box15->setSuffix(" mm");
            box16 = new QSpinBox();
            box16->setSuffix(" mm");
            box17 = new QSpinBox();
            box17->setSuffix(" mm");
            box18 = new QSpinBox();
            box18->setSuffix(" mm");
            box21 = new QSpinBox();
            box21->setSuffix(" mm");
            box22 = new QSpinBox();
            box22->setSuffix(" mm");
            box23 = new QSpinBox();
            box23->setSuffix(" mm");
            box24 = new QSpinBox();
            box24->setSuffix(" mm");
            box25 = new QSpinBox();
            box25->setSuffix(" mm");
            box26 = new QSpinBox();
            box26->setSuffix(" mm");
            box27 = new QSpinBox();
            box27->setSuffix(" mm");
            box28 = new QSpinBox();
            box28->setSuffix(" mm");
            
            //initialisation of requirement spinboxes 1 and 2
            boxE2 = new QSpinBox();
            boxE2->setPrefix("E2>   ");
            boxE2->setRange(0, 400);
            boxE2->setValue(100);
            boxE2E1 = new QDoubleSpinBox();
            boxE2E1->setPrefix("E2/E1<   ");
            boxE2E1->setRange(0, 10);
            boxE2E1->setValue(2.5);
            
            
            //initialisation of pushbutton
            b_quit = new QPushButton("quit");
            calc = new QPushButton("calculate");
            
            // ///////////////////////////////////////
            //spinboxes 1 layout
            // ///////////////////////////////////////
            layout1 = new QFormLayout;
            layout1->addRow("0 kPa", box11);
            layout1->addRow("50 kPa", box12);
            layout1->addRow("100 kPa", box13);
            layout1->addRow("200 kPa", box14);
            layout1->addRow("300 kPa", box15);
            layout1->addRow("100 kPa", box16);
            layout1->addRow("50 kPa", box17);
            layout1->addRow("0 kPa", box18);
            
            //spinboxes 2 layout
            layout2 = new QFormLayout;
            layout2->addRow("0 kPa", box21);
            layout2->addRow("50 kPa", box22);
            layout2->addRow("100 kPa", box23);
            layout2->addRow("200 kPa", box24);
            layout2->addRow("300 kPa", box25);
            layout2->addRow("100 kPa", box26);
            layout2->addRow("50 kPa", box27);
            layout2->addRow("0 kPa", box28);
            
            biglayout1 = new QHBoxLayout;
            biglayout1->addLayout(layout1);
            biglayout1->addLayout(layout2);
            groupmeasures = new QGroupBox("Measurements");
            groupmeasures->setLayout(biglayout1);
            
            //requirement spinboxes 1 and 2 layout
            layout3 = new QHBoxLayout;
            layout3->addWidget(boxE2);
            layout3->addWidget(boxE2E1);
            grouprequirement = new QGroupBox("Requirement");
            grouprequirement->setLayout(layout3);
            
            //pushbutton layout
            layout4 = new QHBoxLayout;
            layout4->addWidget(calc);
            layout4->addWidget(b_quit);
            
            layoutgrid = new QGridLayout;
            layoutgrid->addWidget(groupmeasures,0,0,1,2);
            layoutgrid->addWidget(grouprequirement,1,0,1,2);
            layoutgrid->addLayout(layout4,2,0,1,2);
            
            // ///////////////////////////////////////////////////////////////////
            // MAIN WINDOW SETTLED
            // ///////////////////////////////////////////////////////////////////
            
            // pushbuttons connection
            connect(calc, SIGNAL(clicked()), qApp, SLOT(quit()));
            

            }

            void Win::ouvrirDialogue()
            {
            // Vous insérerez ici le code d'ouverture des boîtes de dialogue
            QMessageBox::information(this, "Titre de la fenêtre", "Bonjour et bienvenueà tous les Zéros !");

            }
            @

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              qxoz
              wrote on last edited by
              #6

              And if you click on b_quit app closes?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                aLMT
                wrote on last edited by
                #7

                yeah exactly. Whereas there is no connection anymore.
                Moreover, I just checked if the compilation is good. There is problem...!

                It looks like my program corresponds to my former code. Weird tho

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  aLMT
                  wrote on last edited by
                  #8

                  Anybody has an idea.?

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    qxoz
                    wrote on last edited by
                    #9

                    Only thing that comes to mind, if clean - >qmake didn't help then try delete all build files manually and qmake - >Rebuild All.

                    1 Reply Last reply
                    0

                    • Login

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