Results 1 to 2 of 2

Thread: QtDesigner cross-objects signal / slots - between two dialogs.

  1. #1
    Join Date
    Aug 2020
    Posts
    28
    Qt products
    Qt5

    Default QtDesigner cross-objects signal / slots - between two dialogs.

    Is there a way to use QtDesigner "Edit Signals/Slots" GUI to "connect" between two class Objects / Widgets?
    I like to pass text from one dialog to main window dialog.
    Sort of upstream parent /child arrangement.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QtDesigner cross-objects signal / slots - between two dialogs.

    Using the Qt Designer GUI mechanism to create signal / slot connections is generally a bad idea because it results in code being generated by Qt's MOC (meta-object compiler) that gets hidden away inside the moc_*.cpp file. It's easy to forget these automatically created connect() statements, which can lead to all sorts of debugging problems later when you see slots being called twice (because you forgot about the auto connect and added another one in code), runtime errors (because you deleted the slot from your code but forgot to remove the connection from the UI file), or other behavior that leaves you scratching your head until you remember that auto connect.

    So even if you do find a way to use the Designer GUI to make the connection, don't do it. Write it yourself, in C++, in the classes where you want to use it so it is in your face every time you edit the code. And add a comment so you remember why that signal, slot, and connect are there.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. qt Signal and slots for plainly C++ class objects
    By Pereubu2018 in forum Newbie
    Replies: 4
    Last Post: 18th August 2018, 12:56
  2. signal/slots and dynamic objects
    By stingray in forum Newbie
    Replies: 4
    Last Post: 24th January 2017, 10:11
  3. signal/slots and dynamic objects
    By stingray in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2017, 17:46
  4. Replies: 2
    Last Post: 26th April 2010, 11:46
  5. Replies: 3
    Last Post: 19th January 2010, 21:26

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.