summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-07-16 13:33:59 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-07-16 13:33:59 (GMT)
commit790417ac69cd4fa780d6e298567908fc3d7ef6d0 (patch)
tree5c0f3d876a278738093a7529876542942b42e6f9 /examples
parent5608f5c35dd3f4470f51436ead9a7048d561affa (diff)
downloadQt-790417ac69cd4fa780d6e298567908fc3d7ef6d0.zip
Qt-790417ac69cd4fa780d6e298567908fc3d7ef6d0.tar.gz
Qt-790417ac69cd4fa780d6e298567908fc3d7ef6d0.tar.bz2
Doc: Fixed whitespace issues.
Reviewed-by: Trust Me
Diffstat (limited to 'examples')
-rw-r--r--examples/itemviews/addressbook/addresswidget.cpp2
-rw-r--r--examples/itemviews/addressbook/tablemodel.cpp48
2 files changed, 25 insertions, 25 deletions
diff --git a/examples/itemviews/addressbook/addresswidget.cpp b/examples/itemviews/addressbook/addresswidget.cpp
index e226643..22dfae3 100644
--- a/examples/itemviews/addressbook/addresswidget.cpp
+++ b/examples/itemviews/addressbook/addresswidget.cpp
@@ -230,7 +230,7 @@ void AddressWidget::writeToFile(QString fileName)
return;
}
- QList< QPair<QString, QString> > pairs = table->getList();
+ QList< QPair<QString, QString> > pairs = table->getList();
QDataStream out(&file);
out << pairs;
}
diff --git a/examples/itemviews/addressbook/tablemodel.cpp b/examples/itemviews/addressbook/tablemodel.cpp
index 603c926..e9a08f0 100644
--- a/examples/itemviews/addressbook/tablemodel.cpp
+++ b/examples/itemviews/addressbook/tablemodel.cpp
@@ -72,13 +72,13 @@ QVariant TableModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
-
+
if (index.row() >= listOfPairs.size() || index.row() < 0)
return QVariant();
-
+
if (role == Qt::DisplayRole) {
QPair<QString, QString> pair = listOfPairs.at(index.row());
-
+
if (index.column() == 0)
return pair.first;
else if (index.column() == 1)
@@ -93,15 +93,15 @@ QVariant TableModel::headerData(int section, Qt::Orientation orientation, int ro
{
if (role != Qt::DisplayRole)
return QVariant();
-
+
if (orientation == Qt::Horizontal) {
switch (section) {
case 0:
return tr("Name");
-
+
case 1:
return tr("Address");
-
+
default:
return QVariant();
}
@@ -115,7 +115,7 @@ bool TableModel::insertRows(int position, int rows, const QModelIndex &index)
{
Q_UNUSED(index);
beginInsertRows(QModelIndex(), position, position+rows-1);
-
+
for (int row=0; row < rows; row++) {
QPair<QString, QString> pair(" ", " ");
listOfPairs.insert(position, pair);
@@ -129,9 +129,9 @@ bool TableModel::insertRows(int position, int rows, const QModelIndex &index)
//! [5]
bool TableModel::removeRows(int position, int rows, const QModelIndex &index)
{
- Q_UNUSED(index);
+ Q_UNUSED(index);
beginRemoveRows(QModelIndex(), position, position+rows-1);
-
+
for (int row=0; row < rows; ++row) {
listOfPairs.removeAt(position);
}
@@ -144,25 +144,25 @@ bool TableModel::removeRows(int position, int rows, const QModelIndex &index)
//! [6]
bool TableModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
- if (index.isValid() && role == Qt::EditRole) {
- int row = index.row();
-
- QPair<QString, QString> p = listOfPairs.value(row);
-
- if (index.column() == 0)
- p.first = value.toString();
- else if (index.column() == 1)
- p.second = value.toString();
+ if (index.isValid() && role == Qt::EditRole) {
+ int row = index.row();
+
+ QPair<QString, QString> p = listOfPairs.value(row);
+
+ if (index.column() == 0)
+ p.first = value.toString();
+ else if (index.column() == 1)
+ p.second = value.toString();
else
return false;
-
+
listOfPairs.replace(row, p);
- emit(dataChanged(index, index));
-
+ emit(dataChanged(index, index));
+
return true;
- }
+ }
- return false;
+ return false;
}
//! [6]
@@ -171,7 +171,7 @@ Qt::ItemFlags TableModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::ItemIsEnabled;
-
+
return QAbstractTableModel::flags(index) | Qt::ItemIsEditable;
}
//! [7]