[escher/pointer_text_view] Clean minimalSizeForOptimalDisplay

It was unneedingly overriden + added escape case on nullptr text
This commit is contained in:
Léa Saviot
2019-01-09 10:00:13 +01:00
parent 43522d0dc9
commit 05bfbe83ac
3 changed files with 3 additions and 5 deletions

View File

@@ -10,7 +10,6 @@ public:
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
const char * text() const override { return m_text; }
void setText(const char * text) override;
KDSize minimalSizeForOptimalDisplay() const override;
private:
const char * m_text;
};

View File

@@ -14,7 +14,3 @@ void PointerTextView::setText(const char * text) {
markRectAsDirty(bounds());
}
}
KDSize PointerTextView::minimalSizeForOptimalDisplay() const {
return m_font->stringSize(text());
}

View File

@@ -33,6 +33,9 @@ void TextView::setFont(const KDFont * font) {
}
KDSize TextView::minimalSizeForOptimalDisplay() const {
if (text() == nullptr) {
return KDSize(0,0);
}
return m_font->stringSize(text());
}