Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] Making a QML file fill a QDeclarativeView
Forum Updated to NodeBB v4.3 + New Features

[solved] Making a QML file fill a QDeclarativeView

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.1k 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.
  • K Offline
    K Offline
    kemra102
    wrote on last edited by
    #1

    I am trying to find out how to make the contents of a QML file (currently a Rectangle with a gradient for testing purposes) fill the QDeclarativeView that contains it in the MainWindow of my application, however I cannot seem to figure out how to do this.

    I can get the QML file to show in the QDeclarativeView no problem, but if I resize the window the rectangle does not resize with it. Is there any way of achieving this even if it means a different approach?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      baysmith
      wrote on last edited by
      #2

      @
      view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
      @

      Nokia Certified Qt Specialist.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kemra102
        wrote on last edited by
        #3

        Works perfectly, thank you.

        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