On Tue, May 03, 2011 at 08:43:07PM +0200, Pavel Sanda wrote: > José Matos wrote: > > There are several reasons associated, we should avoid to nest too much our > > code, if we have a 5 nested levels it becomes increasingly difficult to > > read > > the code. > > i didnt want to use 5 nested levels. > > > With widespread pages it is difficult to read any text, be it code or > > literature. > > > > well i dont read the code as a text. for example the second case > looks much more usefull for me, since its 2x smaller in vertical > sense and my eyes go through the code faster. > > compare these two: > connect(table, SIGNAL(rowsChanged(int)), > rowsSB, SLOT(setValue(int))); > connect(table, SIGNAL(colsChanged(int)), > columnsSB, SLOT(setValue(int))); > connect(rowsSB, SIGNAL(valueChanged(int)), > table, SLOT(setNumberRows(int))); > connect(columnsSB, SIGNAL(valueChanged(int)), > table, SLOT(setNumberColumns(int))); > connect(rowsSB, SIGNAL(valueChanged(int)), > this, SLOT(change_adaptor())); > connect(columnsSB, SIGNAL(valueChanged(int)), > this, SLOT(columnsChanged(int)) ); > connect(valignCO, SIGNAL(highlighted(QString)), > this, SLOT(change_adaptor())); > connect(halignED, SIGNAL(textChanged(QString)), > this, SLOT(change_adaptor())); > connect(decorationCO, SIGNAL(activated(int)), > this, SLOT(decorationChanged(int))); > > and > > connect(table, SIGNAL(rowsChanged(int)), rowsSB, SLOT(setValue(int))); > connect(table, SIGNAL(colsChanged(int)), columnsSB, > SLOT(setValue(int))); > connect(rowsSB, SIGNAL(valueChanged(int)), table, > SLOT(setNumberRows(int))); > connect(columnsSB, SIGNAL(valueChanged(int)), table, > SLOT(setNumberColumns(int))); > connect(rowsSB, SIGNAL(valueChanged(int)), this, > SLOT(change_adaptor())); > connect(columnsSB, SIGNAL(valueChanged(int)), this, > SLOT(columnsChanged(int)) ); > connect(valignCO, SIGNAL(highlighted(QString)), this, > SLOT(change_adaptor())); > connect(halignED, SIGNAL(textChanged(QString)), this, > SLOT(change_adaptor())); > connect(decorationCO, SIGNAL(activated(int)), this, > SLOT(decorationChanged(int)));
Five out of the last seven lines wrap for me even when reading mail. That makes reading patches harder (and that's even something I still do) The last three would not if 'this, ' were omitted (that works) [...and none would be needed if it were written as connect(table, "2rowsChanged(int)", rowsSB, "1setValue(int)"); connect(table, "2colsChanged(int)", columnsSB, "1setValue(int)"); connect(rowsSB, "2valueChanged(int)", table, "1setNumberRows(int)"); connect(columnsSB, "2valueChanged(int)", table, "1setNumberColumns(int)"); connect(rowsSB, "2valueChanged(int)", this, "1change_adaptor()"); connect(columnsSB, "2valueChanged(int)", this, "1columnsChanged(int)"); connect(valignCO, "2highlighted(QString)", this, "1change_adaptor()"); connect(halignED, "2textChanged(QString)", this, "1change_adaptor()"); connect(decorationCO, "2activated(int)", this, "1decorationChanged(int)"); - but I guess I'd better not propose that ;-)] > > I don't care so much about the 80 chars limit but certainly we should set > > on > > some limit and try to follow for the reasons above. > > 100? :) Qt has 100. I personally still prefer to have two editors side-by-side on the laptop and three on the normal screen. Andre'