How to unselect all widgets from the window when you click somewhere in it?
-
So for example i have a Slider on a mainwindow.. But everytime i debug the app, Slider is selected ( "Screenshot":http://i51.tinypic.com/2lkw4f6.jpg ) The red thing around the slider...
How can when i click on an empty space at that mainwindow every widget be unselected... ( For now i only have a slider but i would like to know how to unselect all )....
-
The slider is not selected, it has focus. There is always a widget on your form that has focus, to make key navigation possible. If you put another widget on your form, you'll see that you can make that widget get the focus instead.
-
Can't you deal with it with QWidget::setFocus() ?
-
Yes focus, right i couldn't explain it..
Desktop Drapes has also a slider ( "Screenshot ":http://oi54.tinypic.com/vzxb1j.jpg)
Do u know why the focus thing is different with "this":http://i51.tinypic.com/2lkw4f6.jpg one? -
Ah, you mean you don't like the visual representation of the focus? I can imagine you don't, the screenshot with just your slider looks quite ugly. But I have no idea what styles or style sheets you use to create that; it certainly isn't anything standard distributed by Qt.
-
Yes it quite ugly so i changed it to NoFocus...
Thanks Andre :) -
I think you are looking for StyleSheets. Have a look on "this":http://thesmithfam.org/blog/2010/03/10/fancy-qslider-stylesheet/ and "this":http://doc.qt.nokia.com/4.6/stylesheet-examples.html#customizing-qslider.
-
NoFocus Fancy QSlider Stylesheet :D
Seems good to me !