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. Need help passing a variable to another Form (Signals/Slots)
Forum Updated to NodeBB v4.3 + New Features

Need help passing a variable to another Form (Signals/Slots)

Scheduled Pinned Locked Moved Solved General and Desktop
25 Posts 5 Posters 4.9k 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 Former User

    @jsulm
    qDebug() shows me that it effectively does nothing. dialog.set_up() does not touch the object declared as opt_dia.

    "mode: 12141696 - "
    

    12141696 seems to be a random value.
    This is the qDebug() line:

    qDebug() << "mode: " + QString::number(opt_dia.get_mode()) + " - " + opt_dia.get_db().userName();
    
    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #21

    @SnuggleKat Can you show the content of dialog.set_up(...)?

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    ? 1 Reply Last reply
    0
    • jsulmJ jsulm

      @SnuggleKat Can you show the content of dialog.set_up(...)?

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #22

      @jsulm Do you mean this?

      public slots:
         void set_up(QSqlDatabase db, int mode){ this->db = db; this->mode = mode; emit opt_dia.send_option(db, mode);}
      
      jsulmJ 1 Reply Last reply
      0
      • ? A Former User

        @jsulm Do you mean this?

        public slots:
           void set_up(QSqlDatabase db, int mode){ this->db = db; this->mode = mode; emit opt_dia.send_option(db, mode);}
        
        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #23

        @SnuggleKat set_up(

        public slots:
           void set_up(QSqlDatabase db, int mode){ this->db = db; this->mode = mode; opt_dia.set_up(db, mode); }
        

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        ? 1 Reply Last reply
        0
        • J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #24

          I admit, I'm a little bit out of my field here, but can you simply reassign a QSqlDatabase in that way?

          I usually pass a QSqlDatabase-pointer between classes.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          1
          • jsulmJ jsulm

            @SnuggleKat set_up(

            public slots:
               void set_up(QSqlDatabase db, int mode){ this->db = db; this->mode = mode; opt_dia.set_up(db, mode); }
            
            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #25

            @jsulm
            Okay, it now works! Thank you.
            I also hat to re-write a set_up() function inside the Dialog class.
            I will clean up the way it's done by now and remember it for the next time

            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