@@ -526,27 +526,30 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
526
526
return QVariant ();
527
527
TransactionRecord *rec = static_cast <TransactionRecord*>(index.internalPointer ());
528
528
529
- switch (role)
530
- {
529
+ const auto column = static_cast <ColumnIndex>(index. column ());
530
+ switch (role) {
531
531
case RawDecorationRole:
532
- switch (index.column ())
533
- {
532
+ switch (column) {
534
533
case Status:
535
534
return txStatusDecoration (rec);
536
535
case Watchonly:
537
536
return txWatchonlyDecoration (rec);
537
+ case Date: return {};
538
+ case Type: return {};
538
539
case ToAddress:
539
540
return txAddressDecoration (rec);
540
- }
541
- break ;
541
+ case Amount: return {};
542
+ } // no default case, so the compiler can warn about missing cases
543
+ assert (false );
542
544
case Qt::DecorationRole:
543
545
{
544
546
QIcon icon = qvariant_cast<QIcon>(index.data (RawDecorationRole));
545
547
return platformStyle->TextColorIcon (icon);
546
548
}
547
549
case Qt::DisplayRole:
548
- switch (index.column ())
549
- {
550
+ switch (column) {
551
+ case Status: return {};
552
+ case Watchonly: return {};
550
553
case Date:
551
554
return formatTxDate (rec);
552
555
case Type:
@@ -555,12 +558,11 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
555
558
return formatTxToAddress (rec, false );
556
559
case Amount:
557
560
return formatTxAmount (rec, true , BitcoinUnits::SeparatorStyle::ALWAYS);
558
- }
559
- break ;
561
+ } // no default case, so the compiler can warn about missing cases
562
+ assert ( false ) ;
560
563
case Qt::EditRole:
561
564
// Edit role is used for sorting, so return the unformatted values
562
- switch (index.column ())
563
- {
565
+ switch (column) {
564
566
case Status:
565
567
return QString::fromStdString (rec->status .sortKey );
566
568
case Date:
@@ -573,8 +575,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
573
575
return formatTxToAddress (rec, true );
574
576
case Amount:
575
577
return qint64 (rec->credit + rec->debit );
576
- }
577
- break ;
578
+ } // no default case, so the compiler can warn about missing cases
579
+ assert ( false ) ;
578
580
case Qt::ToolTipRole:
579
581
return formatTooltip (rec);
580
582
case Qt::TextAlignmentRole:
0 commit comments