Results 1 to 8 of 8

Thread: Texturizing Widgets

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Texturizing Widgets

    I am worked on jpn's last code and this is the final implementation:

    Qt Code:
    1. GmcListView::GmcListView(QWidget *parent)
    2. :QListView(parent)
    3. {
    4. setEditTriggers(QAbstractItemView::NoEditTriggers );
    5. QPalette palette = this->palette();
    6. palette.setBrush(QPalette::Highlight, QBrush(QPixmap(":images/selected.png")));
    7. palette.setBrush(QPalette::Base, QBrush(QPixmap(":images/notselected.png")));
    8. setPalette(palette);
    9. }
    To copy to clipboard, switch view to plain text mode 

    (no need to use setStyleSheet()).

    Now I have customize the scrollbar look. I'd thought to create a QScrollBar widget with listView as parent thinking so to substitute the default one and working on it, but now my listView have two scrollbars...

    Soon as I have a solution will post it.
    Giuseppe CalÃ

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Texturizing Widgets

    Quote Originally Posted by jiveaxe View Post
    Now I have customize the scrollbar look. I'd thought to create a QScrollBar widget with listView as parent thinking so to substitute the default one and working on it, but now my listView have two scrollbars...
    There is no need to create new scroll bars. You can access the existing scrollbars via QAbstractScrollArea::horizontalScrollBar() and QAbstractScrollArea::verticalScrollBar(). Notice that there are quite a few "Customizing QScrollBar" examples: http://doc.trolltech.com/4.3/stylesh...ing-qscrollbar

    Also, you can simply use style sheet selectors to apply the stylesheet to a certain scrollbar. For example a QScrollBar which is child of a QListView:
    Qt Code:
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. Qt3 - Multiple transparent widgets
    By bythesea in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2009, 11:24
  2. widgets behind hidden widgets not working
    By bpetty in forum Newbie
    Replies: 13
    Last Post: 7th September 2007, 20:23
  3. Performance in hiding/showing widgets
    By Paalrammer in forum Newbie
    Replies: 12
    Last Post: 14th February 2007, 18:57
  4. Replies: 11
    Last Post: 7th July 2006, 13:09
  5. Creating Widgets
    By hylke in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 08:37

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
  •  
Qt is a trademark of The Qt Company.