diff --git a/src/kits/tracker/WidgetAttributeText.cpp b/src/kits/tracker/WidgetAttributeText.cpp index c1e8a9b48a..4b9882b490 100644 --- a/src/kits/tracker/WidgetAttributeText.cpp +++ b/src/kits/tracker/WidgetAttributeText.cpp @@ -1772,6 +1772,16 @@ OpenWithRelationAttributeText::ReadValue() } +float +OpenWithRelationAttributeText::PreferredWidth(const BPoseView *pose) const +{ + BString widthString; + TruncString(&widthString, fRelationText.String(), fRelationText.Length(), + pose, 500, B_TRUNCATE_END); + return pose->StringWidth(widthString.String()); +} + + void OpenWithRelationAttributeText::FitValue(BString *result, const BPoseView *view) { @@ -1786,8 +1796,8 @@ OpenWithRelationAttributeText::FitValue(BString *result, const BPoseView *view) launchWithView->OpenWithRelationDescription(fModel, &fRelationText); fOldWidth = fColumn->Width(); - fTruncatedWidth = TruncString(result, fRelationText.String(), fRelationText.Length(), - view, fOldWidth, B_TRUNCATE_END); + fTruncatedWidth = TruncString(result, fRelationText.String(), + fRelationText.Length(), view, fOldWidth, B_TRUNCATE_END); fDirty = false; } diff --git a/src/kits/tracker/WidgetAttributeText.h b/src/kits/tracker/WidgetAttributeText.h index b4206f6129..64b28adeee 100644 --- a/src/kits/tracker/WidgetAttributeText.h +++ b/src/kits/tracker/WidgetAttributeText.h @@ -357,6 +357,7 @@ class OpenWithRelationAttributeText : public ScalarAttributeText { protected: virtual void FitValue(BString *result, const BPoseView *); virtual int64 ReadValue(); + virtual float PreferredWidth(const BPoseView *) const; const BPoseView *fPoseView; BString fRelationText;