Results 1 to 3 of 3

Thread: stylesheet

  1. #1
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default stylesheet

    hi ,
    im using qt4.5 in debian

    i want to set the focus color of Qcombobox.
    so i wrote the following code
    Qt Code:
    1. this->setStyleSheet("QComboBox:focus { background: yellow;}");
    To copy to clipboard, switch view to plain text mode 

    In system monitor , i found that the memory usage is very high[ when i scroll the window.].
    when i do a 10 scrolls, the memory increases some kbs on each scroll.

    however , when i subclassed the same(QCombobox), i found memory is normal, even on scrolling.

    i want to know why the memory is taking very much in STYLESHEETS.
    is there any better way to give the backround color of the qcombobox.?

    is using stylesheets for setting the background color is a bad idea? [in memory's concern]

    Bala

  2. #2
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: stylesheet

    What do you mean by focus?

    Mouse press or hover? And background of button or list?

    If you want to change the background of the list when the button pressed

    QListView{ background-color: red }

    You have nothing to do with memory issues I guess..

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

    BalaQT (19th March 2010)

  4. #3
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: stylesheet

    hi
    thnks for the reply.
    i want to set the background color of the qcombobox , when it got focus;
    i tried two options,
    i) using stylesheets
    ii) using subclass
    by using stylesheet
    Qt Code:
    1. this->setStyleSheet("QComboBox:focus { background: yellow;}");
    To copy to clipboard, switch view to plain text mode 
    i found that the memory is increasing on every scroll of the form it contains;

    by using subclass
    i override the focusinevent and set the color of the combobox;
    The memory usage is normal.

    i want to know why the memory usage is high , on every scroll of the form.(using sytlesheets)

    Bala

Similar Threads

  1. QGroupBox stylesheet
    By GuS in forum Qt Programming
    Replies: 2
    Last Post: 16th December 2010, 06:26
  2. Qt Stylesheet
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 22nd January 2009, 14:48
  3. How to do this with StyleSheet
    By yxmaomao in forum Qt Programming
    Replies: 5
    Last Post: 30th May 2008, 08:54
  4. stylesheet
    By phillip_Qt in forum Qt Programming
    Replies: 11
    Last Post: 27th April 2008, 19:11
  5. how to set stylesheet for two QWidget
    By phillip_Qt in forum Qt Programming
    Replies: 3
    Last Post: 10th April 2008, 14:22

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.