Results 1 to 3 of 3

Thread: Style3sheet problem, QTreeView for specific object

  1. #1
    Join Date
    Dec 2009
    Posts
    62
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Style3sheet problem, QTreeView for specific object

    Hi

    I have a QTreeView called contactList. I want to use a stylesheet specifically for this object.

    If I do like this:
    QTreeView {
    background-image: url(:images/myImg.png);
    background-repeat: 0;background-position: center;
    background-color: red;
    }

    It works, but then all QTreeViews will have this style sheet. So I want to do like this:

    QTreeView#contactList {
    background-image: url(:/images/myImg.png);
    background-repeat: 0;background-position: center;
    background-color: red;
    }

    But then nothing happens with that QTreeView.

    I am using Windows Vista.

    Anyone knows what might be the issue.

    I have also tried with a QLineEdit. Same thing, this is ok:
    QLineEdit {
    background-color: red;
    }

    but with this nothing happens:
    QLineEdit#name {
    background-color: red;
    }

  2. #2
    Join Date
    Dec 2009
    Posts
    62
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Style3sheet problem, QTreeView for specific object

    answering myself.

    Used setObjectName and it worked.

  3. #3
    Join Date
    Jan 2010
    Posts
    73
    Thanks
    6
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Style3sheet problem, QTreeView for specific object

    I assume that you set the object name to contactList .

Similar Threads

  1. Replies: 1
    Last Post: 23rd January 2010, 22:04
  2. Replies: 0
    Last Post: 25th November 2009, 15:07
  3. Problem with specific font
    By ratsrcute in forum Qt Programming
    Replies: 1
    Last Post: 21st February 2009, 14:57
  4. Signal to specific object slot
    By bunjee in forum Qt Programming
    Replies: 2
    Last Post: 27th December 2007, 15:51
  5. Problem with my object hierarchy
    By rage in forum Qt Programming
    Replies: 1
    Last Post: 10th October 2007, 09:18

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.