1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Merge pull request #1026 from srcejon/fix_897

Fix #897 - Add support for vertically expanding widgets to RollupWidget
This commit is contained in:
Edouard Griffiths 2021-10-30 18:54:51 +02:00 committed by GitHub
commit f39a966af1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 604 additions and 473 deletions

View File

@ -10,6 +10,12 @@
<height>778</height> <height>778</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>720</width> <width>720</width>
@ -127,6 +133,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>26</red>
<green>26</green>
<blue>26</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="Text"> <colorrole role="Text">
@ -147,6 +162,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>26</red>
<green>26</green>
<blue>26</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="Text"> <colorrole role="Text">
@ -167,6 +191,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>26</red>
<green>26</green>
<blue>26</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@ -937,35 +970,12 @@
<header>gui/rollupwidget.h</header> <header>gui/rollupwidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>GLSpectrum</class>
<extends>QWidget</extends>
<header>gui/glspectrum.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLSpectrumGUI</class>
<extends>QWidget</extends>
<header>gui/glspectrumgui.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>ValueDialZ</class> <class>ValueDialZ</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>gui/valuedialz.h</header> <header>gui/valuedialz.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget> <customwidget>
<class>GLScope</class> <class>GLScope</class>
<extends>QWidget</extends> <extends>QWidget</extends>
@ -978,6 +988,29 @@
<header>gui/glscopegui.h</header> <header>gui/glscopegui.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>GLSpectrum</class>
<extends>QWidget</extends>
<header>gui/glspectrum.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLSpectrumGUI</class>
<extends>QWidget</extends>
<header>gui/glspectrumgui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../../../sdrgui/resources/res.qrc"/> <include location="../../../sdrgui/resources/res.qrc"/>

View File

@ -699,7 +699,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -588,7 +588,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -640,7 +640,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -622,7 +622,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -204,7 +204,7 @@
<enum>QTabWidget::West</enum> <enum>QTabWidget::West</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="datvTab"> <widget class="QWidget" name="datvTab">
<attribute name="title"> <attribute name="title">
@ -1073,6 +1073,12 @@
</widget> </widget>
</widget> </widget>
<widget class="QWidget" name="videoTab"> <widget class="QWidget" name="videoTab">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="title"> <attribute name="title">
<string>Video</string> <string>Video</string>
</attribute> </attribute>
@ -1331,6 +1337,12 @@
</property> </property>
<item> <item>
<widget class="DATVideoRender" name="screenTV_2" native="true"> <widget class="DATVideoRender" name="screenTV_2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>490</width> <width>490</width>
@ -1351,12 +1363,6 @@
<header>gui/rollupwidget.h</header> <header>gui/rollupwidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>DATVideoRender</class>
<extends>QWidget</extends>
<header>datvideorender.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>ValueDialZ</class> <class>ValueDialZ</class>
<extends>QWidget</extends> <extends>QWidget</extends>
@ -1364,9 +1370,9 @@
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>TVScreen</class> <class>LevelMeterSignalDB</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>gui/tvscreen.h</header> <header>gui/levelmeter.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>
@ -1375,9 +1381,15 @@
<header>gui/buttonswitch.h</header> <header>gui/buttonswitch.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>LevelMeterSignalDB</class> <class>DATVideoRender</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>gui/levelmeter.h</header> <header>datvideorender.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TVScreen</class>
<extends>QWidget</extends>
<header>gui/tvscreen.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -567,7 +567,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -655,7 +655,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -687,7 +687,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -4764,7 +4764,7 @@ This should be close to the expected difference in power between hot and cold ca
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -569,6 +569,12 @@
<height>141</height> <height>141</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Transmitted Frames</string> <string>Transmitted Frames</string>
</property> </property>
@ -703,35 +709,12 @@
<header>gui/rollupwidget.h</header> <header>gui/rollupwidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>GLSpectrum</class>
<extends>QWidget</extends>
<header>gui/glspectrum.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLSpectrumGUI</class>
<extends>QWidget</extends>
<header>gui/glspectrumgui.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>ValueDialZ</class> <class>ValueDialZ</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>gui/valuedialz.h</header> <header>gui/valuedialz.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>LevelMeterVU</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>GLScope</class> <class>GLScope</class>
<extends>QWidget</extends> <extends>QWidget</extends>
@ -744,6 +727,29 @@
<header>gui/glscopegui.h</header> <header>gui/glscopegui.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>GLSpectrum</class>
<extends>QWidget</extends>
<header>gui/glspectrum.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLSpectrumGUI</class>
<extends>QWidget</extends>
<header>gui/glspectrumgui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LevelMeterVU</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>deltaFrequency</tabstop> <tabstop>deltaFrequency</tabstop>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -1016,6 +1016,12 @@
<height>141</height> <height>141</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Transmitted Messages</string> <string>Transmitted Messages</string>
</property> </property>
@ -1156,6 +1162,23 @@
<header>gui/valuedialz.h</header> <header>gui/valuedialz.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>GLScope</class>
<extends>QWidget</extends>
<header>gui/glscope.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScopeGUI</class>
<extends>QWidget</extends>
<header>gui/glscopegui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget> <customwidget>
<class>GLSpectrum</class> <class>GLSpectrum</class>
<extends>QWidget</extends> <extends>QWidget</extends>
@ -1168,29 +1191,12 @@
<header>gui/glspectrumgui.h</header> <header>gui/glspectrumgui.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget> <customwidget>
<class>LevelMeterVU</class> <class>LevelMeterVU</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>gui/levelmeter.h</header> <header>gui/levelmeter.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>GLScope</class>
<extends>QWidget</extends>
<header>gui/glscope.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScopeGUI</class>
<extends>QWidget</extends>
<header>gui/glscopegui.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>deltaFrequency</tabstop> <tabstop>deltaFrequency</tabstop>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -788,6 +788,12 @@ APRS examples:
<height>141</height> <height>141</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Transmitted Packets</string> <string>Transmitted Packets</string>
</property> </property>
@ -873,6 +879,17 @@ APRS examples:
<header>gui/rollupwidget.h</header> <header>gui/rollupwidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget> <customwidget>
<class>GLSpectrum</class> <class>GLSpectrum</class>
<extends>QWidget</extends> <extends>QWidget</extends>
@ -885,17 +902,6 @@ APRS examples:
<header>gui/glspectrumgui.h</header> <header>gui/glspectrumgui.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget> <customwidget>
<class>LevelMeterVU</class> <class>LevelMeterVU</class>
<extends>QWidget</extends> <extends>QWidget</extends>

