trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: October 2012

Re: [trinity-devel] How to indent and disable a new GUI widget

From: "Timothy Pearson" <kb9vqf@...>
Date: Fri, 12 Oct 2012 12:46:39 -0500
>> I'm fiddling with a bug report hoping to learn how to manipulate a check
>> box in a kcontrol
>> dialog.
>>
>> I successfully added the checkbox and the check box functions correctly.
>>
>> The next step is I want the check box indented under the
>> previous check box to signify a dependency relationship:
>>
>> | | Check box
>>     | | New check box
>>
>> The control layouts are defined in a *.ui file. What is the
>> correct way (examples) in a *.ui file to indent controls? I
>> started playing with <grid></grid> and
>> row/column. I had some nominal success but I don't really
>> understand how row/column/rowspan/colspan all work
>> together.
>
> Anybody?
>
> This is in reference to bug report 258.
>
> I figured out how to disable (signals and slots). I just need help with
> the indenting.
>
> Darrell

The check box can be indented by a fixed space via a spacer widget, but I
suspect that will not yield consistent/correct results across various
widget styles.  The spacer widget would ideally be set to the width of a
checkbox by querying the pixel metrics of the current style via 
TQStyle::PM_IndicatorWidth.  Here is some untested example code which
should be run immediately after creation of the GUI elements and before
they are shown:

MySpacer->setWidth(kapp->style().pixelMetric(TQStyle::PM_IndicatorWidth));

Tim