mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-12-24 11:40:31 -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
|
||||
widgets/LazyFillComboBox.cpp
|
||||
widgets/CheckableItemComboBox.cpp
|
||||
widgets/BandComboBox.cpp
|
||||
)
|
||||
|
||||
set (wsjt_qtmm_CXXSRCS
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>635</width>
|
||||
<height>512</height>
|
||||
<height>523</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -1704,7 +1704,7 @@ p, li { white-space: pre-wrap; }
|
||||
<customwidget>
|
||||
<class>DisplayText</class>
|
||||
<extends>QTextBrowser</extends>
|
||||
<header>displaytext.h</header>
|
||||
<header>widgets/displaytext.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<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>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="bandComboBox">
|
||||
<widget class="BandComboBox" name="bandComboBox">
|
||||
<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>
|
||||
</property>
|
||||
@ -661,7 +661,7 @@ QPushButton[state="ok"] {
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
||||
<enum>QComboBox::AdjustToMinimumContentsLengthWithIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -3434,7 +3434,7 @@ Double-click to reset to the standard 73 message</string>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>DisplayText</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<extends>QTextBrowser</extends>
|
||||
<header>widgets/displaytext.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
@ -3468,6 +3468,11 @@ Double-click to reset to the standard 73 message</string>
|
||||
<extends>QPushButton</extends>
|
||||
<header>widgets/DoubleClickablePushButton.hpp</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BandComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>widgets/BandComboBox.hpp</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>decodedTextBrowser</tabstop>
|
||||
|
Loading…
Reference in New Issue
Block a user