From 565ef1bb51ebc7b3be61b2d182d6d136b87e02ab Mon Sep 17 00:00:00 2001 From: Roman Tolchenov Date: Tue, 7 Apr 2015 13:51:34 +0100 Subject: [PATCH] Re #10576. Display when a local parameter is fixed. --- .../CustomInterfaces/src/MultiDatasetFit.cpp | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/MultiDatasetFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/MultiDatasetFit.cpp index 5977860f20e8..8b4c21a3779d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/MultiDatasetFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/MultiDatasetFit.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -744,9 +745,27 @@ bool LocalParameterItemDelegate::eventFilter(QObject * obj, QEvent * ev) void LocalParameterItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const { - auto newOption = option; - //newOption.rect.adjust(10,-1,0,-1); - QStyledItemDelegate::paint(painter, newOption, index); + QStyledItemDelegate::paint(painter, option, index); + + if ( owner()->isFixed(index.row()) ) + { + auto rect = option.rect; + + auto text = index.model()->data(index).asString(); + int textWidth = option.fontMetrics.width(text); + + QString fixedStr(" (fixed)"); + int fWidth = option.fontMetrics.width(fixedStr); + if ( textWidth + fWidth > rect.width() ) + { + fixedStr = "(f)"; + fWidth = option.fontMetrics.width(fixedStr); + } + + double dHeight = (option.rect.height() - option.fontMetrics.height()) / 2; + rect.adjust(rect.width() - fWidth, dHeight, 0 ,-dHeight); + painter->drawText(rect,fixedStr); + } } /*==========================================================================================*/