I noticed some code of a colleague today that initialized class variables in the initialization. However it was causing a warning, he says because of the order they are in. My question is why is it better to do variable initialization where it currently is and not within the curly brackets?
DiagramScene::DiagramScene( int slideNo, QRectF screenRect, MainWindow* parent )
: QGraphicsScene( screenRect, parent ),
myParent( parent ),
slideUndoImageCurrentIndex(-1),
nextGroupID(0),
m_undoInProgress(false),
m_deleteItemOnNextUndo(0)
line(0),
path(0)
{
/* Setup default brush for background */
scDetail->bgBrush.setStyle(Qt::SolidPattern);
scDetail->bgBrush.setColor(Qt::white);
setBackgroundBrush(scDetail->bgBrush);
}