Default equipment column widths
Dirk Hohndel
dirk at hohndel.org
Thu Jun 20 09:58:23 PDT 2013
OK, now after having had enough coffee...
On Thu, 2013-06-20 at 08:13 -0700, Dirk Hohndel wrote:
> It appears to be this routine...
>
> void MainTab::initialUiSetup()
> {
> QSettings s;
> s.beginGroup("MainTab");
> s.beginGroup("Cylinders");
===========^^^^^^^^^^^^^^^^^^^^^^^^
> for (int i = 0; i < CylindersModel::COLUMNS; i++) {
> QVariant width = s.value(QString("colwidth%1").arg(i));
> if (width.isValid())
> ui->cylinders->setColumnWidth(i, width.toInt());
> else
> ui->cylinders->resizeColumnToContents(i);
> }
> s.endGroup();
> s.beginGroup("Weights");
===========^^^^^^^^^^^^^^^^^^^^^^
> for (int i = 0; i < WeightModel::COLUMNS; i++) {
> QVariant width = s.value(QString("colwidth%1").arg(i));
> if (width.isValid())
> ui->weights->setColumnWidth(i, width.toInt());
> else
> ui->weights->resizeColumnToContents(i);
> }
> s.endGroup();
>
> }
>
> So this seems wrong on two levels.
>
> a) it uses the same "colwidth" for Cylinders and Weights (which makes
> very limited sense)
Errr, no it doesn't. Different groups. See above. Oops.
> b) this colwidth is designed to be the colwidth of the divelist (and is
> only ever used in that context).
ditto.
And we do indeed save the values in MainTab::hideEvent()
Which means that basically EVERYTHING I wrote about this topic was just
flat out wrong and bogus.
Great work, /me.
> Or we drop saving this to the settings at all and simply determine the
> size of the columns from the maximum width of all the possible
> completions for each column...
Now that still is something that I'd argue we should do - especially for
first time users (so that they don't need to manually resize the columns
in order for things to look right.
/D
More information about the subsurface
mailing list