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. Designing a simple project in QT Designer - question
Forum Updated to NodeBB v4.3 + New Features

Designing a simple project in QT Designer - question

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 359 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.
  • A Offline
    A Offline
    Andreswa777
    wrote on 28 Apr 2021, 17:25 last edited by
    #1

    Hello good people.

    I am fairly new to QT Designer and need to do a question for my python (using PyQT5) module.

    High overview of requirements
    I need to create a simple GUI that will show information based on the activity selected. the data shown will then be changed if the activity changes based on the activity list and submit is pressed.

    More detailed & what I currently have
    Currently, I have a list of 3 activities that should be expandable in a QComboBox presented as a drop-down for all the items namely "Act 1", "Act 2" & "Act 3".
    When I press "Submit" (QPushButton) i'd like information about that activity to be shown, I currently have the activity listed in a QList Widget as "Info on Act 1", "Info on Act 2" & "Info on Act 3".

    What I would like to achieve is the following
    With "Act 1" selected from the drop down (QComboBox) when I press "Submit" (QPushButton). Only "Info on Act 1" should be shown. further to that, if I now select "Act 2" and press "Submit" again the info from "Info on Act 2" should show.

    What I think I need to do
    Building from the above, I am not 100% sure if QListWidget should be kept as a hidden widget, and then based on the activity chosen (QComboBox ) the info from QListWidget should write to a QTextBrowser or something with multiple lines of output/display? I am not sure if that is even possible.
    Even if so, I dont really understand how to link up the QComboBox, QPushButton & QListWidget vis signal/slot editor - or if that is even the way to do it?

    I provided a image of the app in runtime for reference, I can provide more info where needed.

    QT Activity.PNG

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 28 Apr 2021, 18:16 last edited by
      #2

      Hi and welcome to devnet,

      Where should the information for the activities come from ?

      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
      • A Offline
        A Offline
        Andreswa777
        wrote on 29 Apr 2021, 14:03 last edited by
        #3

        It will be static info within the python code.
        No user input needed.

        The full question asks that you create a single-page application for a tourist company.
        Choose a random Town in your country with a list of activities for the end-user to click on and then ultimately get information about the activity selected.

        I can post the whole question if needed.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 29 Apr 2021, 18:37 last edited by
          #4

          Then the most simple is to have a QLabel where you replace the text with the data matching what you selected in the combo box.

          Note that depending on the number of location a combo box might not be the best widget to use.

          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
          • A Offline
            A Offline
            Andreswa777
            wrote on 30 Apr 2021, 06:24 last edited by
            #5

            Ahh okay perfect.
            So I can then setText() to update the info based on the Activity chosen.

            Thank for the insight. Will do the needed and test the application.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Andreswa777
              wrote on 30 Apr 2021, 12:16 last edited by
              #6

              Using the insight from SGaist I managed to get the results I wanted by defining a function called pressed that links to the pushButton.

              Based on the comboBox choosen, It sets the Text for a textBrowser to the needed information.
              Small snippet of the code below:

              def pressed(self):
              if self.comboBox.currentIndex() == 0:
              self.textBrowser.setText("Randon info about activity one.")

              Thank SGaist, I just needed another perspective.

              1 Reply Last reply
              0

              1/6

              28 Apr 2021, 17:25

              • Login

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