Important: Please read the Qt Code of Conduct -

QtDesigner & signal emit on press/etc?

  • 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 :- ))

  • Lifetime Qt Champion


    No, you did not miss anything.

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

  • 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) {

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

  • Lifetime Qt Champion

    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/