Results 1 to 2 of 2

Thread: Hijack QWidget::setStyleSheet for a QObject class (non QWidget) ?

  1. #1
    Join Date
    Dec 2008
    Posts
    16
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Hijack QWidget::setStyleSheet for a QObject class (non QWidget) ?

    I would like to set multiple properties for my QObjects with the versatile stylesheet syntax. The selecting of particular QObjects in my hierarchies would be essentially very helpfull. I dont want to make all these classes QWidgets (which would make no sense). Is there any way to use the mechanism ?

    Sidenote: QDeclerativeContext in 4.6 seems to do a similar thing, but I would prefer to work on the bounds of 4.5.

    Thx!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Hijack QWidget::setStyleSheet for a QObject class (non QWidget) ?

    Style sheets are meant for widgets only. You can use QObject::findChildren() to find the objects you are interested in and then use QObject::setProperty() to manipulate their properties.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    muenalan (16th January 2011)

Similar Threads

  1. From QObject to QWidget
    By Maxilys in forum Qt Programming
    Replies: 3
    Last Post: 2nd February 2014, 18:07
  2. Replies: 1
    Last Post: 16th September 2010, 16:57
  3. QModelIndex Mapping in Template QWidget Class
    By stefanadelbert in forum Qt Programming
    Replies: 1
    Last Post: 1st March 2010, 08:19
  4. Use QWidget derived class in Dialog
    By qtneuling in forum Qt Tools
    Replies: 2
    Last Post: 18th May 2008, 00:29
  5. Replies: 1
    Last Post: 2nd May 2006, 22:11

Tags for this Thread

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.