@@ -28,20 +28,17 @@ ModelPrinter::ModelPrinter(QObject *parent)
29void ModelPrinter::setSourceModel(QAbstractItemModel * sourceModel)
29void ModelPrinter::setSourceModel(QAbstractItemModel * sourceModel)
31− if (m_model != NULL)
31+ if (m_model != NULL) {
33 disconnect(m_model, SIGNAL(modelReset()), this, SIGNAL(sourceChanged()));
32 disconnect(m_model, SIGNAL(modelReset()), this, SIGNAL(sourceChanged()));
34 disconnect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(sourceChanged()));
33 disconnect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(sourceChanged()));
35 disconnect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(sourceChanged()));
34 disconnect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(sourceChanged()));
37− if (m_model != sourceModel)
36+ if (m_model != sourceModel) {
39 m_model = sourceModel;
37 m_model = sourceModel;
40 Q_EMIT modelChanged();
38 Q_EMIT modelChanged();
41 Q_EMIT sourceChanged();
39 Q_EMIT sourceChanged();
43− if (m_model != NULL)
41+ if (m_model != NULL) {
45 connect(m_model, SIGNAL(modelReset()), this, SIGNAL(sourceChanged()));
42 connect(m_model, SIGNAL(modelReset()), this, SIGNAL(sourceChanged()));
46 connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(sourceChanged()));
43 connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(sourceChanged()));
47 connect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(sourceChanged()));
44 connect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(sourceChanged()));
@@ -89,8 +86,7 @@ QString ModelPrinter::recurse_string(const QModelIndex& index, int level) const
90 int rowCount = m_model->rowCount(index);
87 int rowCount = m_model->rowCount(index);
91 stream << tabify(level) << "child count" << ": " << rowCount << endl;
88 stream << tabify(level) << "child count" << ": " << rowCount << endl;
92− for (int i = 0; i < rowCount; i++)
89+ for (int i = 0; i < rowCount; i++) {
94 QModelIndex child = m_model->index(i, 0, index);
90 QModelIndex child = m_model->index(i, 0, index);
95 str += recurse_string(child, level+1);
91 str += recurse_string(child, level+1);