Problem with Qtextedit?
-
wrote on 7 Dec 2011, 07:25 last edited by
While i am setting a background image in parent window why the same image is coming in the textedit widget also. How i can avoid that?
-
wrote on 7 Dec 2011, 08:12 last edited by
How do you set background image?
If with styleShet then do:
@QDialog{background-image: url(:/img/1.JPG);}@
Instead QDialog, put your parent window. -
wrote on 7 Dec 2011, 08:24 last edited by
This is NOT a problem of QTextEdit. Styles are inherited automatically. To avoid this, you can use "selectors":http://doc.qt.nokia.com/4.7/stylesheet-syntax.html#selector-types
-
wrote on 7 Dec 2011, 09:04 last edited by
In my case which selector i should use
@
QMainWindow w;
w.setStyleSheet ("background-image: url(:/Sunset.jpg)");
@ -
wrote on 7 Dec 2011, 09:18 last edited by
i guess
@QMainWindow w;
w.setStyleSheet ("QMainWindow{background-image: url(:/Sunset.jpg)}");@ -
wrote on 7 Dec 2011, 09:21 last edited by
[quote author="qxoz" date="1323249534"]i guess
@QMainWindow w;
w.setStyleSheet ("QMainWindow{background-image: url(:/Sunset.jpg)}");@[/quote]
thanks -
wrote on 7 Dec 2011, 10:09 last edited by
Notice that,
@
QMainWindow w;
w.setStyleSheet("QPushButton { background:#F0F;}");
@
will affect all the push buttons from main window.For instance:
@QMainWindow w;
w.setStyleSheet("QWidget #menuBar QPushButton{ background:#F0F;}");@
will affect only push buttons from the QWidget named as menuBar.You should use "selectors":http://doc.qt.nokia.com/4.7/stylesheet-syntax.html#selector-types as Rahul said. Its very important in UI creation.
1/7