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

List:       kde-commits
Subject:    kdelibs/kate/plugins/isearch
From:       Karol Szwed <gallium () kde ! org>
Date:       2003-09-03 5:59:19
[Download RAW message or body]

CVS commit by gallium: 

just found this old patch on my hdd...

Remove code duplication as per "kde toolbar widget".
This hack won't be required in Qt4 any longer, but lets use it while
it exists and makes things easy.


  M +2 -36     ISearchPlugin.cpp   1.25
  M +1 -5      ISearchPlugin.h   1.13


--- kdelibs/kate/plugins/isearch/ISearchPlugin.cpp  #1.24:1.25
@@ -17,5 +17,5 @@
  */
 
-#include <qtoolbutton.h>
+#include <qlabel.h>
 #include <qregexp.h>
 #include <qstyle.h>
@@ -33,38 +33,4 @@
 K_EXPORT_COMPONENT_FACTORY( ktexteditor_isearch, KGenericFactory<ISearchPlugin>( \
"ktexteditor_isearch" ) )  
-namespace
-{
-
-// Copied from kdebase/konqueror/konq_misc.cc with modifications.
-// Yay code duplication. Hacking widgets to support a specific
-// style is bad bad bad. Why oh why doesn't the toolbar draw the
-// darn gradient once, and then have buttons paint themselves with
-// a mask? (John)
-// Use a toolbutton instead of a label so it is styled correctly. (gallium)
-class KToolBarLabel : public QToolButton
-{
-public:
-        KToolBarLabel( const QString & text, QWidget* parent, const char* name = 0 )
-                : QToolButton( parent, name )
-        { setText( text ); }
-
-protected:
-        QSize sizeHint() const { return QSize( fontMetrics().width( text() ),
-                                               fontMetrics().height() ); }
-        void drawButton( QPainter * p )
-        {
-                // Draw the background
-                style().drawComplexControl( QStyle::CC_ToolButton, p, this, rect(), \
                colorGroup(),
-                    QStyle::Style_Enabled, QStyle::SC_ToolButton );
-                // Draw the label
-                style().drawControl( QStyle::CE_ToolButtonLabel, p, this, rect(), \
                colorGroup(),
-                     QStyle::Style_Enabled );
-}
-        void enterEvent( QEvent* ) {};
-        void leaveEvent( QEvent* ) {};
-};
-
-}
-
 ISearchPluginView::ISearchPluginView( KTextEditor::View *view )
         : QObject ( view ), KXMLGUIClient (view)
@@ -108,5 +74,5 @@ ISearchPluginView::ISearchPluginView( KT
                 actionCollection(), "edit_isearch_reverse" );
 
-        m_label = new KToolBarLabel( i18n("I-Search:"), 0L );
+        m_label = new QLabel( i18n("I-Search:"), 0L, "kde toolbar widget" );
         KWidgetAction* labelAction = new KWidgetAction(
                 m_label,

--- kdelibs/kate/plugins/isearch/ISearchPlugin.h  #1.12:1.13
@@ -32,8 +32,4 @@
 
 class QLabel;
-namespace
-{
-class KToolBarLabel;
-}
 
 class ISearchPlugin : public KTextEditor::Plugin, public \
KTextEditor::PluginViewInterface @@ -100,5 +96,5 @@ private:
         KAction*               m_searchBackwardAction;
         KWidgetAction*         m_comboAction;
-        QGuardedPtr<KToolBarLabel> m_label;
+        QGuardedPtr<QLabel>    m_label;
         QGuardedPtr<KHistoryCombo> m_combo;
         QString        m_lastString;


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

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