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. how to place the window ?

how to place the window ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 638 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.
  • S Offline
    S Offline
    signalK
    wrote on last edited by signalK
    #1

    Hi,

    After this basic code to create a window:

    import QtQuick 2.9
    import QtQuick.Window 2.2
    import QtQuick.VirtualKeyboard 2.2

    Window {
    id: window
    visible: true
    width: 100
    height: 100
    title: qsTr("World Tekken")
    color: "blue"
    }

    what is the function or code to insert in addition to place it according to the coordinates (x, y) when the program above is compiled and executed?

    thanks

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      What do you want place ? what do u want to insert ? where do you want to place ? Some clarity will help.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • S Offline
        S Offline
        signalK
        wrote on last edited by
        #3

        i want to place in the screen of pc the blue window !
        It's clear !

        J.HilkJ 1 Reply Last reply
        0
        • S signalK

          i want to place in the screen of pc the blue window !
          It's clear !

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @signalK

          you place the window by manipulating x and y of your window

          to place it in the center of a single moitor setup:

          Window {
             id: window
             visible: true
             x: (Screen.desktopAvailableWidth - width)/2
             y: (Screen.desktopAvailableHeight - height)/2
             width: 100
             height: 100
             title: qsTr("World Tekken")
             color: "blue"
          }
          

          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          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