Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Custum signal in QDialog does not launch a slot in another class
Qt 6.12 LTS is out! See what's new in the release blog

Custum signal in QDialog does not launch a slot in another class

Scheduled Pinned Locked Moved General and Desktop
12 Posts 3 Posters 5.7k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #3

    Thank you raven-worx, I have checked if the connect statement works and it does (the bool is 1) and I ve printed something in the saveTableValue slot and it works also....

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #4

      when the connect() returns true the connection is fine and everything will work.
      So there must be something else... the posted code looks good.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #5

        exactely I cant find out what's wrong. I tried to emit the same signal in B class and connected in the A class, and it works! the only difference I see is that the case that doesn't work is a QDialog!! what's wrong with that?!

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #6

          should also work. even if you call QDialog::exec() to show it.
          Did you try a full rebuild of your project?

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #7

            What do you mean with "even if you call QDialog::exec() to show it."?

            yes I tried twice to rebuild...nothing

            1 Reply Last reply
            0
            • raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #8

              [quote author="valeSimu" date="1422369443"]What do you mean with "even if you call QDialog::exec() to show it."?[/quote]

              because QDialog::exec() opens a new event-loop. Nevermind.

              I don't have any more hints for you sry.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andreyc
                wrote on last edited by
                #9

                Could you show where do you show or exec profDialog.
                Is profHullDialog related to profDialog?

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andreyc
                  wrote on last edited by
                  #10

                  Another question.
                  How many times do you call Geometry_UI::update()?
                  In current implementation you create new table on each update.

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #11
                    • in class B.cpp show the profDialog in thi way

                    @connect(profBtn, SIGNAL(clicked()), profDialog, SLOT(show()));@

                    • and yes proHullDialog and profDialog are the same, I corrected it, thx

                    • yes the table is created for every element it finds in a list, for this reason update is called many times

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andreyc
                      wrote on last edited by
                      #12

                      The connect in MainWindow ctor uses a Geomentry_UI::profDialog pointer allocated in Geometry_UI ctor.
                      In Geometry_UI::update() you lose that pointer and allocate another and you use that new pointer to connect with a table widget.
                      You need to rethink the connections and allocations.

                      @
                      Main_newUI::Main_newUI(QString pathPj, QWidget *parent)
                      : QMainWindow(parent)
                      {
                      geometryDocks = new Geometry_UI(...); // Creates a pointer to profDialog
                      profileDialog = geometryDocks->profDialog;
                      connect(profileDialog, SIGNAL(load()), this, SLOT(reloadIfGeometryChanged())); // Uses that pointer to make a connection.
                      }

                      void Geometry_UI::update()
                      {
                      QTableWidget* profileTable = new QTableWidget(profDialog);
                      profDialog = new ShapeDialog(profBtn, profileTable); // The pointer previously allocated in ctor is lost here.
                      connect(profileTable, SIGNAL(cellChanged(int,int)), profDialog, SLOT(saveTableValue(int,int))); // profileTable is connected to new profDialog that is not connected with MainWindow.
                      }

                      @

                      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
                      • Unsolved