[Interest] The incredible shrinking dialogue

David C. Partridge david.partridge at perdrix.co.uk
Sat Oct 14 13:12:09 CEST 2023


Hi Volker,

 

I’m not sure I have enough information to open a bug report!   This problem is on Windows 11 (application isn’t yet fully converted to Qt so no other platform options).

The ctor is as follows:

ProgressDlg::ProgressDlg(QWidget* parent) :

       QDialog { parent },

       ProgressBase{ },

       ui{ new Ui::ProgressDlg },

       m_cancelInProgress{ false }

{

       ui->setupUi(this);

       setWindowFlags(windowFlags() & ~(Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint));

       ProgressDlg::connect(ui->StopButton, &QPushButton::clicked, this, &ProgressDlg::cancelPressed);

 

       retainHiddenWidgetSize(*ui->ProcessText1);

       retainHiddenWidgetSize(*ui->ProcessText2);

       retainHiddenWidgetSize(*ui->ProgressBar1);

       retainHiddenWidgetSize(*ui->ProgressBar2);

}

and retainHiddenWidgetSize() looks like:

 

void ProgressDlg::retainHiddenWidgetSize(QWidget& rWidget)

{

       QSizePolicy sp_retain = rWidget.sizePolicy();

       sp_retain.setRetainSizeWhenHidden(true);

       rWidget.setSizePolicy(sp_retain);

}

 

ProgressBase is a base class for progress that allows us to have a gui version (this code) and a command line version.

 

The ui is nothing special:

<?xml version="1.0" encoding="UTF-8"?>

<ui version="4.0">

<class>ProgressDlg</class>

<widget class="QDialog" name="ProgressDlg">

  <property name="geometry">

   <rect>

    <x>0</x>

    <y>0</y>

    <width>653</width>

    <height>180</height>

   </rect>

  </property>

  <property name="windowTitle">

   <string>Processing ...</string>

  </property>

  <widget class="QWidget" name="verticalLayoutWidget">

   <property name="geometry">

    <rect>

     <x>9</x>

     <y>9</y>

     <width>631</width>

     <height>161</height>

    </rect>

   </property>

   <layout class="QVBoxLayout" name="verticalLayout">

    <item>

     <widget class="QLabel" name="ProcessText1">

      <property name="text">

       <string/>

      </property>

     </widget>

    </item>

    <item>

     <widget class="QLabel" name="ProcessText2">

      <property name="text">

       <string/>

      </property>

     </widget>

    </item>

    <item>

     <layout class="QHBoxLayout" name="horizontalLayoutProgress1">

      <property name="spacing">

       <number>6</number>

      </property>

      <item>

       <spacer name="horizontalSpacer_2">

        <property name="orientation">

         <enum>Qt::Horizontal</enum>

        </property>

        <property name="sizeHint" stdset="0">

         <size>

          <width>20</width>

          <height>20</height>

         </size>

        </property>

       </spacer>

      </item>

      <item>

       <widget class="QProgressBar" name="ProgressBar1">

        <property name="minimumSize">

         <size>

          <width>500</width>

          <height>0</height>

         </size>

        </property>

        <property name="value">

         <number>24</number>

        </property>

       </widget>

      </item>

      <item>

       <spacer name="horizontalSpacer">

        <property name="orientation">

         <enum>Qt::Horizontal</enum>

        </property>

        <property name="sizeHint" stdset="0">

         <size>

          <width>20</width>

          <height>20</height>

         </size>

        </property>

       </spacer>

      </item>

     </layout>

    </item>

    <item>

     <layout class="QHBoxLayout" name="horizontalLayout_3">

      <item>

       <spacer name="horizontalSpacer_4">

        <property name="orientation">

         <enum>Qt::Horizontal</enum>

        </property>

        <property name="sizeHint" stdset="0">

         <size>

          <width>20</width>

          <height>20</height>

         </size>

        </property>

       </spacer>

      </item>

      <item>

       <widget class="QProgressBar" name="ProgressBar2">

        <property name="minimumSize">

         <size>

          <width>500</width>

          <height>0</height>

         </size>

        </property>

        <property name="value">

         <number>24</number>

        </property>

       </widget>

      </item>

      <item>

       <spacer name="horizontalSpacer_3">

        <property name="orientation">

         <enum>Qt::Horizontal</enum>

        </property>

        <property name="sizeHint" stdset="0">

         <size>

          <width>20</width>

          <height>20</height>

         </size>

        </property>

       </spacer>

      </item>

     </layout>

    </item>

    <item>

     <layout class="QHBoxLayout" name="horizontalLayout_4">

      <item>

       <widget class="QLabel" name="TimeRemaining">

        <property name="text">

         <string/>

        </property>

       </widget>

      </item>

      <item>

       <widget class="QLabel" name="Processors">

        <property name="text">

         <string/>

        </property>

       </widget>

      </item>

      <item>

       <widget class="QPushButton" name="StopButton">

        <property name="text">

         <string>Cancel</string>

        </property>

       </widget>

      </item>

     </layout>

    </item>

   </layout>

  </widget>

</widget>

<resources/>

<connections/>

</ui>

 

From: Volker Hilsheimer <volker.hilsheimer at qt.io> 
Sent: 14 October 2023 11:13
To: David C. Partridge <david.partridge at perdrix.co.uk>
Cc: interest at qt-project.org
Subject: Re: [Interest] The incredible shrinking dialogue

 

On 13 Oct 2023, at 09:36, David C. Partridge <david.partridge at perdrix.co.uk <mailto:david.partridge at perdrix.co.uk> > wrote:

 

An application I own has a custom dual progress dialogue.    It has worked without problem since 15.5 up until 6.5.1 inclusive.

 

If we build using 6.5.3 (or 6.6), and run the application, then when we minimise/restore the main window the dlg vertical size is reduced, clipping the content.  If you repeat the minimise/restore a couple of times, then all the is left of the dlg is the title bar.

 

We’re prepared for it to be our problem rather than a Qt problem, but haven’t any ideas on how to determine what’s causing this strange behaviour.

 

Suggestions of how we can debug this will be most welcome.  Trivial test cases don’t appear to show the problem.

 

Thanks, David

 

 

Hi David,

 

Which platform is this one, and what window flags are you using? Given that behavior changed between Qt releases, a JIRA ticket with the relevant details would be good.

 

 

Cheers,

Volker

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231014/f34b028f/attachment-0001.htm>


More information about the Interest mailing list