On 03/05/2011 20:43, 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)));



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? :)

No. But Qt's connect can be considered as an exception IMO.

Abdel.

pavel

Reply via email to