[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: test case: buttons not updated when text changed via javascript
From: David Faure <david () mandrakesoft ! com>
Date: 2002-03-21 0:32:32
[Download RAW message or body]
On Tuesday 19 March 2002 10:00, Aaron J. Seigo wrote:
> hi.
>
> attached is a small test case of something that worked last week, but doesn't
> work this week. it also works in other browser such as netscape.
>
> when you click on the "Not Changed" button, it should have its label changed
> to "Changed". but it doesn't, it still says "Not Changed".
>
> the internal value of the button gets updated however, since if when its value
> value is assigned to the lineedit right below it, the lineedit's value
> changes.
>
> evidently the actual push button is not being redrawn to reflect the new value
This fixes it.
--
David FAURE, david@mandrakesoft.com, faure@kde.org
http://people.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
["render_submit.diff" (text/x-diff)]
? render_flow.cpp.debug
? thediffv1
Index: render_form.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_form.cpp,v
retrieving revision 1.169
diff -u -p -r1.169 render_form.cpp
--- render_form.cpp 2002/03/15 22:53:09 1.169
+++ render_form.cpp 2002/03/21 00:31:14
@@ -287,10 +287,8 @@ RenderSubmitButton::RenderSubmitButton(H
connect(p, SIGNAL(clicked()), this, SLOT(slotClicked()));
}
-void RenderSubmitButton::calcMinMaxWidth()
+QString RenderSubmitButton::rawText()
{
- KHTMLAssert( !minMaxKnown() );
-
QString value = element()->value().isEmpty() ? defaultLabel() : element()->value().string();
value = value.stripWhiteSpace();
QString raw;
@@ -299,7 +297,14 @@ void RenderSubmitButton::calcMinMaxWidth
if(value[i] == '&')
raw += '&';
}
+ return raw;
+}
+void RenderSubmitButton::calcMinMaxWidth()
+{
+ KHTMLAssert( !minMaxKnown() );
+
+ QString raw = rawText();
static_cast<QPushButton*>(m_widget)->setText(raw);
static_cast<QPushButton*>(m_widget)->setFont(style()->font());
@@ -317,6 +322,12 @@ void RenderSubmitButton::calcMinMaxWidth
setIntrinsicHeight( s.height() );
RenderButton::calcMinMaxWidth();
+}
+
+void RenderSubmitButton::updateFromElement()
+{
+ static_cast<QPushButton*>(m_widget)->setText(rawText());
+ RenderFormElement::updateFromElement();
}
QString RenderSubmitButton::defaultLabel() {
Index: render_form.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_form.h,v
retrieving revision 1.69
diff -u -p -r1.69 render_form.h
--- render_form.h 2002/02/27 02:39:58 1.69
+++ render_form.h 2002/03/21 00:31:14
@@ -169,8 +169,10 @@ public:
virtual QString defaultLabel();
virtual void calcMinMaxWidth();
+ virtual void updateFromElement();
virtual short baselinePosition( bool ) const;
-
+private:
+ QString rawText();
};
// -------------------------------------------------------------------------
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic