PDA

View Full Version : stylesheet



BalaQT
18th March 2010, 14:45
hi ,
im using qt4.5 in debian

i want to set the focus color of Qcombobox.
so i wrote the following code


this->setStyleSheet("QComboBox:focus { background: yellow;}");


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

zgulser
18th March 2010, 15:12
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..

BalaQT
19th March 2010, 08:45
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

this->setStyleSheet("QComboBox:focus { background: yellow;}");
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