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. QtDesigner & signal emit on press/etc?

QtDesigner & signal emit on press/etc?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtdesignersignal & slotsignal
4 Posts 3 Posters 553 Views
  • 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.
  • D Offline
    D Offline
    Dariusz
    wrote on last edited by
    #1

    Hey

    I'm lately starting to use more and more of qt designer for my gui work...
    I do wonder tho, is there a way to tell the designer to make signals for widgets/buttons and declare them in c++ class?
    So when I make my GUI object, I can just do connect(gui,&gui::btnSignalA,this,&test::handleSinglaA);
    Atm the widget is inside gui->ui which is private, so I have to manually make forward signals/etc... bit of pain, any hints?ideas? WHAT DID I MISSSS :- ))

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      No, you did not miss anything.

      The goal of designer is to help you build the GUI part not code it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • D Offline
        D Offline
        Dariusz
        wrote on last edited by
        #3

        Ah thats a bummer, I was hoping there is some way of exporting the signals.
        This way I dont have to touch GUI code at all ! Just designer & compile run.

        Was hoping for this to somehow magically happen >

            testGUI::testGUI(QDockWidget *parent) :
                    QDockWidget(parent), ui(new Ui::testGUI) {
                ui->setupUi(this);
                connect(ui->mBtn_addGroup,&QPushButton::released,this,&testGUI::mBtn_addGroup);
            }
        

        Will just hand type those exports :x
        Thanks for help!

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          On the bright side, when you do declare forward signals, you are doing it just right as
          accessing widgets left and right produces hard to maintain code that breaks easily.

          So by being "forced" to surface the external needed data via signals, you define an interface that will hold, even
          if you refactor the internal widgets. The rest of the app will remain unaffected. \o/

          1 Reply Last reply
          2

          • Login

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