[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: kurllabel.patch
From: Jarosław Staniek <js () iidea ! pl>
Date: 2006-02-01 11:17:09
Message-ID: 43E098B5.7080409 () iidea ! pl
[Download RAW message or body]
Stephan Binner said the following, On 2006-02-01 11:50:
> On Tuesday 31 January 2006 22:57, Jarosław Staniek wrote:
>
>
>>This is a fix (attached) for apps that set fixed size policy for KURLLabel
>>and expect the margin to be 0. The only one known for me now is Konqueror,
>
>
> That patch fixes the display but with it you cannot click on the icon at all
> anymore which is an even worse regression than before.
This may be because of the activeRect() implementation expecting text to be
present. Attached patch updated for this issue.
--
regards / pozdrawiam,
Jaroslaw Staniek / OpenOffice Polska
Kexi Developer: http://www.kexi-project.org | http://koffice.org/kexi
Kexi Support: http://www.kexi-project.org/support.html
Kexi For MS Windows: http://kexi.pl/wiki/index.php/Kexi_for_MS_Windows
KDE3, KDE4 Libraries For Developing MS Windows Applications:
http://www.kdelibs.com/wiki
["kurllabel.2.patch" (text/plain)]
Index: kurllabel.cpp
===================================================================
--- kurllabel.cpp (revision 504495)
+++ kurllabel.cpp (working copy)
@@ -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 );*/ }
Index: kurllabel.h
===================================================================
--- kurllabel.h (revision 504494)
+++ kurllabel.h (working copy)
@@ -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