Set better column widths in the dive list

This code seems rather crude to me. I'm sure this could be done better.

This also makes the column alignment work again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-02 14:05:53 -07:00
parent f9c97ff97d
commit c4e2c322a3
2 changed files with 39 additions and 6 deletions

View file

@ -434,7 +434,8 @@ QVariant DiveItem::data(int column, int role) const
{
QVariant retVal;
if (role == Qt::TextAlignmentRole) {
switch (role) {
case Qt::TextAlignmentRole:
switch (column) {
case DATE: /* fall through */
case SUIT: /* fall through */
@ -445,9 +446,8 @@ QVariant DiveItem::data(int column, int role) const
retVal = Qt::AlignRight;
break;
}
}
if (role == Qt::DisplayRole) {
break;
case Qt::DisplayRole:
switch (column) {
case NR:
retVal = dive->number;
@ -492,6 +492,7 @@ QVariant DiveItem::data(int column, int role) const
retVal = dive->rating;
break;
}
break;
}
return retVal;
}
@ -598,8 +599,6 @@ QVariant DiveTripModel::data(const QModelIndex& index, int role) const
if (!index.isValid())
return QVariant();
if (role != Qt::DisplayRole)
return QVariant();
TreeItemDT* item = static_cast<TreeItemDT*>(index.internalPointer());