[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    PATCH: KHTML TextAreaWidget
From:       "Dawit A." <adawit () kde ! org>
Date:       2002-05-26 3:57:01
[Download RAW message or body]

Hi,

I wonder if this is acceptable.  All the K* versions of the line edit widgets 
we have, i.e. KLineEdit and KComboBox as well as their dervaties render a
read-only widget slightly differently than the corresponding Qt classes do.
This patch is intended to make this consistent by applying the same thing
to TextAreaWidget of KHTML.  FYI, the KDE version of read-only widget's
are drawn with the same background color as disabled widgets, except the
text color is NOT changed.  This is done to distinguish it from a read-write 
edit widget.

Having stated that I am not sure if this is the proper place for the patch 
since we probably want to this to be consistent through KDE.  Perhaps we 
should have a KTextEdit ?  I really do not want to make a new class just to 
override this one feature though, but if there is interest to make things 
look consistent then I can do that.

Regards,
Dawit A.

["render_form.diff" (text/x-diff)]

Index: render_form.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_form.cpp,v
retrieving revision 1.180
diff -u -p -b -B -w -r1.180 render_form.cpp
--- render_form.cpp	2002/05/23 23:09:19	1.180
+++ render_form.cpp	2002/05/26 03:48:00
@@ -1033,6 +1033,26 @@ bool TextAreaWidget::event( QEvent *e )
     return QTextEdit::event( e );
 }
 
+void TextAreaWidget::setReadOnly( bool readOnly )
+{
+    QPalette p = palette();
+    if (readOnly)
+    {
+        QColor color = p.color(QPalette::Disabled, QColorGroup::Background);
+        p.setColor(QColorGroup::Base, color);
+        p.setColor(QColorGroup::Background, color);
+    }
+    else
+    {
+        QColor color = p.color(QPalette::Normal, QColorGroup::Base);
+        p.setColor(QColorGroup::Base, color);
+        p.setColor(QColorGroup::Background, color);
+    }
+    setPalette(p);
+    
+    QTextEdit::setReadOnly( readOnly );
+}
+
 // -------------------------------------------------------------------------
 
 RenderTextArea::RenderTextArea(HTMLTextAreaElementImpl *element)
Index: render_form.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_form.h,v
retrieving revision 1.71
diff -u -p -b -B -w -r1.71 render_form.h
--- render_form.h	2002/05/09 23:18:24	1.71
+++ render_form.h	2002/05/26 03:48:00
@@ -374,6 +374,8 @@ class TextAreaWidget : public QTextEdit
 {
 public:
     TextAreaWidget(int wrap, QWidget* parent);
+    
+    virtual void setReadOnly ( bool );
 
 protected:
     virtual bool event (QEvent *e );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic