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. Automatically Activate Buttons in GUI
Forum Updated to NodeBB v4.3 + New Features

Automatically Activate Buttons in GUI

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.6k Views 1 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.
  • F Offline
    F Offline
    FuryDol
    wrote on last edited by
    #1

    Hi there,

    i created a GUI on which after start of the GUI I sequentially have to press a few buttons which starts different functions that have to be started one after another (always in the same order).

    Is it possible to insert a function that at boot up of the guiwindow automatically presses the buttons one after another?

    I tried implementing this in the constructor (didn't work) and after that i tried it in the main (didn't work either) - Perhaps with a sleep() or delay function? Any ideas? Thx for your help

    1 Reply Last reply
    0
    • IamSumitI Offline
      IamSumitI Offline
      IamSumit
      wrote on last edited by
      #2

      Hi and welcome to devnet.
      Yes this is posible.
      you can use QTimer for that.and set interval b/w one button to another button.
      to activate that button just emit clicked() signal then it automatically pressed/activated.

      Hope this helps.

      Be Cute

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

        Hi and welcome to devnet,

        If each button should be pressed one after the other, are you sure that the design is the best ? Why not have e.g. a state machine ? Or simply each function calling the following using e.g. a QTimer::singleShot ?

        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
        0
        • F Offline
          F Offline
          FuryDol
          wrote on last edited by
          #4

          To the design: I want to have a manual and a automatic mode of the programm - so one where automatically all "basic settings / functions" are loaded or another startup possiblity where it is possible to configure setting by just selecting different buttons/options.

          But what I don't understand is where to put the "emit and QTimer" - could you give me a code example? Because if my constructor is called i am somehow not able to call a button as toggled. At the Beginning no button is called so i need to define the QTimer in the Konstruktor - but somehow it doesnt work. And they have to be toogled and not clicked. Or would i need "global declarations"?

          GUIWindow::GUIWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::GUIWindow)
          {

          ..

          }

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

            If you have these two distinct modes, then you should maybe re-think your architecture.

            Again, it sounds like you should rather have a state machine. Using one you can move it step by step with your buttons or let it run alone when in automatic mode. This would also allow you to change your GUI without having to rethink your complete core logic if needed

            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
            0

            • Login

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