Could someone have a look at this patch? The idea here is not to allow the "headers"---the labels that don't correspond to panels---in these panel stacks to be selected. This is in response to bug 4153. It's very minor, to be sure, but my question is more: Why doesn't this work? As you'll see if you try it, clicking on one of the "headers"---say, "Look and Feel"---causes the appearance of a multi-element selection. And that despite the fact that the selection mode is set to SingleSelection!

I've seen this kind of problem elsewhere, too, and I'm stumped.

Richard

--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Index: PanelStack.cpp
===================================================================
--- PanelStack.cpp	(revision 19888)
+++ PanelStack.cpp	(working copy)
@@ -43,6 +43,7 @@
 	list_->setColumnCount(1);
 	// Hide the pointless list header
 	list_->header()->hide();
+	list_->setSelectionMode(QAbstractItemView::SingleSelection);
 //	QStringList HeaderLabels;
 //	HeaderLabels << QString("Category");
 //	list_->setHeaderLabels(HeaderLabels);
@@ -120,11 +121,15 @@
 
 
 void PanelStack::switchPanel(QTreeWidgetItem * item,
-			     QTreeWidgetItem * /*previous*/)
+			     QTreeWidgetItem * previous)
 {
 	WidgetMap::const_iterator cit = widget_map_.find(item);
-	if (cit == widget_map_.end())
+	if (cit == widget_map_.end()) {
+		list_->blockSignals(true);
+		list_->setCurrentItem(previous);
+		list_->blockSignals(false);
 		return;
+	}
 
 	stack_->setCurrentWidget(cit->second);
 }

Reply via email to