File: BandComboBox.cpp

package info (click to toggle)
wsjtx-improved 3.0.0%2B250924%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 86,260 kB
  • sloc: cpp: 105,882; f90: 60,117; python: 27,241; ansic: 13,372; fortran: 2,382; makefile: 197; sh: 135
file content (27 lines) | stat: -rwxr-xr-x 825 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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_101::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 ();
}