Note that there are some explanatory texts on larger screens.

plurals
  1. POQListWidgetItem with Radio Button
    primarykey
    data
    text
    <p>I'm working on my first QT application and I have a problem with <code>QListWidgetItems</code>.</p> <p>I will be having different kind of list. for checkboxed list using:</p> <pre><code>listElement[i]-&gt;setFlags(Qt::ItemIsEnabled); listElement[i]-&gt;setCheckState(Qt::Unchecked); </code></pre> <p>works exactly as wanted.</p> <p>But now I want a Radio Button list. so my question is in two parts</p> <ol> <li>can use the same logic that I used for checkBox to create Radio Buttons?</li> <li><p>I have used:</p> <pre><code>listElement[i]-&gt;setFlags(Qt::ItemIsEnabled); QRadioButton *radio1 = new QRadioButton(0); dlList-&gt;setItemWidget(listElement[i],radio1); </code></pre></li> </ol> <p>this will display Items in the list with a radio Button, the problem is that the text is Over the Radio Button:</p> <p>going to try to demonstrate without image</p> <blockquote> <p>This is a test<br> o<br> for elements 1</p> </blockquote> <p>instead for checkbox I have</p> <blockquote> <pre><code> This is a test </code></pre> <p>[] </p> <pre><code> for element 1 </code></pre> </blockquote> <p>how can I get the radioButton to align correctly with text?</p> <p><strong>New Questions:</strong></p> <p>Thanks alot for the answers my text is next to my RadioButton now. </p> <p>Only thing there is no WordWrap, My text is Longer than maximum Size of the RadioButton. How can I get it to wordwrap:</p> <pre><code>rButton = new QRadioButton(); rButton-&gt;setFixedSize(LIST_TEXT_WIDTH_WO_ICON, LIST_TEXT_HEIGHT); rButton-&gt;setStyleSheet("border:none"); rButton-&gt;setFont(segoe18Font); rButton-&gt;setText("This is just a test for elementsss of type euh!!!"); rButton-&gt;setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); dropListWidget-&gt;setItemWidget(listElement, rButton); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload