Nominate our 2022 Qt Champions!

Can't make Connection Correctly in Qt Designer

  • Hello,

    I am going through the Qt Gui book by Blanchette and Summerfield. Chapter 2 worked though a sort dialog example with an expanding dialog feature.

    The source code example work great, but my example does not. I am positive my source code is correct, since I copied from the book and double check with the example code.

    I have connected the more button (expanding button) to the group boxes I want turned invisible. I connected [pushButton] toggle(bool) to [groupbox] setVisiablitly(bool). I compared the example form and my form together, and view the connection tab. According to the connection tab, both the same exact connections.

    I wrote another quick gui program, trying to make a pushButton to toggle the invisibility a groupbox. That did not work, either. There's something I am missing. The example works but my version don't work and I don't understand the difference.

    I did a search about this problem, and found someone with the problem, but no solution was given. I've talked with some other Qt Programmers and they just dodged the issue by saying they hard code connections. I want to know how to use the Qt designer. I'd like make the decision whether to use Qt designer and understand the limitations of each tool.


  • Hi Arukas,

    welcome to the forum

    Is it possible to zip your project and make it available to download for us. Then we can have a look at it.

  • Thanks!

    How do I upload my example projects?

  • You can't upload it on this forum directly.

    But there are several free services available like dropbox.
    Follow the instructions in the "forum help": like you do for an image and put the link to your dropbox file here.

  • Here's is the link:

    There are two files, the books example and my attempt at the example. The folder mysort is what I did.


  • Hi Arukas,

    I found some time to look into your files.

    there is an easy solution :
    delete the ui_sortdialog.h you have there and recompile. It works for me.

    let moc generate that one automatically.
    for more information on moc see "this article": Basically when moc sees that file it won't generate your changes.

  • Hi Eddy,

    Thanks for the reply. I problems though.

    I did as you suggested, but I still can't get it to work. I don't know if it makes a difference but I ran qmake from the Qt Creator 4.6.2.

    After reading the doc, I deleted the release and debug directories. I deleted the ui_sortdialog.h and all the make files. I added the "config =+ qt" to the .pro file. I then ran qmake from inside Qt Creator. And it generated everything, and then I ran my program and I still have the same problem.

    According to that document, qmake will invoke the MOC. Everything is generated, but when I run the program I have the same problem. I even cut and pasted the .pro file from the example into my example and still nothing.

    Where am I going wrong?

    Edit: i meant Qt Creator

  • That's strange. Your code and ui file are ok.

    I tested it using Qt4.7.4 but 4.6.2 should work too.

    If a complete cleanup and rebuild doesn't work, i'm out of ideas.

  • I tried on a different computer but with qt 4.7.4. It still does not work. The baffling part is the example code works for me, but my form does not. I cut and pasted everything but the actual form.

    I've looked inside of the ui_sortdialog.h my form generates and the connect signal to slot function for the toggle(bool) to setVisiable(bool) is there.

    I'm thinking, I didn't set something on my form correctly or I have the configuration set correctly either.

    I haven't tried using the accept and reject slots with the click signals for the dialog buttons and those work fine.

    This issue is driving me bonkers. Somethings not working and I'd like to identify it.

  • You forgot to set your more button checkable. When it is not checkable it always fires with an arg of false.

    Edit: Yikes 30sec faster and you wouldn't be pulling hairs out.. these small and banal problems are the worst :)

    Edit 2: And in this case only clicked is sent. How the other poster could get it working I don't know? I'm on Qt 4.7.3 (64 bit) Debian

  • Thanks! I got it to work! I knew there was something that wasn't right. I'll remember that checkable problem.

Log in to reply