C++/QML - QDeclarativeView default background
-
Hi,
I've today played with QML&C++/Qt and it is really interesting, but I have one "tiny" problem :)
How I can set QDeclarativeView widget to default system background color?
I've attached screenshot of window with my small app. QDeclararitiveView has white background, this is wrong, better will be default system color scheme color…
Is this possible?"screenshot":http://twio.cz/ad6a
-
@Rectangle{
width:widthYouWant
height:heightYouWant
color:colorYouWant
}@ -
stibi, you can get it from QPalette and provide to QML through context property and after this use it as value of color property of Rectangle.
-
-
ixSci, didn't use it and was not aware about this element :) using SystemPalette element of course is easier than my way.
-
Hi Denis,
thank you, it works great. I was thinking about this solution before, but I thought that could exist different solution on QML level. Anyway, it works :)@ui->timelineView->rootContext()->setContextProperty("backgroundColor", QPalette().color(QPalette::Window));@
-
stibi, just use what ixSci said. It is the solution on QML level.
-
Thanks also solved a problem i had.