[rkward-cvs] SF.net SVN: rkward:[2795] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Mar 21 12:07:02 UTC 2010


Revision: 2795
          http://rkward.svn.sourceforge.net/rkward/?rev=2795&view=rev
Author:   tfry
Date:     2010-03-21 12:07:00 +0000 (Sun, 21 Mar 2010)

Log Message:
-----------
Better initial sizing for the select.list-dialog

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/dialogs/rkselectlistdialog.cpp

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2010-03-18 21:29:09 UTC (rev 2794)
+++ trunk/rkward/ChangeLog	2010-03-21 12:07:00 UTC (rev 2795)
@@ -1,4 +1,4 @@
-- Use a native menu, instead of the default TclTk-menu			TODO: sizing, test, discuss the settings page, again
+- Use a native menu, instead of the default TclTk-menu			TODO: test, discuss the settings page, again
 - Fixed: Newly created variables were not properly updated when closing and re-opening the editor
 - Added "paste special" action to script editor and console for pasting R vectors and matrices from spreadsheets
 - Fix order of menus for detached windows

Modified: trunk/rkward/rkward/dialogs/rkselectlistdialog.cpp
===================================================================
--- trunk/rkward/rkward/dialogs/rkselectlistdialog.cpp	2010-03-18 21:29:09 UTC (rev 2794)
+++ trunk/rkward/rkward/dialogs/rkselectlistdialog.cpp	2010-03-21 12:07:00 UTC (rev 2795)
@@ -19,8 +19,6 @@
 
 #include <QListWidget>
 #include <QLabel>
-//#include <QApplication>
-//#include <QDesktopWidget>
 
 #include <klocale.h>
 #include <kvbox.h>
@@ -37,10 +35,10 @@
 	KVBox *page = new KVBox ();
 	setMainWidget (page);
 
+	if (multiple) new QLabel (i18n ("<b>Select one or more:</b>"), page);
+	else new QLabel (i18n ("<b>Select one:</b>"), page);
 	new QLabel (caption, page);
 
-//	int screen_height = qApp->desktop ()->height () - 2*marginHint() - 2*spacingHint ();
-
 	input = new QListWidget (page);
 	input->addItems (choices);
 	if (multiple) input->setSelectionMode (QAbstractItemView::MultiSelection);
@@ -50,6 +48,12 @@
 		if (pos >= 0) input->item (pos)->setSelected (true);
 	}
 
+	QSize base_hint = minimumSizeHint ();
+	int other_height = base_hint.height () - input->minimumSizeHint ().height ();	// height of all other things besides the list widget
+	int ideal_height = other_height + qMax (input->sizeHintForRow (0)*input->count (), 50);
+	// KDialog appears to be smart enough to limit this to the available screen geometry
+	setInitialSize (QSize (base_hint.width (), ideal_height));
+
 	connect (input, SIGNAL (itemSelectionChanged()), this, SLOT (updateState()));
 	updateState ();
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list