Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, January 2008
QButtonGroup / Button AutoExclusive problem


Message 1 in thread

This is again referring to my earlier mentioned control containing
multiple QToolButtons in a column.

Each button is checkable.
Each button has AutoExclusive enabled.
All button start off unchecked as default.

However, if I click around enough, I can eventually make it happen where
two buttons will be checked at the same time.

So then I tried QButtonGroup instead. Turned off AutoExclusive on the
buttons, added them to the group instead and made sure that the group
had AutoExclusive enabled.

Exact same behavior.

Now this *is* an issue as the toggled() signal only tells me that a
button was toggled. It does not tell me which button was toggled, I
determine that by checking which button is now checked.

If I have two buttons that are checked then this becomes problematic.

I can probably work around it by remembering the last legitimately
checked button and unchecking it when I receive a signal that a new
button should now be checked. However...that's not really something I
should have to do.

Any thoughts?

Thanks,

Stephan


--
 [ signature omitted ] 

Message 2 in thread

On Thu, 2008-01-03 at 23:14 +0100, Stephan Rose wrote:
> This is again referring to my earlier mentioned control containing
> multiple QToolButtons in a column.
> 
> Each button is checkable.
> Each button has AutoExclusive enabled.
> All button start off unchecked as default.
> 
> However, if I click around enough, I can eventually make it happen where
> two buttons will be checked at the same time.
> 
> So then I tried QButtonGroup instead. Turned off AutoExclusive on the
> buttons, added them to the group instead and made sure that the group
> had AutoExclusive enabled.
> 
> Exact same behavior.
> 
> Now this *is* an issue as the toggled() signal only tells me that a
> button was toggled. It does not tell me which button was toggled, I
> determine that by checking which button is now checked.
> 
> If I have two buttons that are checked then this becomes problematic.
> 
> I can probably work around it by remembering the last legitimately
> checked button and unchecking it when I receive a signal that a new
> button should now be checked. However...that's not really something I
> should have to do.
> 
> Any thoughts?

After looking into this a little more, I just discovered that even
though it *looks* like 2 buttons are checked (drawn in the pressed
state) only one actually *is* checked. I had my code count the number of
checked buttons on every toggle signal and even though I'm looking at 2
visibly checked buttons, the count is only 1.

So it seems that this is only a visual problem.

Matter of fact, if I try hard enough...I can make 5 buttons
simultaneously appear to be checked but the count of actually checked
buttons still remains at 1.

I can provide a screenshot if necessary.

Platform on that note is X11/Linux just in case it matters.

This is the code that adds buttons to my control:

void ActionBar::addAction(const ActionItem& item)
{	
	QToolButton* button = new QToolButton();
	button->setText(item.name());	
	button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
	button->setAutoRaise(true);
	button->setCheckable(true);
	button->setAutoExclusive(true);
	
	connect(button, SIGNAL(toggled(bool)), this, SLOT(toggledEvent(bool)));
	
	m_layout->insertWidget(m_layout->count() - 1, button);	
	
	m_buttons.push_back(button);
	m_items.push_back(item);
}

In case anyone is wondering about the insert, that's so that my buttons
get inserted above the spacer that pushes the buttons to the top. =)

Thanks,

Stephan



--
 [ signature omitted ] 

Message 3 in thread

Stephan Rose wrote:

>> This is again referring to my earlier mentioned control containing
>> multiple QToolButtons in a column.
>> 
>> Each button is checkable.
>> Each button has AutoExclusive enabled.
>> All button start off unchecked as default.
>> 
>> However, if I click around enough, I can eventually make it happen where
>> two buttons will be checked at the same time.
This is a known bug. Scheduled fix in 4.4

Best regards
Christoph

--
 [ signature omitted ] 

Message 4 in thread

On Fri, 2008-01-04 at 11:02 +0100, Christoph Duelli wrote:
> Stephan Rose wrote:
> 
> >> This is again referring to my earlier mentioned control containing
> >> multiple QToolButtons in a column.
> >> 
> >> Each button is checkable.
> >> Each button has AutoExclusive enabled.
> >> All button start off unchecked as default.
> >> 
> >> However, if I click around enough, I can eventually make it happen where
> >> two buttons will be checked at the same time.
> This is a known bug. Scheduled fix in 4.4

Ahh, thanks. Appreciate the info.

On that note, any idea on when 4.4 might be released? 

Thanks,

Stephan

--
 [ signature omitted ] 

Message 5 in thread

Stephan Rose wrote:
>On that note, any idea on when 4.4 might be released?

This quarter (i.e., in 3 months or less). We'll give you more concrete 
dates when we have them.

There's also 4.3.4 before 4.4.0.
-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.