mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-21 19:55:20 -05:00
Improve band combo box pop up list width management
This commit is contained in:
parent
31a4fac516
commit
b241b913ba
@ -238,6 +238,7 @@ set (wsjt_qt_CXXSRCS
|
|||||||
Network/NetworkAccessManager.cpp
|
Network/NetworkAccessManager.cpp
|
||||||
widgets/LazyFillComboBox.cpp
|
widgets/LazyFillComboBox.cpp
|
||||||
widgets/CheckableItemComboBox.cpp
|
widgets/CheckableItemComboBox.cpp
|
||||||
|
widgets/BandComboBox.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set (wsjt_qtmm_CXXSRCS
|
set (wsjt_qtmm_CXXSRCS
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>635</width>
|
<width>635</width>
|
||||||
<height>512</height>
|
<height>523</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -1704,7 +1704,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<customwidget>
|
<customwidget>
|
||||||
<class>DisplayText</class>
|
<class>DisplayText</class>
|
||||||
<extends>QTextBrowser</extends>
|
<extends>QTextBrowser</extends>
|
||||||
<header>displaytext.h</header>
|
<header>widgets/displaytext.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
27
widgets/BandComboBox.cpp
Normal file
27
widgets/BandComboBox.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "BandComboBox.hpp"
|
||||||
|
|
||||||
|
#include <QAbstractItemView>
|
||||||
|
#include <QScrollBar>
|
||||||
|
#include <QDebug>
|
||||||
|
#include "models/FrequencyList.hpp"
|
||||||
|
|
||||||
|
BandComboBox::BandComboBox (QWidget * parent)
|
||||||
|
: QComboBox {parent}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix up broken QComboBox item view rendering which doesn't allow for
|
||||||
|
// a vertical scroll bar in width calculations and ends up eliding the
|
||||||
|
// item text.
|
||||||
|
void BandComboBox::showPopup ()
|
||||||
|
{
|
||||||
|
auto minimum_width = view ()->sizeHintForColumn (FrequencyList_v2::frequency_mhz_column);
|
||||||
|
if (count () > maxVisibleItems ())
|
||||||
|
{
|
||||||
|
// for some as yet unknown reason, in FT8 mode the scrollbar
|
||||||
|
// width is oversize on the first call here
|
||||||
|
minimum_width += view ()->verticalScrollBar ()->width ();
|
||||||
|
}
|
||||||
|
view ()->setMinimumWidth (minimum_width);
|
||||||
|
QComboBox::showPopup ();
|
||||||
|
}
|
16
widgets/BandComboBox.hpp
Normal file
16
widgets/BandComboBox.hpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef BAND_COMBO_BOX_HPP__
|
||||||
|
#define BAND_COMBO_BOX_HPP__
|
||||||
|
|
||||||
|
#include <QComboBox>
|
||||||
|
|
||||||
|
class BandComboBox
|
||||||
|
: public QComboBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit BandComboBox (QWidget * = nullptr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void showPopup () override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -644,7 +644,7 @@ QPushButton[state="ok"] {
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QComboBox" name="bandComboBox">
|
<widget class="BandComboBox" name="bandComboBox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html></string>
|
<string><html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
@ -661,7 +661,7 @@ QPushButton[state="ok"] {
|
|||||||
<enum>QComboBox::NoInsert</enum>
|
<enum>QComboBox::NoInsert</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeAdjustPolicy">
|
<property name="sizeAdjustPolicy">
|
||||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
<enum>QComboBox::AdjustToMinimumContentsLengthWithIcon</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -3434,7 +3434,7 @@ Double-click to reset to the standard 73 message</string>
|
|||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>DisplayText</class>
|
<class>DisplayText</class>
|
||||||
<extends>QTextEdit</extends>
|
<extends>QTextBrowser</extends>
|
||||||
<header>widgets/displaytext.h</header>
|
<header>widgets/displaytext.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
@ -3468,6 +3468,11 @@ Double-click to reset to the standard 73 message</string>
|
|||||||
<extends>QPushButton</extends>
|
<extends>QPushButton</extends>
|
||||||
<header>widgets/DoubleClickablePushButton.hpp</header>
|
<header>widgets/DoubleClickablePushButton.hpp</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BandComboBox</class>
|
||||||
|
<extends>QComboBox</extends>
|
||||||
|
<header>widgets/BandComboBox.hpp</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>decodedTextBrowser</tabstop>
|
<tabstop>decodedTextBrowser</tabstop>
|
||||||
|
Loading…
Reference in New Issue
Block a user