[PATCH] Save and retore splitter dimensions.

Dirk Hohndel dirk at hohndel.org
Sun Apr 28 10:17:37 PDT 2013


On Sun, 2013-04-28 at 10:05 +0100, amit.k.chaudhuri at gmail.com wrote:
> From: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
> 
> Rename splitters and remove seemingly redundant empty splitter.
> 
> Use save/restoreState to save splitter sizes using QSettings.

Cool. Applied and about to push.

> diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
> index c1e15e3..b6adae8 100644
> --- a/qt-ui/mainwindow.cpp
> +++ b/qt-ui/mainwindow.cpp
> @@ -289,9 +289,14 @@ void MainWindow::readSettings()
>  {
>  	QSettings settings("hohndel.org","subsurface");
>  
> -	/* note: section/key i.e. forward slash to separate */
> -	QSize sz = settings.value("MainWindow/size").value<QSize>();
> +	settings.beginGroup("MainWindow");
> +	QSize sz = settings.value("size").value<QSize>();
>  	resize(sz);
> +	ui->mainSplitter->restoreState(
> +		settings.value("mainSplitter").toByteArray());
> +	ui->infoProfileSplitter->restoreState(
> +		settings.value("infoProfileSplitter").toByteArray());

You seem to try very hard to stay within 80 chars per line. We have no
such hard limit. We aim for something like 120 or less, unless doing so
makes the code harder to read (so we have a few of lines that are longer
than that). I reformatted this before pushing...


/D



More information about the subsurface mailing list