[Qt-interest] PushButton Zoom

Ulf-Alexander v. Ceumern-Lindenstjerna ceumern at vrmagic.com
Tue Feb 23 09:34:07 CET 2010


Hi.

First of all, never use a background on a button:
http://doc.trolltech.com/4.6/stylesheet-examples.html#qpushbutton-and-im
ages

Secondly: you can try to set different styles for the QPushButton when a
mouse is hovering over it:

QPushButton { 
border: 2px solid black;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0
rgba(247, 247, 247, 255), stop:0.602273 rgba(225, 225, 225, 255), stop:1
rgba(217, 217, 217, 255));
min-width: 50px; 
min-height: 50px; 
max-width: 50px; 
max-height: 50px; 
} 
  
QPushButton:hover { 
border: 2px solid white;
min-width: 100px; 
min-height: 100px; 
max-width: 100px; 
max-height: 100px; 
}

However it does not seem to update its width and height. I would advise
against resizing it dynamically anyway since your layout would have to
be updated causing your widgets to be moved around. This will only
distract your user. Try highlighting the button instead with a different
border image.

Hth, Ulf


> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Puneet Bisht
> Sent: Tuesday, February 23, 2010 9:14 AM
> To: Qt-interest at trolltech.com
> Subject: [Qt-interest] PushButton Zoom
> 
> Hi all,
> 
> Is there any way to zoom a pushbutton when the mouse cursor is over
it.
> i have set a background image on that pushbutton.
> 
> i tried same with a toolbutton also but no success .
> 
> Thanks
> Puneet
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list