[escher] add a minimal size to textfield

Change-Id: I6d1c4d0e687bc66aeadd4913ea4b3a94d7c26b75
This commit is contained in:
Émilie Feral
2016-11-03 15:20:56 +01:00
parent cc297374ba
commit 2f42476604
2 changed files with 6 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ public:
const char * textBuffer() const;
int bufferLength() const;
void setTextBuffer(const char * text);
KDSize minimalSizeForOptimalDisplay() override;
protected:
#if ESCHER_VIEW_LOGGING
const char * className() const override;

View File

@@ -72,3 +72,8 @@ void TextField::setTextBuffer(const char * text) {
m_currentTextLength = strlen(text);
markRectAsDirty(bounds());
}
KDSize TextField::minimalSizeForOptimalDisplay() {
KDSize textSize = KDText::stringSize(m_textBuffer);
return KDSize(0, textSize.height());
}