Merge pull request #1507 from srcejon/rollup_min_width

Set window width to account for minimum width required for visible rollups
pull/1509/head
Edouard Griffiths 2022-11-08 17:01:22 +01:00 zatwierdzone przez GitHub
commit b551a20302
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
42 zmienionych plików z 167 dodań i 147 usunięć

Wyświetl plik

@ -467,7 +467,8 @@ void ChannelAnalyzerGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -369,19 +369,6 @@ void AISDemodGUI::filter()
void AISDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
{
if (widget == ui->scopeContainer)
{
if (rollDown)
{
// Make wide enough for scope controls
setMinimumWidth(716);
}
else
{
setMinimumWidth(352);
}
}
RollupContents *rollupContents = getRollupContents();
if (rollupContents->hasExpandableWidgets()) {
@ -391,7 +378,8 @@ void AISDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -721,10 +721,16 @@
<rect>
<x>20</x>
<y>400</y>
<width>351</width>
<width>716</width>
<height>341</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>714</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Waveforms</string>
</property>
@ -911,11 +917,6 @@
</widget>
</widget>
<customwidgets>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
@ -923,10 +924,9 @@
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
@ -934,6 +934,12 @@
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScope</class>
<extends>QWidget</extends>

Wyświetl plik

@ -556,7 +556,8 @@ void APTDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -325,7 +325,8 @@ void BFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -18,7 +18,7 @@
</property>
<property name="minimumSize">
<size>
<width>642</width>
<width>450</width>
<height>0</height>
</size>
</property>
@ -48,7 +48,7 @@
</property>
<property name="minimumSize">
<size>
<width>640</width>
<width>450</width>
<height>0</height>
</size>
</property>
@ -553,7 +553,7 @@
</property>
<property name="minimumSize">
<size>
<width>640</width>
<width>760</width>
<height>0</height>
</size>
</property>

Wyświetl plik

@ -338,7 +338,8 @@ void ChirpChatDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -401,7 +401,8 @@ void DABDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -257,7 +257,8 @@ void FreeDVDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -383,7 +383,8 @@ void PacketDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -418,19 +418,6 @@ void PagerDemodGUI::filter()
void PagerDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
{
if (widget == ui->scopeContainer)
{
if (rollDown)
{
// Make wide enough for scope controls
setMinimumWidth(716);
}
else
{
setMinimumWidth(352);
}
}
RollupContents *rollupContents = getRollupContents();
if (rollupContents->hasExpandableWidgets()) {
@ -440,7 +427,8 @@ void PagerDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -816,10 +816,16 @@
<rect>
<x>20</x>
<y>400</y>
<width>351</width>
<width>714</width>
<height>341</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>714</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Waveforms</string>
</property>
@ -1019,10 +1025,9 @@
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
@ -1031,9 +1036,10 @@
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScope</class>

Wyświetl plik

@ -475,19 +475,6 @@ void RadiosondeDemodGUI::filter()
void RadiosondeDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
{
if (widget == ui->scopeContainer)
{
if (rollDown)
{
// Make wide enough for scope controls
setMinimumWidth(716);
}
else
{
setMinimumWidth(352);
}
}
RollupContents *rollupContents = getRollupContents();
if (rollupContents->hasExpandableWidgets()) {
@ -497,7 +484,8 @@ void RadiosondeDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -855,10 +855,16 @@
<rect>
<x>20</x>
<y>400</y>
<width>351</width>
<width>714</width>
<height>341</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>714</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Waveforms</string>
</property>
@ -1061,10 +1067,9 @@
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
@ -1073,9 +1078,10 @@
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScope</class>

Wyświetl plik

@ -316,19 +316,15 @@ void SSBDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
RollupContents *rollupContents = getRollupContents();
if (rollupContents->hasExpandableWidgets())
{
qDebug("SSBDemodGUI::onWidgetRolled: set vertical policy expanding");
if (rollupContents->hasExpandableWidgets()) {
setSizePolicy(sizePolicy().horizontalPolicy(), QSizePolicy::Expanding);
}
else
{
qDebug("SSBDemodGUI::onWidgetRolled: set vertical policy fixed");
} else {
setSizePolicy(sizePolicy().horizontalPolicy(), QSizePolicy::Fixed);
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -1116,7 +1116,8 @@ void VORDemodMCGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -364,7 +364,8 @@ void FileSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -40,6 +40,12 @@
<height>151</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
@ -814,6 +820,17 @@
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLSpectrum</class>
<extends>QWidget</extends>
@ -832,17 +849,6 @@
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>

Wyświetl plik

@ -11,7 +11,7 @@
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -42,10 +42,16 @@
<rect>
<x>10</x>
<y>10</y>
<width>301</width>
<width>302</width>
<height>91</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>302</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>

Wyświetl plik

@ -546,7 +546,8 @@ void NoiseFigureGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -1915,7 +1915,8 @@ void RadioAstronomyGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -209,19 +209,6 @@ void RadioClockGUI::on_timezone_currentIndexChanged(int index)
void RadioClockGUI::onWidgetRolled(QWidget* widget, bool rollDown)
{
if (widget == ui->scopeContainer)
{
if (rollDown)
{
// Make wide enough for scope controls
setMinimumWidth(716);
}
else
{
setMinimumWidth(352);
}
}
RollupContents *rollupContents = getRollupContents();
if (rollupContents->hasExpandableWidgets()) {
@ -231,7 +218,8 @@ void RadioClockGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -591,10 +591,16 @@
<rect>
<x>20</x>
<y>250</y>
<width>351</width>
<width>714</width>
<height>341</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>714</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Waveforms</string>
</property>
@ -643,18 +649,18 @@
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScope</class>
<extends>QWidget</extends>

Wyświetl plik

@ -24,7 +24,7 @@
</property>
<property name="maximumSize">
<size>
<width>360</width>
<width>560</width>
<height>16777215</height>
</size>
</property>
@ -45,6 +45,12 @@
<height>141</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>334</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
@ -447,6 +453,12 @@
</widget>
</widget>
<customwidgets>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
@ -459,12 +471,6 @@
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>

Wyświetl plik

@ -356,7 +356,8 @@ void SigMFFileSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -609,7 +609,8 @@ void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -329,7 +329,8 @@ void IEEE_802_15_4_ModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -352,7 +352,8 @@ void AISModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -304,7 +304,8 @@ void FreeDVModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -389,7 +389,8 @@ void PacketModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -368,7 +368,8 @@ void SSBModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -491,7 +491,8 @@ void UDPSourceGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -176,7 +176,8 @@ void AISGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -120,7 +120,8 @@ void AntennaToolsGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -135,7 +135,8 @@ void DemodAnalyzerGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -127,7 +127,8 @@ void RadiosondeGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -239,7 +239,8 @@ void SatelliteTrackerGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -234,7 +234,8 @@ void StarTrackerGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -807,7 +807,8 @@ void VORLocalizerGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
int h = rollupContents->height() + getAdditionalHeight();
resize(width(), h);
int w = std::max(width(), rollupContents->minimumWidth() + gripSize() * 2);
resize(w, h);
rollupContents->saveState(m_rollupState);
applySettings();

Wyświetl plik

@ -97,6 +97,7 @@ protected:
void updateIndexLabel();
int getAdditionalHeight() const { return 22 + 22; } // height of top and bottom bars
void setHighlighted(bool highlighted);
int gripSize() { return m_resizer.m_gripSize; } // size in pixels of resize grip around the window
DeviceType m_deviceType;
int m_deviceSetIndex;

Wyświetl plik

@ -74,6 +74,7 @@ protected:
void mouseMoveEvent(QMouseEvent* event) override;
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
int getAdditionalHeight() const { return 22 + 22; } // height of top and bottom bars
int gripSize() { return m_resizer.m_gripSize; } // size in pixels of resize grip around the window
Feature *m_feature;
int m_featureIndex;

Wyświetl plik

@ -95,11 +95,11 @@ bool RollupContents::hasExpandableWidgets()
return false;
}
int RollupContents::arrangeRollups()
{
QFontMetrics fm(font());
int pos;
int minWidth = 0;
// First calculate minimum height needed, to determine how much extra space
// we have that can be split between expanding widgets
@ -123,12 +123,14 @@ int RollupContents::arrangeRollups()
} else {
h = r->minimumSizeHint().height();
}
minWidth = std::max(minWidth, r->minimumSize().width());
pos += h + 5;
}
}
}
setMinimumHeight(pos);
setMinimumWidth(minWidth);
// Split extra space equally between widgets
// If there's a remainder, we give it to the first widget