Results 1 to 2 of 2

Thread: highlight problem

  1. #1
    Join Date
    May 2010
    Posts
    1
    Qt products
    Qt4

    Default highlight problem

    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..

  2. #2
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: highlight problem

    Use qstyle. Easy way in QtCrator click on qpushbutton and chose "change style sheet" and past:
    Qt Code:
    1. QPushButton::hover{
    2. 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));
    3. }
    To copy to clipboard, switch view to plain text mode 
    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

Similar Threads

  1. QListWidget syntax highlight
    By Ken_Afford in forum Qt Programming
    Replies: 1
    Last Post: 22nd January 2010, 15:54
  2. highlight in QTextEdit
    By ubuntudevelop78 in forum Qt Programming
    Replies: 1
    Last Post: 27th November 2009, 00:22
  3. Widget highlight problem
    By shadowfax in forum Newbie
    Replies: 1
    Last Post: 14th July 2009, 09:23
  4. Highlight row in treeview
    By supergillis in forum Qt Programming
    Replies: 6
    Last Post: 20th November 2008, 08:49
  5. Syntax highlight selection problem
    By s.toonen in forum Qt Programming
    Replies: 9
    Last Post: 4th June 2008, 12:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.