Radio button and Display Widgets on qt4-designer
I have a shell script with an old text-based user interface: I want to replace my shell code with python and create a graphical user interface using qt designer tool and pyside.
I was able to add a menu bar, a tab and some radio buttons.
When a user selects a radio button I would like to show in a text box a brief description of what that selection means; when it selects another radio button a different description on the same text box should appear and so on.
My questions are:
What widget should I use as text box ? I was thinking at Text Browser as Display Widget, but I'm not sure. A Label ? A Text Edit ? When I connect a radio button to the Text Browser I can see some interesting slots under the Text Browser such as insertHtml or insertPlainText, but as soon as I select the signal clicked() on the radio button they disappear and I'm not even able to find them again. I tried also to connect a button with a Label widget, but I'm not able to find any kind of setText slot. Reading the documentation I know setText exists, but I cannot use it inside my code.
Thanks for any kind of your support.
Hi and welcome to devnet,
You can't connect the radio button directly to your label or text browser. You have to use an intermediated slot e.g. in your MainWindow where you will load your text and call setText or insertPlainText (depending on the widget you will choose)
You should take a look at Qt's documentation Examples and Demos, there is a lot of good information there to get you started
Thanks for your reply.
Do you have any link for me ?
I'm trying to follow this guide, but I'm not able to solve my issue
What if you use the toolTip for that purpose? You may modify the duration to give your user enough time to read.
I need to describe what the radio button does and that description is quite long.
And in the descrption I would like the user copy some commands.
You can use a QButtonGroup and connect the buttonClicked(int) signal to a slot so based on the button id you can update the label with the explanation