View File

@ -24,8 +24,8 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>2000</width> <width>16777215</width>
<height>500</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="font"> <property name="font">
@ -37,6 +37,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>AIS</string> <string>AIS</string>
</property> </property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<widget class="QWidget" name="tableContainer" native="true"> <widget class="QWidget" name="tableContainer" native="true">
<property name="geometry"> <property name="geometry">
<rect> <rect>

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -47,7 +47,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -56,7 +56,7 @@
<string>Calculators</string> <string>Calculators</string>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="dipoleTab"> <widget class="QWidget" name="dipoleTab">
<attribute name="title"> <attribute name="title">

View File

@ -383,7 +383,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -527,7 +527,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -584,11 +584,17 @@
<property name="text"> <property name="text">
<string>Next</string> <string>Next</string>
</property> </property>
<property name="toolTip">
<string>Time until next event</string>
</property>
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Dur</string> <string>Dur</string>
</property> </property>
<property name="toolTip">
<string>Duration of next pass</string>
</property>
</column> </column>
<column> <column>
<property name="text"> <property name="text">

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@ -21,133 +21,133 @@
#include <QPainter> #include <QPainter>
#include <QPainterPath> #include <QPainterPath>
#include <QMouseEvent> #include <QMouseEvent>
#include <QDebug>
#include <QDialog> #include <QDialog>
#include "gui/rollupwidget.h" #include "gui/rollupwidget.h"
#include "ui_glspectrumgui.h" #include "ui_glspectrumgui.h"
RollupWidget::RollupWidget(QWidget* parent) : RollupWidget::RollupWidget(QWidget* parent) :
QWidget(parent), QWidget(parent),
m_highlighted(false), m_highlighted(false),
m_contextMenuType(ContextMenuNone), m_contextMenuType(ContextMenuNone),
m_streamIndicator("S"), m_streamIndicator("S"),
m_channelWidget(true) m_channelWidget(true),
m_newHeight(0)
{ {
setMinimumSize(250, 150); setMinimumSize(250, 150);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setBackgroundRole(QPalette::Window); setBackgroundRole(QPalette::Window);
setAutoFillBackground(false); setAutoFillBackground(false);
setAttribute(Qt::WA_OpaquePaintEvent, true); setAttribute(Qt::WA_OpaquePaintEvent, true);
// Vorgaben aus der Palette // Vorgaben aus der Palette
m_titleColor = palette().highlight().color(); m_titleColor = palette().highlight().color();
m_titleTextColor = palette().highlightedText().color(); m_titleTextColor = palette().highlightedText().color();
} }
QByteArray RollupWidget::saveState(int version) const QByteArray RollupWidget::saveState(int version) const
{ {
QByteArray state; QByteArray state;
QDataStream stream(&state, QIODevice::WriteOnly); QDataStream stream(&state, QIODevice::WriteOnly);
int count = 0; int count = 0;
for (int i = 0; i < children().count(); ++i) for (int i = 0; i < children().count(); ++i)
{ {
QWidget* r = qobject_cast<QWidget*>(children()[i]); QWidget* r = qobject_cast<QWidget*>(children()[i]);
if (r) { if (r) {
count++; count++;
} }
} }
stream << VersionMarker; stream << VersionMarker;
stream << version; stream << version;
stream << count; stream << count;
for (int i = 0; i < children().count(); ++i) for (int i = 0; i < children().count(); ++i)
{ {
QWidget* r = qobject_cast<QWidget*>(children()[i]); QWidget* r = qobject_cast<QWidget*>(children()[i]);
if (r) if (r)
{ {
stream << r->objectName(); stream << r->objectName();
if (r->isHidden()) { if (r->isHidden()) {
stream << (int) 0; stream << (int) 0;
} else { } else {
stream << (int) 1; stream << (int) 1;
} }
} }
} }
return state; return state;
} }
bool RollupWidget::restoreState(const QByteArray& state, int version) bool RollupWidget::restoreState(const QByteArray& state, int version)
{ {
if (state.isEmpty()) { if (state.isEmpty()) {
return false; return false;
} }
QByteArray sd = state; QByteArray sd = state;
QDataStream stream(&sd, QIODevice::ReadOnly); QDataStream stream(&sd, QIODevice::ReadOnly);
int marker, v; int marker, v;
stream >> marker; stream >> marker;
stream >> v; stream >> v;
if ((stream.status() != QDataStream::Ok) || (marker != VersionMarker) || (v != version)) { if ((stream.status() != QDataStream::Ok) || (marker != VersionMarker) || (v != version)) {
return false; return false;
} }
int count; int count;
stream >> count; stream >> count;
if (stream.status() != QDataStream::Ok) { if (stream.status() != QDataStream::Ok) {
return false; return false;
} }
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
QString name; QString name;
int visible; int visible;
stream >> name; stream >> name;
stream >> visible; stream >> visible;
if (stream.status() != QDataStream::Ok) { if (stream.status() != QDataStream::Ok) {
return false; return false;
} }
for (int j = 0; j < children().count(); ++j) for (int j = 0; j < children().count(); ++j)
{ {
QWidget* r = qobject_cast<QWidget*>(children()[j]); QWidget* r = qobject_cast<QWidget*>(children()[j]);
if (r) if (r)
{ {
if (r->objectName() == name) if (r->objectName() == name)
{ {
if (visible) { if (visible) {
r->show(); r->show();
} else { } else {
r->hide(); r->hide();
} }
break; break;
} }
} }
} }
} }
return true; return true;
} }
void RollupWidget::setTitleColor(const QColor& c) void RollupWidget::setTitleColor(const QColor& c)
{ {
m_titleColor = c; m_titleColor = c;
float l = 0.2126*c.redF() + 0.7152*c.greenF() + 0.0722*c.blueF(); float l = 0.2126*c.redF() + 0.7152*c.greenF() + 0.0722*c.blueF();
m_titleTextColor = l < 0.5f ? Qt::white : Qt::black; m_titleTextColor = l < 0.5f ? Qt::white : Qt::black;
update(); update();
} }
void RollupWidget::setHighlighted(bool highlighted) void RollupWidget::setHighlighted(bool highlighted)
@ -161,330 +161,388 @@ void RollupWidget::setHighlighted(bool highlighted)
int RollupWidget::arrangeRollups() int RollupWidget::arrangeRollups()
{ {
QFontMetrics fm(font()); QFontMetrics fm(font());
int pos = fm.height() + 4; int pos;
for (int i = 0; i < children().count(); ++i) // First calculate minimum height needed, to determine how much extra space
{ // we have that can be split between expanding widgets
QWidget* r = qobject_cast<QWidget*>(children()[i]); pos = fm.height() + 4;
int expandingChildren = 0;
for (int i = 0; i < children().count(); ++i)
{
QWidget* r = qobject_cast<QWidget*>(children()[i]);
if ((r != nullptr) && isRollupChild(r)) if ((r != nullptr) && isRollupChild(r))
{ {
pos += fm.height() + 2;
if (!r->isHidden())
{
if (r->sizePolicy().verticalPolicy() & QSizePolicy::ExpandFlag) {
expandingChildren++;
}
int h = 0;
if (r->hasHeightForWidth()) {
h = r->heightForWidth(width() - 4);
} else {
h = r->minimumSizeHint().height();
}
pos += h + 5;
}
}
}
setMinimumHeight(pos);
// Split extra space equally between widgets
// If there's a remainder, we give it to the first widget
// In the future, we should probably respect 'Vertical Stretch'
int extraSpace;
int firstExtra;
if ((expandingChildren > 0) && (m_newHeight > pos))
{
int totalExtra = m_newHeight - pos;
extraSpace = totalExtra / expandingChildren;
firstExtra = totalExtra - (extraSpace * expandingChildren);
}
else
{
extraSpace = 0;
firstExtra = 0;
}
// Now reposition and resize child widgets
pos = fm.height() + 4;
for (int i = 0; i < children().count(); ++i)
{
QWidget* r = qobject_cast<QWidget*>(children()[i]);
if ((r != nullptr) && isRollupChild(r))
{
pos += fm.height() + 2; pos += fm.height() + 2;
if (!r->isHidden()) if (!r->isHidden())
{ {
r->move(2, pos + 3); r->move(2, pos + 3);
int h = 0;
int h = 0;
if (r->hasHeightForWidth()) { if (r->hasHeightForWidth()) {
h = r->heightForWidth(width() - 4); h = r->heightForWidth(width() - 4);
} else { } else {
h = r->sizeHint().height(); h = r->minimumSizeHint().height();
}
if (r->sizePolicy().verticalPolicy() & QSizePolicy::ExpandFlag)
{
h += extraSpace;
h += firstExtra;
firstExtra = 0;
} }
r->resize(width() - 4, h); r->resize(width() - 4, h);
pos += r->height() + 5; pos += r->height() + 5;
} }
} }
} }
setMinimumHeight(pos); if (expandingChildren == 0) {
setMaximumHeight(pos); setMaximumHeight(pos);
} else {
setMaximumHeight(16777215);
}
return pos; return pos;
} }
void RollupWidget::paintEvent(QPaintEvent*) void RollupWidget::paintEvent(QPaintEvent*)
{ {
QPainter p(this); QPainter p(this);
QColor frame = palette().highlight().color(); QColor frame = palette().highlight().color();
// Eigenbau // Eigenbau
QFontMetrics fm(font()); QFontMetrics fm(font());
p.setRenderHint(QPainter::Antialiasing, true); p.setRenderHint(QPainter::Antialiasing, true);
// Ecken // Ecken
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(palette().base()); p.setBrush(palette().base());
p.drawRect(0, 0, 5, 5); p.drawRect(0, 0, 5, 5);
p.drawRect(width() - 5, 0, 5, 5); p.drawRect(width() - 5, 0, 5, 5);
p.drawRect(0, height() - 5, 5, 5); p.drawRect(0, height() - 5, 5, 5);
p.drawRect(width() - 5, height() - 5, 5, 5); p.drawRect(width() - 5, height() - 5, 5, 5);
// Rahmen // Rahmen
p.setPen(m_highlighted ? Qt::white : frame); p.setPen(m_highlighted ? Qt::white : frame);
p.setBrush(palette().window()); p.setBrush(palette().window());
QRectF r(rect()); QRectF r(rect());
r.adjust(0.5, 0.5, -0.5, -0.5); r.adjust(0.5, 0.5, -0.5, -0.5);
p.drawRoundedRect(r, 3.0, 3.0, Qt::AbsoluteSize); p.drawRoundedRect(r, 3.0, 3.0, Qt::AbsoluteSize);
// Titel-Hintergrund // Titel-Hintergrund
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(m_titleColor); p.setBrush(m_titleColor);
QPainterPath path; QPainterPath path;
path.moveTo(1.5, fm.height() + 2.5); path.moveTo(1.5, fm.height() + 2.5);
path.lineTo(width() - 1.5, fm.height() + 2.5); path.lineTo(width() - 1.5, fm.height() + 2.5);
path.lineTo(width() - 1.5, 3.5); path.lineTo(width() - 1.5, 3.5);
path.arcTo(QRectF(width() - 3.5, 0, 2.5, 2.5), 270, -90); path.arcTo(QRectF(width() - 3.5, 0, 2.5, 2.5), 270, -90);
path.lineTo(3.5, 1.5); path.lineTo(3.5, 1.5);
path.arcTo(QRectF(1.5, 2.5, 2.5, 2.5), 90, 90); path.arcTo(QRectF(1.5, 2.5, 2.5, 2.5), 90, 90);
p.drawPath(path); p.drawPath(path);
// Titel-Abschlusslinie // Titel-Abschlusslinie
p.setPen(frame); p.setPen(frame);
p.drawLine(QPointF(0.5, 2 + fm.height() + 1.5), QPointF(width() - 1.5, 2 + fm.height() + 1.5)); p.drawLine(QPointF(0.5, 2 + fm.height() + 1.5), QPointF(width() - 1.5, 2 + fm.height() + 1.5));
// Aktiv-Button links // Aktiv-Button links
p.setPen(QPen(palette().windowText().color(), 1.0)); p.setPen(QPen(palette().windowText().color(), 1.0));
p.setBrush(palette().light()); p.setBrush(palette().light());
p.drawRoundedRect(QRectF(3.5, 3.5, fm.ascent(), fm.ascent()), 2.0, 2.0, Qt::AbsoluteSize); p.drawRoundedRect(QRectF(3.5, 3.5, fm.ascent(), fm.ascent()), 2.0, 2.0, Qt::AbsoluteSize);
p.setPen(QPen(Qt::white, 1.0)); p.setPen(QPen(Qt::white, 1.0));
p.drawText(QRectF(3.5, 2.5, fm.ascent(), fm.ascent()), Qt::AlignCenter, "c"); p.drawText(QRectF(3.5, 2.5, fm.ascent(), fm.ascent()), Qt::AlignCenter, "c");
if (m_channelWidget) if (m_channelWidget)
{
// Stromkanal-Button links
p.setPen(QPen(palette().windowText().color(), 1.0));
p.setBrush(palette().light());
p.drawRoundedRect(QRectF(5.5 + fm.ascent(), 2.5, fm.ascent() + 2.0, fm.ascent() + 2.0), 2.0, 2.0, Qt::AbsoluteSize);
p.setPen(QPen(Qt::white, 1.0));
p.drawText(QRectF(5.5 + fm.ascent(), 2.5, fm.ascent() + 2.0, fm.ascent() + 2.0), Qt::AlignCenter, m_streamIndicator);
}
// Schließen-Button rechts
p.setRenderHint(QPainter::Antialiasing, true);
p.setPen(QPen(palette().windowText().color(), 1.0));
p.setBrush(palette().light());
r = QRectF(width() - 3.5 - fm.ascent(), 3.5, fm.ascent(), fm.ascent());
p.drawRoundedRect(r, 2.0, 2.0, Qt::AbsoluteSize);
p.setPen(QPen(palette().windowText().color(), 1.5));
p.drawLine(r.topLeft() + QPointF(1, 1), r.bottomRight() + QPointF(-1, -1));
p.drawLine(r.bottomLeft() + QPointF(1, -1), r.topRight() + QPointF(-1, 1));
// Titel
//p.setPen(palette().highlightedText().color());
p.setPen(m_titleTextColor);
p.drawText(QRect(2 + 2*fm.height() + 2, 2, width() - 6 - 3*fm.height(), fm.height()),
fm.elidedText(windowTitle(), Qt::ElideMiddle, width() - 6 - 3*fm.height(), 0));
// Rollups
int pos = fm.height() + 4;
const QObjectList& c = children();
QObjectList::ConstIterator w = c.begin();
QObjectList::ConstIterator n = c.begin();
for (n = c.begin(); n != c.end(); ++n)
{ {
if (qobject_cast<QWidget*>(*n) != nullptr) { // Stromkanal-Button links
break; p.setPen(QPen(palette().windowText().color(), 1.0));
p.setBrush(palette().light());
p.drawRoundedRect(QRectF(5.5 + fm.ascent(), 2.5, fm.ascent() + 2.0, fm.ascent() + 2.0), 2.0, 2.0, Qt::AbsoluteSize);
p.setPen(QPen(Qt::white, 1.0));
p.drawText(QRectF(5.5 + fm.ascent(), 2.5, fm.ascent() + 2.0, fm.ascent() + 2.0), Qt::AlignCenter, m_streamIndicator);
}
// Schließen-Button rechts
p.setRenderHint(QPainter::Antialiasing, true);
p.setPen(QPen(palette().windowText().color(), 1.0));
p.setBrush(palette().light());
r = QRectF(width() - 3.5 - fm.ascent(), 3.5, fm.ascent(), fm.ascent());
p.drawRoundedRect(r, 2.0, 2.0, Qt::AbsoluteSize);
p.setPen(QPen(palette().windowText().color(), 1.5));
p.drawLine(r.topLeft() + QPointF(1, 1), r.bottomRight() + QPointF(-1, -1));
p.drawLine(r.bottomLeft() + QPointF(1, -1), r.topRight() + QPointF(-1, 1));
// Titel
//p.setPen(palette().highlightedText().color());
p.setPen(m_titleTextColor);
p.drawText(QRect(2 + 2*fm.height() + 2, 2, width() - 6 - 3*fm.height(), fm.height()),
fm.elidedText(windowTitle(), Qt::ElideMiddle, width() - 6 - 3*fm.height(), 0));
// Rollups
int pos = fm.height() + 4;
const QObjectList& c = children();
QObjectList::ConstIterator w = c.begin();
QObjectList::ConstIterator n = c.begin();
for (n = c.begin(); n != c.end(); ++n)
{
if (qobject_cast<QWidget*>(*n) != nullptr) {
break;
} }
} }
for (w = n; w != c.end(); w = n) for (w = n; w != c.end(); w = n)
{ {
if (n != c.end()) { if (n != c.end()) {
++n; ++n;
} }
for (; n != c.end(); ++n) for (; n != c.end(); ++n)
{ {
if (qobject_cast<QWidget*>(*n) != nullptr) { if (qobject_cast<QWidget*>(*n) != nullptr) {
break; break;
} }
} }
pos += paintRollup(qobject_cast<QWidget*>(*w), pos, &p, n == c.end(), frame); pos += paintRollup(qobject_cast<QWidget*>(*w), pos, &p, n == c.end(), frame);
} }
} }
int RollupWidget::paintRollup(QWidget* rollup, int pos, QPainter* p, bool last, const QColor& frame) int RollupWidget::paintRollup(QWidget* rollup, int pos, QPainter* p, bool last, const QColor& frame)
{ {
QFontMetrics fm(font()); QFontMetrics fm(font());
int height = 1; int height = 1;
// Titel-Abschlusslinie // Titel-Abschlusslinie
if (!rollup->isHidden()) if (!rollup->isHidden())
{ {
p->setPen(palette().dark().color()); p->setPen(palette().dark().color());
p->drawLine(QPointF(1.5, pos + fm.height() + 1.5), QPointF(width() - 1.5, pos + fm.height() + 1.5)); p->drawLine(QPointF(1.5, pos + fm.height() + 1.5), QPointF(width() - 1.5, pos + fm.height() + 1.5));
p->setPen(palette().light().color()); p->setPen(palette().light().color());
p->drawLine(QPointF(1.5, pos + fm.height() + 2.5), QPointF(width() - 1.5, pos + fm.height() + 2.5)); p->drawLine(QPointF(1.5, pos + fm.height() + 2.5), QPointF(width() - 1.5, pos + fm.height() + 2.5));
height += 2; height += 2;
} }
else else
{ {
if (!last) if (!last)
{ {
p->setPen(frame); p->setPen(frame);
p->drawLine(QPointF(1.5, pos + fm.height() + 1.5), QPointF(width() - 1.5, pos + fm.height() + 1.5)); p->drawLine(QPointF(1.5, pos + fm.height() + 1.5), QPointF(width() - 1.5, pos + fm.height() + 1.5));
height++; height++;
} }
} }
// Titel // Titel
p->setPen(palette().windowText().color()); p->setPen(palette().windowText().color());
p->drawText(QRect(2 + fm.height(), pos, width() - 4 - fm.height(), fm.height()), p->drawText(QRect(2 + fm.height(), pos, width() - 4 - fm.height(), fm.height()),
fm.elidedText(rollup->windowTitle(), Qt::ElideMiddle, width() - 4 - fm.height(), 0)); fm.elidedText(rollup->windowTitle(), Qt::ElideMiddle, width() - 4 - fm.height(), 0));
height += fm.height(); height += fm.height();
// Ausklapp-Icon // Ausklapp-Icon
p->setPen(palette().windowText().color()); p->setPen(palette().windowText().color());
p->setBrush(palette().windowText()); p->setBrush(palette().windowText());
if (!rollup->isHidden()) if (!rollup->isHidden())
{ {
QPolygonF a; QPolygonF a;
a.append(QPointF(3.5, pos + 2)); a.append(QPointF(3.5, pos + 2));
a.append(QPointF(3.5 + fm.ascent(), pos + 2)); a.append(QPointF(3.5 + fm.ascent(), pos + 2));
a.append(QPointF(3.5 + fm.ascent() / 2.0, pos + fm.height() - 2)); a.append(QPointF(3.5 + fm.ascent() / 2.0, pos + fm.height() - 2));
p->drawPolygon(a); p->drawPolygon(a);
} }
else else
{ {
QPolygonF a; QPolygonF a;
a.append(QPointF(3.5, pos + 2)); a.append(QPointF(3.5, pos + 2));
a.append(QPointF(3.5, pos + fm.height() - 2)); a.append(QPointF(3.5, pos + fm.height() - 2));
a.append(QPointF(3.5 + fm.ascent(), pos + fm.height() / 2)); a.append(QPointF(3.5 + fm.ascent(), pos + fm.height() / 2));
p->drawPolygon(a); p->drawPolygon(a);
} }
// Inhalt // Inhalt
if (!rollup->isHidden() && (!last)) if (!rollup->isHidden() && (!last))
{ {
// Rollup-Abschlusslinie // Rollup-Abschlusslinie
p->setPen(frame); p->setPen(frame);
p->drawLine(QPointF(1.5, pos + fm.height() + rollup->height() + 6.5), p->drawLine(QPointF(1.5, pos + fm.height() + rollup->height() + 6.5),
QPointF(width() - 1.5, pos + fm.height() + rollup->height() + 6.5)); QPointF(width() - 1.5, pos + fm.height() + rollup->height() + 6.5));
height += rollup->height() + 4; height += rollup->height() + 4;
} }
return height; return height;
} }
void RollupWidget::resizeEvent(QResizeEvent* size) void RollupWidget::resizeEvent(QResizeEvent* size)
{ {
arrangeRollups(); m_newHeight = size->size().height();
QWidget::resizeEvent(size); arrangeRollups();
QWidget::resizeEvent(size);
} }
void RollupWidget::mousePressEvent(QMouseEvent* event) void RollupWidget::mousePressEvent(QMouseEvent* event)
{ {
QFontMetrics fm(font()); QFontMetrics fm(font());
// menu box left // menu box left
if (QRectF(3.5, 3.5, fm.ascent(), fm.ascent()).contains(event->pos())) if (QRectF(3.5, 3.5, fm.ascent(), fm.ascent()).contains(event->pos()))
{ {
m_contextMenuType = ContextMenuChannelSettings; m_contextMenuType = ContextMenuChannelSettings;
emit customContextMenuRequested(event->globalPos()); emit customContextMenuRequested(event->globalPos());
return; return;
} }
if (m_channelWidget) if (m_channelWidget)
{ {
// Stream channel menu left // Stream channel menu left
if (QRectF(5.5 + fm.ascent(), 2.5, fm.ascent() + 2.0, fm.ascent() + 2.0).contains(event->pos())) if (QRectF(5.5 + fm.ascent(), 2.5, fm.ascent() + 2.0, fm.ascent() + 2.0).contains(event->pos()))
{ {
m_contextMenuType = ContextMenuStreamSettings; m_contextMenuType = ContextMenuStreamSettings;
emit customContextMenuRequested(event->globalPos()); emit customContextMenuRequested(event->globalPos());
return; return;
} }
} }
// close button right // close button right
if(QRectF(width() - 3.5 - fm.ascent(), 3.5, fm.ascent(), fm.ascent()).contains(event->pos())) { if(QRectF(width() - 3.5 - fm.ascent(), 3.5, fm.ascent(), fm.ascent()).contains(event->pos())) {
close(); close();
return; return;
} }
// check if we need to change a rollup widget // check if we need to change a rollup widget
int pos = fm.height() + 4; int pos = fm.height() + 4;
for (int i = 0; i < children().count(); ++i) for (int i = 0; i < children().count(); ++i)
{ {
QWidget* r = qobject_cast<QWidget*>(children()[i]); QWidget* r = qobject_cast<QWidget*>(children()[i]);
if (r) if (r)
{ {
if ((event->y() >= pos) && (event->y() < (pos + fm.height() + 3))) if ((event->y() >= pos) && (event->y() < (pos + fm.height() + 3)))
{ {
if (r->isHidden()) if (r->isHidden())
{ {
r->show(); r->show();
//emit widgetRolled(r, true); //emit widgetRolled(r, true);
} }
else else
{ {
r->hide(); r->hide();
//emit widgetRolled(r, false); //emit widgetRolled(r, false);
} }
arrangeRollups(); arrangeRollups();
repaint(); repaint();
return; return;
} }
else else
{ {
pos += fm.height() + 2; pos += fm.height() + 2;
if (!r->isHidden()) { if (!r->isHidden()) {
pos += r->height() + 5; pos += r->height() + 5;
} }
} }
} }
} }
} }
bool RollupWidget::event(QEvent* event) bool RollupWidget::event(QEvent* event)
{ {
if (event->type() == QEvent::ChildAdded) if (event->type() == QEvent::ChildAdded)
{ {
((QChildEvent*)event)->child()->installEventFilter(this); ((QChildEvent*)event)->child()->installEventFilter(this);
arrangeRollups(); arrangeRollups();
} }
else if (event->type() == QEvent::ChildRemoved) else if (event->type() == QEvent::ChildRemoved)
{ {
((QChildEvent*)event)->child()->removeEventFilter(this); ((QChildEvent*)event)->child()->removeEventFilter(this);
arrangeRollups(); arrangeRollups();
} }
return QWidget::event(event); return QWidget::event(event);
} }
bool RollupWidget::eventFilter(QObject* object, QEvent* event) bool RollupWidget::eventFilter(QObject* object, QEvent* event)
{ {
if (event->type() == QEvent::Show) if (event->type() == QEvent::Show)
{ {
if (children().contains(object)) if (children().contains(object))
{ {
arrangeRollups(); arrangeRollups();
emit widgetRolled(qobject_cast<QWidget*>(object), true); emit widgetRolled(qobject_cast<QWidget*>(object), true);
} }
} }
else if (event->type() == QEvent::Hide) else if (event->type() == QEvent::Hide)
{ {
if (children().contains(object)) if (children().contains(object))
{ {
arrangeRollups(); arrangeRollups();
emit widgetRolled(qobject_cast<QWidget*>(object), false); emit widgetRolled(qobject_cast<QWidget*>(object), false);
} }
} }
else if (event->type() == QEvent::WindowTitleChange) else if (event->type() == QEvent::WindowTitleChange)
{ {
if (children().contains(object)) { if (children().contains(object)) {
repaint(); repaint();
} }
} }
return QWidget::eventFilter(object, event); return QWidget::eventFilter(object, event);
} }
void RollupWidget::setStreamIndicator(const QString& indicator) void RollupWidget::setStreamIndicator(const QString& indicator)
{ {
m_streamIndicator = indicator; m_streamIndicator = indicator;
update(); update();
} }
bool RollupWidget::isRollupChild(QWidget *childWidget) bool RollupWidget::isRollupChild(QWidget *childWidget)

