Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to define an OnClick event handler for a button from within Qt Creator when in the form it is not appear(I cant add it from there....)?
Forum Update on Monday, May 27th 2025

How to define an OnClick event handler for a button from within Qt Creator when in the form it is not appear(I cant add it from there....)?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
qpushbuttononclick
2 Posts 2 Posters 731 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.
  • R Offline
    R Offline
    RuWex
    wrote on 18 Dec 2022, 09:48 last edited by
    #1

    I defined a QPushButton in the MainWindow constructor:

    QPushButton *testFewCommands = new QPushButton("&start testing few commands", this);
    

    and now, I want to add OnClick function In the designer this button doesn't appear, how can I do it?

    J 1 Reply Last reply 18 Dec 2022, 10:39
    0
    • R RuWex
      18 Dec 2022, 09:48

      I defined a QPushButton in the MainWindow constructor:

      QPushButton *testFewCommands = new QPushButton("&start testing few commands", this);
      

      and now, I want to add OnClick function In the designer this button doesn't appear, how can I do it?

      J Offline
      J Offline
      JonB
      wrote on 18 Dec 2022, 10:39 last edited by
      #2

      @RuWex
      I don't know that you can given that the button is not in the Designer, and it wouldn't work even if you could. Why would you want to anyway? If you add a button in code do the connect() in code for sure.

      1 Reply Last reply
      1

      2/2

      18 Dec 2022, 10:39

      • Login

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