Patch - move model related code from MainWindow and adjustments.

Thiago Macieira thiago at macieira.org
Mon Apr 22 11:04:10 PDT 2013


On segunda-feira, 22 de abril de 2013 09.43.51, Dirk Hohndel wrote:
> Tomaz,
> 
> I know this is the style common in Qt and in many C++ apps... to the C
> programer's eye this is really not nice...
> 
> -MainWindow::MainWindow() : ui(new Ui::MainWindow())
> +MainWindow::MainWindow()
> +: ui(new Ui::MainWindow())
> +, model(new DiveTripModel(this))
> 
> we don't start lines with operators - we end lines with operators. 

I don't like it either. It's meant to minimise the diff when adding a member at 
the end (by avoiding the need to add a comma), but I find it really ugly.

> So
> please keep the first parent class on the same line as the derived class
> and when putting additional classes on a new line, have the comma on the
> previous line and indent the class name with tabs and then spaces to line
> them up:
> 
> MainWindow::MainWindow() : ui(new Ui::MainWindow()),
>                            model(new DiveTripModel(this))
> 
> You may disagree, but I find this much easier to read

I personally prefer ending the constructor line with the colon (:) and use a 
plain one-level indentation on the next line. There's no alignment.

That is:
MainWindow::MainWindow() : 
	ui(new Ui::MainWindow()),
	model(new DiveTripModel(this))

Out of curiosity, do you prefer:

	if (this &&
	    that)
or
	if (this
	    && that)

I guess the former, which is my preference too.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130422/92b3401c/attachment.sig>


More information about the subsurface mailing list