Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to set the receiver of a button?
Qt 6.12 LTS is out! See what's new in the release blog

How to set the receiver of a button?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
2 Posts 2 Posters 582 Views 2 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.
  • M Offline
    M Offline
    Micki
    wrote on last edited by
    #1

    Hi, I'm a total newbie here. I've created a class that is for handling the signals and slots of my buttons. But how do I connect my button to that new class?

    I feel like I'm making unnecessary trouble by putting my slots into this new class of mine, instead of just putting them into the existing MainWindow class.

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

      Hi and welcome to devnet,

      For the how: create an instance of that class and connect as described in the documentation.

      That said, there's nothing wrong in having slots in your QMainWindow subclass. Just beware of not making it a god class that does anything and everything in your application. You must take the time to create a sane architecture for your application.

      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
      2

      • Login

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