Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. C++/QML - QDeclarativeView default background
Forum Updated to NodeBB v4.3 + New Features

C++/QML - QDeclarativeView default background

Scheduled Pinned Locked Moved QML and Qt Quick
9 Posts 5 Posters 6.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stibi
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kxyu
      wrote on last edited by
      #2

      @Rectangle{
      width:widthYouWant
      height:heightYouWant
      color:colorYouWant
      }@

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DenisKormalev
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • I Offline
          I Offline
          ixSci
          wrote on last edited by
          #4

          [quote author="Denis Kormalev" date="1293400319"]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.[/quote]
          Why? QML already has its own element: SystemPalette

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DenisKormalev
            wrote on last edited by
            #5

            ixSci, didn't use it and was not aware about this element :) using SystemPalette element of course is easier than my way.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              stibi
              wrote on last edited by
              #6

              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));@

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DenisKormalev
                wrote on last edited by
                #7

                stibi, just use what ixSci said. It is the solution on QML level.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  stibi
                  wrote on last edited by
                  #8

                  Ouch, my bad. I didn't notice ixSci's reply. Great, this is exactly what i looking for.
                  Thanks again!

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andresteves
                    wrote on last edited by
                    #9

                    Thanks also solved a problem i had.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved