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. ShowMaximized call works but the MainWindows is resized on app.exec()
Forum Updated to NodeBB v4.3 + New Features

ShowMaximized call works but the MainWindows is resized on app.exec()

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.3k Views 2 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.
  • A Offline
    A Offline
    Anthony Fr
    wrote on last edited by
    #1

    Hi everybody,

    I’m upgrading my software from Qt 4.7.4 to Qt 5.4.0 Beta (I’m waiting for the release the 9th Dec). I'm on Windows 7 and my application is in Win32.

    It doesn't happen in the Qt 4.7.4. I can't reproduce it with a simple empty project.

    In my MainWindow, I have 2 tabbed vertical dockwidgets and a custom QWidget in centralwidget.

    It's append only on two similar applications (the inherit of the same AbstractMainWindow). Another who inherit of the same base class doesn't have this issue, mainly because it has a horizontal dockwidget. I found a work around by add then hiding a horizontal dockwidget but it stays a very dirty work around.

    The issue: when I call myMainWindow.showMaximized(), I see, with debug breakpoint, the mainwindow fills the screen like the attemped behavior. Unfortunately, during the app.exec() call, the mainwindow is resized BUT the windowState stays at Maximized...

    I really don't understand what can append, I watch the resize method and apparently the width and height have decrease before the first resize called during theapp.exec() method.

    It seems the QWidget::width() and QWidget::height() method don't return the same value as the QWidget::crect field, which is correct.

    The QMainWindowTabBar, on his destruction (why destruction... I don't know: I haven't TabBar), raises a event and this call a QWidget::SetMinimizeSize. Like the value return by QWidget::height() and QWidget::width() are not correct and less than the wanted minimum size, my MainWindow is resized.

    My hypothesis is: it's come from the qwindows.dll who misunderstood the windows Handle value.

    But I'm want some others point of view before posting a bug report.

    Have you seen this behavior? Have any advice, please?

    Seb TurS 1 Reply Last reply
    0
    • A Offline
      A Offline
      Anthony Fr
      wrote on last edited by
      #2

      Up, please

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Can you reduce your code base in order to easily reproduce that bug ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • A Anthony Fr

          Hi everybody,

          I’m upgrading my software from Qt 4.7.4 to Qt 5.4.0 Beta (I’m waiting for the release the 9th Dec). I'm on Windows 7 and my application is in Win32.

          It doesn't happen in the Qt 4.7.4. I can't reproduce it with a simple empty project.

          In my MainWindow, I have 2 tabbed vertical dockwidgets and a custom QWidget in centralwidget.

          It's append only on two similar applications (the inherit of the same AbstractMainWindow). Another who inherit of the same base class doesn't have this issue, mainly because it has a horizontal dockwidget. I found a work around by add then hiding a horizontal dockwidget but it stays a very dirty work around.

          The issue: when I call myMainWindow.showMaximized(), I see, with debug breakpoint, the mainwindow fills the screen like the attemped behavior. Unfortunately, during the app.exec() call, the mainwindow is resized BUT the windowState stays at Maximized...

          I really don't understand what can append, I watch the resize method and apparently the width and height have decrease before the first resize called during theapp.exec() method.

          It seems the QWidget::width() and QWidget::height() method don't return the same value as the QWidget::crect field, which is correct.

          The QMainWindowTabBar, on his destruction (why destruction... I don't know: I haven't TabBar), raises a event and this call a QWidget::SetMinimizeSize. Like the value return by QWidget::height() and QWidget::width() are not correct and less than the wanted minimum size, my MainWindow is resized.

          My hypothesis is: it's come from the qwindows.dll who misunderstood the windows Handle value.

          But I'm want some others point of view before posting a bug report.

          Have you seen this behavior? Have any advice, please?

          Seb TurS Offline
          Seb TurS Offline
          Seb Tur
          wrote on last edited by
          #4

          @Anthony-Fr

          I confirm this bug even on 5.15.2

          I cannot reproduce it 100% but sometimes it works ok sometimes exactly as you say. Even the windows maximize icon changes to un-maximize as it "thinks" window is maximized. see the icon between _ and x top right corner

          f95996ff-da22-4948-9a28-faa225d6bc8f-obraz.png
          Somehow it can be fixed when playing with ui editor and modifying MainWindow size there.... I think...

          Seb TurS 1 Reply Last reply
          0
          • Seb TurS Seb Tur

            @Anthony-Fr

            I confirm this bug even on 5.15.2

            I cannot reproduce it 100% but sometimes it works ok sometimes exactly as you say. Even the windows maximize icon changes to un-maximize as it "thinks" window is maximized. see the icon between _ and x top right corner

            f95996ff-da22-4948-9a28-faa225d6bc8f-obraz.png
            Somehow it can be fixed when playing with ui editor and modifying MainWindow size there.... I think...

            Seb TurS Offline
            Seb TurS Offline
            Seb Tur
            wrote on last edited by
            #5

            @Seb-Tur

            I found it !
            In qtcretor when you hit a button to restore the default mainwidow size the section with geometry disappears and causes this bug.
            4fcae681-d1ad-4ed9-ad91-37f21e904444-obraz.png
            When the geometry is specified (as below) all works fine. The misleading part is that when you restore mainwindow default size it automatically is filled with the total width/height coming from the internal widgets/layouts

            The workarond is to increase the Width and Height in the rows below at least by 1 pixel and the section is restored.

            ui content after restoring size to defaults

            <?xml version="1.0" encoding="UTF-8"?>
            <ui version="4.0">
             <class>MainWindow</class>
             <widget class="QMainWindow" name="MainWindow">
              <property name="enabled">
               <bool>true</bool>
              </property>
              <property name="sizePolicy">
               <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
              </property>
              <property name="windowTitle">
            

            proper ui content:

            <?xml version="1.0" encoding="UTF-8"?>
            <ui version="4.0">
             <class>MainWindow</class>
             <widget class="QMainWindow" name="MainWindow">
              <property name="enabled">
               <bool>true</bool>
              </property>
              <property name="geometry">
               <rect>
                <x>0</x>
                <y>0</y>
                <width>1711</width>
                <height>1111</height>
               </rect>
              </property>
              <property name="sizePolicy">
               <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
              </property>
            
            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