2013年7月21日星期日

QWidget parent window to set the background color does not affect how the child window?

When the parent window is used to set the background color or style sheet background image after the child window automatically inherit the background, such as: QWidget set to a white background, the white button on automatically, rather than the original color and style of the default.

Now I want all of the sub-window widget always remain the default state, there is only the parent window background color or background image.
------ Solution ---------------------------------------- ----------------
again urgently, before use should look manual, understand the basic usage, right?

Of course, manual is always the first choice, if you have other Qt4 book, even the CSS books, you can look directly. But you are not used here, something profound.

The answer is very simple, but I would rather typing, do not want to directly say
------ Solution ---------------------- ----------------------------------
I'm not good to say directly, but can prompt stylesheet specified for the type of ~
see qt assistant kingly
------ Solution ----------------------------- ---------------------------

then there is this book called "C + + GUI Qt 4 programming "Yes, the Chinese version.
------ Solution ---------------------------------------- ----------------
you to set the background color when the parent window
this formulation
QWidget # parent window name {....}
such as QPushButton named btn1 parent window
QSS is set when
QPushButton # btn1 {...}

above are set directly by deisgner

If you write it in the code directly to the parent window
btn-> setStyleSheet can not affect the child window
------ For reference only --------------------- -----------------------------------
go first manual, familiarize yourself with qss selector syntax . If after reading it, there are still problems, welcome back.
------ For reference only -------------------------------------- ------------------
I now urgently Yeah!

What is the recommended way upstairs? Specific point you can say? Is QT4 manual? Specifically that book?
------ For reference only -------------------------------------- ------------------
so ah! I see the English tired, I just CET-4 level. Thank you, I probably have a idea, and if you can recommend a few books better!
------ For reference only -------------------------------------- ------------------


you mean is not it, I add a button widget, I think I put the button unchanged from the original stylesheet
 background-color: rgb (255, 255, 255); 

changed:
 QWidget {background-color: rgb (255, 255, 255);} 

Is that right?

I was in Qt Designer to design the interface.
------ For reference only -------------------------------------- ------------------
This is the original way! Thank you upstairs
------ For reference only ---------------------------------- ----------------------
understand, Thank you upstairs!
I will take the book to read through, and now the project is really urgent, I still Qt novice, I thank you for help!
------ For reference only -------------------------------------- ------------------
I also want to know how to do
------ For reference only ---------- ----------------------------------------------
Xie lz, and the eighth floor ...

没有评论:

发表评论