Designing a simple project in QT Designer - question
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.
Hi and welcome to devnet,
Where should the information for the activities come from ?
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.
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.
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.
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:
if self.comboBox.currentIndex() == 0:
self.textBrowser.setText("Randon info about activity one.")
Thank SGaist, I just needed another perspective.