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. How to use frameGeometry correctly?
Qt 6.11 is out! See what's new in the release blog

How to use frameGeometry correctly?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 492 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.
  • Q Offline
    Q Offline
    Qt_Andrew
    wrote on last edited by
    #1

    I used setGeometry(QRect) to set windows, It worked.
    But I want to move and set windows with window title.

    Then I try to use frameGeometry like:

    window->frameGeometry().setX(rects.x());
    window->frameGeometry().setY(rects.y());
    window->frameGeometry().setWidth(rects.width());
    window->frameGeometry().setHeight(rects.height());
    
    or 
    
    window->frameGeometry().setRect(rects.x(), rects.y(), rects.width(), rects.height());
    

    They are not working.

    jsulmJ 1 Reply Last reply
    0
    • Q Qt_Andrew

      I used setGeometry(QRect) to set windows, It worked.
      But I want to move and set windows with window title.

      Then I try to use frameGeometry like:

      window->frameGeometry().setX(rects.x());
      window->frameGeometry().setY(rects.y());
      window->frameGeometry().setWidth(rects.width());
      window->frameGeometry().setHeight(rects.height());
      
      or 
      
      window->frameGeometry().setRect(rects.x(), rects.y(), rects.width(), rects.height());
      

      They are not working.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Qt_Andrew said in How to use frameGeometry correctly?:

      frameGeometry()

      It returns a copy of QRect - chaning copy will not have any effect.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Q 1 Reply Last reply
      1
      • jsulmJ jsulm

        @Qt_Andrew said in How to use frameGeometry correctly?:

        frameGeometry()

        It returns a copy of QRect - chaning copy will not have any effect.

        Q Offline
        Q Offline
        Qt_Andrew
        wrote on last edited by
        #3

        @jsulm my bad

        jsulmJ 1 Reply Last reply
        0
        • Q Qt_Andrew

          @jsulm my bad

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Qt_Andrew "But I want to move and set windows with window title" - if you want to move the whole application window you can't do it like this. I don't know if there is anything in Qt for that as it is the job of the window manager.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          JonBJ 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Qt_Andrew "But I want to move and set windows with window title" - if you want to move the whole application window you can't do it like this. I don't know if there is anything in Qt for that as it is the job of the window manager.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #5

            @jsulm said in How to use frameGeometry correctly?:

            I don't know if there is anything in Qt for that as it is the job of the window manager.

            MainWindow::move() seems to work for me, Ubuntu, GNOME window manager.

            1 Reply Last reply
            2

            • Login

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