From 17aeaa134a2e4490387d913c58d7eb19e95dc0df Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 29 Mar 2019 10:54:04 -0400 Subject: [PATCH] [partition] Simplify display-role code for bootloader --- src/modules/partition/core/BootLoaderModel.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/partition/core/BootLoaderModel.cpp b/src/modules/partition/core/BootLoaderModel.cpp index e10a7c930..0598a4f31 100644 --- a/src/modules/partition/core/BootLoaderModel.cpp +++ b/src/modules/partition/core/BootLoaderModel.cpp @@ -119,12 +119,12 @@ BootLoaderModel::data( const QModelIndex& index, int role ) const { if ( role == Qt::DisplayRole ) { - if ( QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString().isEmpty() ) - return QStandardItemModel::data( index, Qt::DisplayRole ).toString(); + QString displayRole = QStandardItemModel::data( index, Qt::DisplayRole ).toString(); + QString pathRole = QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString(); + if ( pathRole.isEmpty() ) + return displayRole; - return tr( "%1 (%2)" ) - .arg( QStandardItemModel::data( index, Qt::DisplayRole ).toString() ) - .arg( QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString() ); + return tr( "%1 (%2)" ).arg( displayRole, pathRole ); } return QStandardItemModel::data( index, role ); }