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

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/kdeui
From:       Jaroslaw Staniek <js () iidea ! pl>
Date:       2006-02-01 14:15:32
Message-ID: 1138803332.048440.27172.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 504601 by staniek:

Aditional fix to make KURLLabel as compatible with the old behaviour 
as possible (required at least by Konqueror): 

 When size policy is set to fixed/fixed, 
 keep margin == 0 and accept mouse clicks for entire widget's area.

thx to: Stephan Binner
 


 M  +16 -6     kurllabel.cpp  
 M  +5 -0      kurllabel.h  


--- branches/KDE/3.5/kdelibs/kdeui/kurllabel.cpp #504600:504601
@@ -405,6 +405,8 @@
 QRect KURLLabel::activeRect() const
 {
   QRect r( contentsRect() );
+  if (text().isEmpty() || (!d->MarginAltered && sizePolicy() == \
QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed))) +      return r; //fixed size \
is sometimes used with pixmap  int hAlign = QApplication::horizontalAlignment( \
alignment() );  int indentX = (hAlign && indent()>0) ? indent() : 0;
   QFontMetrics fm(font());
@@ -422,18 +424,26 @@
 
 void KURLLabel::setMargin( int margin )
 {
-	QLabel::setMargin(margin);
-	d->MarginAltered = true;
+  QLabel::setMargin(margin);
+  d->MarginAltered = true;
 }
 
 void KURLLabel::setFocusPolicy( FocusPolicy policy )
 {
-	QLabel::setFocusPolicy(policy);
-	if (!d->MarginAltered) {
-		QLabel::setMargin(policy == NoFocus ? 0 : 3); //better default : better look when \
                focused
-	}
+  QLabel::setFocusPolicy(policy);
+  if (!d->MarginAltered) {
+      QLabel::setMargin(policy == NoFocus ? 0 : 3); //better default : better look \
when focused +  }
 }
 
+void KURLLabel::setSizePolicy ( QSizePolicy policy )
+{
+  QLabel::setSizePolicy(policy);
+  if (!d->MarginAltered && policy.horData()==QSizePolicy::Fixed && \
policy.verData()==QSizePolicy::Fixed) { +      QLabel::setMargin(0); //better default \
: better look when fixed size +  }
+}
+
 void KURLLabel::virtual_hook( int, void* )
 { /*BASE::virtual_hook( id, data );*/ }
 
--- branches/KDE/3.5/kdelibs/kdeui/kurllabel.h #504600:504601
@@ -163,6 +163,11 @@
    */
   virtual void setFocusPolicy ( FocusPolicy policy );
 
+  /**
+   * Reimplemented for internal reasons, the API is not affected.
+   */
+  virtual void setSizePolicy ( QSizePolicy );
+
 public slots:
   /**
    * Turns on or off the underlining.


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

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