View File

@ -24,21 +24,21 @@
#include "export.h" #include "export.h"
class SDRGUI_API RollupWidget : public QWidget { class SDRGUI_API RollupWidget : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
RollupWidget(QWidget* parent = nullptr); RollupWidget(QWidget* parent = nullptr);
void setTitleColor(const QColor& c); void setTitleColor(const QColor& c);
void setHighlighted(bool highlighted); void setHighlighted(bool highlighted);
void setChannelWidget(bool channelWidget) { m_channelWidget = channelWidget; } void setChannelWidget(bool channelWidget) { m_channelWidget = channelWidget; }
signals: signals:
void widgetRolled(QWidget* widget, bool rollDown); void widgetRolled(QWidget* widget, bool rollDown);
protected: protected:
enum { enum {
VersionMarker = 0xff VersionMarker = 0xff
}; };
enum ContextMenuType enum ContextMenuType
{ {
@ -47,32 +47,33 @@ protected:
ContextMenuStreamSettings ContextMenuStreamSettings
}; };
QColor m_titleColor; QColor m_titleColor;
QColor m_titleTextColor; QColor m_titleTextColor;
bool m_highlighted; bool m_highlighted;
ContextMenuType m_contextMenuType; ContextMenuType m_contextMenuType;
QString m_streamIndicator; QString m_streamIndicator;
int arrangeRollups(); int arrangeRollups();
QByteArray saveState(int version = 0) const; QByteArray saveState(int version = 0) const;
bool restoreState(const QByteArray& state, int version = 0); bool restoreState(const QByteArray& state, int version = 0);
void paintEvent(QPaintEvent*); void paintEvent(QPaintEvent*);
int paintRollup(QWidget* rollup, int pos, QPainter* p, bool last, const QColor& frame); int paintRollup(QWidget* rollup, int pos, QPainter* p, bool last, const QColor& frame);
void resizeEvent(QResizeEvent* size); void resizeEvent(QResizeEvent* size);
void mousePressEvent(QMouseEvent* event); void mousePressEvent(QMouseEvent* event);
bool event(QEvent* event); bool event(QEvent* event);
bool eventFilter(QObject* object, QEvent* event); bool eventFilter(QObject* object, QEvent* event);
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; } void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
void setStreamIndicator(const QString& indicator); void setStreamIndicator(const QString& indicator);
private: private:
static bool isRollupChild(QWidget *childWidget); //!< chidl is part of rollups (ex: not a dialog) static bool isRollupChild(QWidget *childWidget); //!< chidl is part of rollups (ex: not a dialog)
bool m_channelWidget; bool m_channelWidget;
int m_newHeight;
}; };
#endif // INCLUDE_ROLLUPWIDGET_H #endif // INCLUDE_ROLLUPWIDGET_H