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. Changing data in the core of the UI
Forum Updated to NodeBB v4.3 + New Features

Changing data in the core of the UI

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 713 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.
  • S Offline
    S Offline
    SigintNinja
    wrote on last edited by
    #1

    Hi guys,

    very new to using qt designer...

    i have created a main window with my logo in the top left and four buttons running horizontally to the right.

    How do you go about to change data in the bottom half of the screen to bring up relevant data according to the button you press...then change the screen when you click on a different button?

    eg: i have clients then orders....so when i click on clients it must bring up options regarding clients...to be able to add,delete etc...then when i click on orders the same but for orders....obviously linking to one data base that can pull info and tie it together...

    is this done at a programming level,or can designer handle this sort of thing?

    any first steps appreciated

    1 Reply Last reply
    0
    • R Offline
      R Offline
      reezeus
      wrote on last edited by
      #2

      Hi

      You should implement a slot to do the stuff when the button is clicked, e.g.:

      connect(yourButton, SIGNAL(clicked()), this, SLOT(yourSlot))
      To use "connect" like this, add Q_OBJECT to your header file.

      From this, everytime your button is pressed, it will trigger the slot "yourSlot".

      'yourSlot' should be like this:

      void classname::yourSlot()
      {
      //write your stuff here
      qApp->processEvents();
      }

      Note that if your stuff takes time to run, you should put it in another thread and then emit a signal from the thread to your GUI to display it.

      Hope this helps.

      jsulmJ 1 Reply Last reply
      0
      • R reezeus

        Hi

        You should implement a slot to do the stuff when the button is clicked, e.g.:

        connect(yourButton, SIGNAL(clicked()), this, SLOT(yourSlot))
        To use "connect" like this, add Q_OBJECT to your header file.

        From this, everytime your button is pressed, it will trigger the slot "yourSlot".

        'yourSlot' should be like this:

        void classname::yourSlot()
        {
        //write your stuff here
        qApp->processEvents();
        }

        Note that if your stuff takes time to run, you should put it in another thread and then emit a signal from the thread to your GUI to display it.

        Hope this helps.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @reezeus Why qApp->processEvents();?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • R Offline
          R Offline
          reezeus
          wrote on last edited by
          #4

          qApp->processEvents(); enables to refresh the UI after modifications has been done by the code.
          If you don't put it, your modification will actually be done, but the UI won't take it into account, so you will have the impression that nothing has been done.

          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