PDA

View Full Version : highlight problem



supriyajn
20th May 2010, 17:43
hi...im newbie in qt...
im developing gui application in qt4...for which i need button which highlight on hovering with mouse...
though i have accessed a code from this qt center itself...im not able to apply to pushbutton with background...
ny help???....waiting for sum help...
thk you..

Talei
20th May 2010, 19:00
Use qstyle. Easy way in QtCrator click on qpushbutton and chose "change style sheet" and past:

QPushButton::hover{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 104, 255, 255), stop:0.495 rgba(255, 255, 255, 255), stop:0.505 rgba(255, 0, 0, 255), stop:1 rgba(255, 0, 0, 255));
}
and the changes will be visible immediately in QtCreator (actually QtCDesigner upon mouse hove on the QPushButton) or harder way create qstyle object and apply it to qpushbutton.
Basically qstyle is CSS and all CSS rules apply here as well.
Regards