Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-64140

ui->verticalLayout->geometry()返回的QRect的left()和top()错误

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P1: Critical
    • None
    • 5.9.2
    • Build tools: uic
    • None
    • IDE版本是 Qt Creator 4.4.1

      Qt版本是 5.9.2

    Description

       I add a verticalLayout to UI, and then calculate the QRect value of this region with the following code

      QRect rc=ui->verticalLayout->geometry();

      Then, I found that the QRect's top and left did not contain Toolbar's width and height.

      So now I can only correct the wrong QRect with the following code:

      QRect rc=ui->verticalLayout->geometry();

      QRect rcMain=ui->centralWidget->geometry();

      rc.setLeft(rc.left()+rcMain.left());

      rc.setTop(rc.top()+rcMain.top());

      rc.setRight(rc.right()+rcMain.left());

      rc.setBottom(rc.bottom()+rcMain.top());

       

      Attachments

        1. 1.png
          8 kB
          光宝 魏
        2. 2.png
          8 kB
          光宝 魏
        3. 3.png
          9 kB
          光宝 魏
        4. 4.png
          10 kB
          光宝 魏
        5. TscTool.7z
          10 kB
          光宝 魏

        Activity

          People

            jkobus Jarek Kobus
            kennethwei 光宝 魏
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: