Changeset View
Changeset View
Standalone View
Standalone View
kcalcdisplay.cpp
Show First 20 Lines • Show All 997 Lines • ▼ Show 20 Line(s) | |||||
998 | // Name: sizeHint | 998 | // Name: sizeHint | ||
999 | // Desc: | 999 | // Desc: | ||
1000 | //------------------------------------------------------------------------------ | 1000 | //------------------------------------------------------------------------------ | ||
1001 | QSize KCalcDisplay::sizeHint() const { | 1001 | QSize KCalcDisplay::sizeHint() const { | ||
1002 | 1002 | | |||
1003 | // basic size | 1003 | // basic size | ||
1004 | QSize sz = fontMetrics().size(Qt::TextSingleLine, text_); | 1004 | QSize sz = fontMetrics().size(Qt::TextSingleLine, text_); | ||
1005 | 1005 | | |||
1006 | // expanded by half font height to make room for the status texts | 1006 | // expanded by 3/4 font height to make room for the status texts | ||
1007 | QFont fnt(font()); | 1007 | QFont fnt(font()); | ||
1008 | fnt.setPointSize(qMax((fnt.pointSize() / 2), 7)); | 1008 | fnt.setPointSize(qMax(((fnt.pointSize() * 3) / 4), 7)); | ||
1009 | 1009 | | |||
1010 | const QFontMetrics fm(fnt); | 1010 | const QFontMetrics fm(fnt); | ||
1011 | sz.setHeight(sz.height() + fm.height()); | 1011 | sz.setHeight(sz.height() + fm.height()); | ||
1012 | 1012 | | |||
1013 | QStyleOptionFrame option; | 1013 | QStyleOptionFrame option; | ||
1014 | initStyleOption(&option); | 1014 | initStyleOption(&option); | ||
1015 | 1015 | | |||
1016 | return (style()->sizeFromContents(QStyle::CT_LineEdit, &option, sz.expandedTo(QApplication::globalStrut()), this)); | 1016 | return (style()->sizeFromContents(QStyle::CT_LineEdit, &option, sz.expandedTo(QApplication::globalStrut()), this)); | ||
1017 | } | 1017 | } |