[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenox/konq-embed/kdesrc/khtml/patches
From: Eva Brucherseifer <eva () kde ! org>
Date: 2006-03-17 16:35:46
Message-ID: 1142613346.319177.22547.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 519602 by eva:
- calculate sizes better, this esp. helps when the scaling is on
M +17 -22 rendering_qt2.3.patch
--- trunk/kdenox/konq-embed/kdesrc/khtml/patches/rendering_qt2.3.patch #519601:519602
@@ -469,20 +469,21 @@
QString raw = rawText();
QPushButton* pb = static_cast<QPushButton*>(m_widget);
pb->setText(raw);
-@@ -260,6 +267,17 @@ void RenderSubmitButton::calcMinMaxWidth
+@@ -260,6 +267,18 @@ void RenderSubmitButton::calcMinMaxWidth
bool empty = raw.isEmpty();
if ( empty )
raw = QString::fromLatin1("X");
+#if (QT_VERSION < 0x030000)
+ // this is a QLineEdit/RenderLineEdit compatible sizehint
+ QFontMetrics fm = pb->fontMetrics();
-+ m_widget->constPolish();
+ QSize ts = fm.size( ShowPrefix, raw );
-+ int h = ts.height() + 8;
-+ int w = ts.width() + 2*fm.width( ' ' );
-+ if ( m_widget->style().guiStyle() == Qt::WindowsStyle && h < 26 )
++ int frameW = widget()->style().defaultFrameWidth();
++ int h = ts.height() + 4 + frameW*2;
++ int w = ts.width() + 4 + frameW*2;
++ if ( m_widget->style().guiStyle() == Qt::WindowsStyle && h <= 25 )
+ h = 22;
-+ QSize s = QSize( w + 8, h ).expandedTo( \
m_widget->minimumSizeHint()).expandedTo( QApplication::globalStrut() ); ++ // add \
30% margins to the width (heuristics to make it look similar to IE) ++ QSize s = \
QSize( w*13/10, h ).expandedTo( m_widget->minimumSizeHint()).expandedTo( \
QApplication::globalStrut() ); +#else
QFontMetrics fm = pb->fontMetrics();
QSize ts = fm.size( ShowPrefix, raw);
@@ -527,27 +528,23 @@
}
-@@ -531,14 +556,34 @@ void RenderLineEdit::calcMinMaxWidth()
+@@ -531,14 +556,28 @@ void RenderLineEdit::calcMinMaxWidth()
int size = element()->size();
+#if (QT_VERSION < 0x030000)
-+ int h = fm.height();
-+ int w = fm.width( 'x' ) * (size > 0 ? size : 17); // "some"
++ // copied from QLineEdit::sizeHint (Eva Brucherseifer)
++ int h = fm.height();
++ int w = fm.width( 'x' ) * 17; // "some"
++ int frameW = (widget()->frame() ? widget()->style().defaultFrameWidth() : 0);
+ if ( widget()->frame() ) {
-+ h += 8;
-+ // ### this is not really portable between all styles.
-+ // I think one should try to find a generic solution which
-+ // works with all possible styles. Lars.
-+ // ### well, it is. it's the 1:1 copy of QLineEdit::sizeHint()
-+ // the only reason that made me including this thingie is
-+ // that I cannot get a sizehint for a specific number of characters
-+ // in the lineedit from it. It's not my fault, it's Qt's. Dirk
-+ if ( m_widget->style().guiStyle() == Qt::WindowsStyle && h < 26 )
++ h += 4 + frameW*2;
++ if ( m_widget->style().guiStyle() == Qt::WindowsStyle && h <= 25 )
+ h = 22;
-+ s = QSize( w + 8, h ).expandedTo( QApplication::globalStrut() );
-+ } else
++ s = QSize( w + 4 + frameW*2, h ).expandedTo( QApplication::globalStrut() );
++ } else {
+ s = QSize( w + 4, h + 4 ).expandedTo( QApplication::globalStrut() );
++ }
+#else
int h = fm.lineSpacing();
int w = fm.width( 'x' ) * (size > 0 ? size+1 : 17); // "some"
@@ -558,8 +555,6 @@
+#endif
setIntrinsicWidth( s.width() );
setIntrinsicHeight( s.height() );
-+// setIntrinsicWidth( 10 );
-+// setIntrinsicHeight( 10 );
RenderFormElement::calcMinMaxWidth();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic