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. Resize window to content
Forum Updated to NodeBB v4.3 + New Features

Resize window to content

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.9k Views
  • 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.
  • A Offline
    A Offline
    AlexP11223
    wrote on last edited by
    #1

    Is there any easy way to automatically adjust the window size to fit the content (text, it's a message dialog)?

    1 Reply Last reply
    0
    • KillerSmathK Offline
      KillerSmathK Offline
      KillerSmath
      wrote on last edited by KillerSmath
      #2

      @AlexP11223

      ApplicationWindow performs auto resize to fit their children

      import QtQuick 2.11
      import QtQuick.Controls 1.4
      
      ApplicationWindow {
          id: window
          visible: true
          title: "My Window Title"
      
          Rectangle{
              id: rect1
              color: "#ff00ff"
              width:360; height: 50
          }
      
          Rectangle{
              id: rect2
              color: "#ff0000"
              anchors {top: rect1.bottom; left: rect1.left}
              width: 280; height: 280
          }
      
          Rectangle{
              id: rect3
              color: "#ffff00"
              anchors {left: rect2.right; top: rect1.bottom}
              width: 120; height: 150
          }
      }
      

      @Computer Science Student - Brazil
      Web Developer and Researcher
      “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

      1 Reply Last reply
      1

      • Login

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