Skip to content

Instantly share code, notes, and snippets.

@csete
Created November 8, 2010 23:24
Show Gist options
  • Save csete/668462 to your computer and use it in GitHub Desktop.
Save csete/668462 to your computer and use it in GitHub Desktop.
Some mods to make the height of Qt GUI sink smaller to better fit on laptop screens
diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
index d150e2e..bd67d90 100644
--- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
@@ -5,6 +5,8 @@
#include <qwt_scale_draw.h>
+#include <qwt_plot_grid.h>
+
class FreqPrecisionClass
{
public:
@@ -124,27 +126,36 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)");
setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(0));
- _minYAxis = -120;
- _maxYAxis = 10;
+ _minYAxis = -60;
+ _maxYAxis = 30;
setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis);
setAxisTitle(QwtPlot::yLeft, "Power (dB)");
+ // Canvas mods
+ setCanvasBackground(QColor(0,52,103));
+
// Automatically deleted when parent is deleted
_fft_plot_curve = new QwtPlotCurve("Power Spectrum");
_fft_plot_curve->attach(this);
- _fft_plot_curve->setPen(QPen(Qt::blue));
+ //_fft_plot_curve->setPen(QPen(Qt::cyan));
+ //_fft_plot_curve->setPen(QPen(QColor(96,130,161)));
+ _fft_plot_curve->setPen(QPen(QColor(210,255,255)));
_fft_plot_curve->setRawData(_xAxisPoints, _dataPoints, _numPoints);
_min_fft_plot_curve = new QwtPlotCurve("Minimum Power");
_min_fft_plot_curve->attach(this);
- _min_fft_plot_curve->setPen(QPen(Qt::magenta));
+ _min_fft_plot_curve->setPen(QPen(Qt::green));
+ //_min_fft_plot_curve->setPen(QPen(QColor(155,171,245)));
+ //_min_fft_plot_curve->setPen(QPen(QColor(158,200,200)));
_min_fft_plot_curve->setRawData(_xAxisPoints, _minFFTPoints, _numPoints);
_min_fft_plot_curve->setVisible(false);
_max_fft_plot_curve = new QwtPlotCurve("Maximum Power");
_max_fft_plot_curve->attach(this);
- _max_fft_plot_curve->setPen(QPen(Qt::darkYellow));
+ //_max_fft_plot_curve->setPen(QPen(Qt::darkYellow));
+ //_max_fft_plot_curve->setPen(QPen(QColor(241,171,91)));
+ _max_fft_plot_curve->setPen(QPen(QColor(96,130,161)));
_max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints);
_max_fft_plot_curve->setVisible(false);
@@ -180,7 +191,7 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
_markerNoiseFloorAmplitude = new QwtPlotMarker();
_markerNoiseFloorAmplitude->setLineStyle(QwtPlotMarker::HLine);
- _markerNoiseFloorAmplitude->setLinePen(QPen(Qt::darkRed, 0, Qt::DotLine));
+ _markerNoiseFloorAmplitude->setLinePen(QPen(Qt::red, 0, Qt::DotLine));
_markerNoiseFloorAmplitude->attach(this);
_peakFrequency = 0;
@@ -188,6 +199,16 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
_noiseFloorAmplitude = -HUGE_VAL;
+
+ // Grid (my hack)
+ QwtPlotGrid *grid = new QwtPlotGrid();
+ grid->setPen(QPen(QColor(13,69,120)));
+ grid->setMajPen(QPen(QColor(255,255,255,100)));
+ grid->setMinPen(QPen(QColor(255,255,255,50), 0, Qt::DotLine));
+ //grid->enableXMin(true);
+ //grid->enableYMin(true);
+ grid->attach(this);
+
replot();
_zoomer = new FreqDisplayZoomer(canvas(), 0);
@@ -212,7 +233,8 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
sd->setMinimumExtent( fm.width("100.00") );
- const QColor c(Qt::darkRed);
+ //const QColor c(Qt::cyan);
+ const QColor c(255,240,134);
_zoomer->setRubberBandPen(c);
_zoomer->setTrackerPen(c);
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.ui b/gr-qtgui/src/lib/spectrumdisplayform.ui
index 5a23bc8..7b733e8 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.ui
+++ b/gr-qtgui/src/lib/spectrumdisplayform.ui
@@ -7,289 +7,157 @@
<x>0</x>
<y>0</y>
<width>712</width>
- <height>543</height>
+ <height>453</height>
</rect>
</property>
<property name="windowTitle">
<string>Spectrum Display</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="1" column="3">
- <widget class="QComboBox" name="FFTSizeComboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>5</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QTabWidget" name="SpectrumTypeTab">
+ <property name="enabled">
+ <bool>true</bool>
</property>
- <property name="maximumSize">
- <size>
- <width>120</width>
- <height>16777215</height>
- </size>
+ <property name="tabShape">
+ <enum>QTabWidget::Rounded</enum>
</property>
- <item>
- <property name="text">
- <string>1024</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>2048</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>4096</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>8192</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>16384</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>32768</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLabel" name="FFTSizeLabel">
- <property name="text">
- <string>FFT Size:</string>
+ <property name="currentIndex">
+ <number>0</number>
</property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ <property name="elideMode">
+ <enum>Qt::ElideNone</enum>
</property>
- <property name="wordWrap">
+ <property name="tabsClosable">
<bool>false</bool>
</property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="UseRFFrequenciesCheckBox">
- <property name="text">
- <string>Display RF Frequencies</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="WindowLbl">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Window:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="WindowComboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>120</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>120</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="font">
- <font>
- <pointsize>9</pointsize>
- </font>
- </property>
- <item>
- <property name="text">
- <string>Hamming</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Hann</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Blackman</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Rectangular</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Kaiser</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Blackman-harris</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="0" colspan="4">
- <widget class="QTabWidget" name="SpectrumTypeTab">
- <property name="currentIndex">
- <number>0</number>
- </property>
<widget class="QWidget" name="FrequencyPage">
<attribute name="title">
<string>Frequency Display</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <widget class="QFrame" name="FrequencyPlotDisplayFrame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>400</width>
+ <height>300</height>
+ </size>
+ </property>
+ <property name="sizeIncrement">
+ <size>
+ <width>1</width>
+ <height>1</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QFrame" name="FrequencyPlotDisplayFrame">
+ <widget class="QCheckBox" name="MaxHoldCheckBox">
+ <property name="text">
+ <string>Max Hold</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="MaxHoldResetBtn">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
- <width>400</width>
- <height>350</height>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="MinHoldCheckBox">
+ <property name="text">
+ <string>Min Hold</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="MinHoldResetBtn">
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>200</width>
+ <height>20</height>
</size>
</property>
- <property name="sizeIncrement">
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="AvgLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
<size>
- <width>1</width>
- <height>1</height>
+ <width>62</width>
+ <height>0</height>
</size>
</property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
+ <property name="text">
+ <string>Average</string>
</property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
</property>
</widget>
</item>
<item>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="1" column="0">
- <widget class="QCheckBox" name="MaxHoldCheckBox">
- <property name="text">
- <string>Max Hold</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="MinHoldCheckBox">
- <property name="text">
- <string>Min Hold</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QPushButton" name="MaxHoldResetBtn">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Reset</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QLabel" name="AvgLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>62</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Average</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QPushButton" name="MinHoldResetBtn">
- <property name="text">
- <string>Reset</string>
- </property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="QSpinBox" name="AvgLineEdit"/>
- </item>
- <item row="1" column="2">
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>200</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
+ <widget class="QSpinBox" name="AvgLineEdit"/>
</item>
</layout>
</item>
@@ -362,10 +230,16 @@
</item>
<item row="1" column="0" colspan="4">
<widget class="QFrame" name="WaterfallPlotDisplayFrame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize">
<size>
<width>617</width>
- <height>338</height>
+ <height>300</height>
</size>
</property>
<property name="frameShape">
@@ -474,10 +348,16 @@
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QFrame" name="TimeDomainDisplayFrame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize">
<size>
<width>617</width>
- <height>404</height>
+ <height>350</height>
</size>
</property>
<property name="frameShape">
@@ -497,10 +377,16 @@
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QFrame" name="ConstellationDisplayFrame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize">
<size>
<width>617</width>
- <height>406</height>
+ <height>350</height>
</size>
</property>
<property name="frameShape">
@@ -515,6 +401,165 @@
</widget>
</widget>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QCheckBox" name="UseRFFrequenciesCheckBox">
+ <property name="text">
+ <string>Display RF Frequencies</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="WindowLbl">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Window:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="WindowComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
+ <item>
+ <property name="text">
+ <string>Hamming</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Hann</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Blackman</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Rectangular</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Kaiser</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Blackman-harris</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="FFTSizeLabel">
+ <property name="text">
+ <string>FFT Size:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="FFTSizeComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <item>
+ <property name="text">
+ <string>1024</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>2048</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>4096</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>8192</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>16384</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>32768</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
@@ -705,22 +750,6 @@
</hints>
</connection>
<connection>
- <sender>Waterfall3DAutoScaleBtn</sender>
- <signal>clicked()</signal>
- <receiver>SpectrumDisplayForm</receiver>
- <slot>Waterfall3DAutoScaleBtnCB()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>22</x>
- <y>349</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>WaterfallIntensityComboBox</sender>
<signal>activated(int)</signal>
<receiver>SpectrumDisplayForm</receiver>
@@ -737,22 +766,6 @@
</hints>
</connection>
<connection>
- <sender>Waterfall3DIntensityComboBox</sender>
- <signal>activated(int)</signal>
- <receiver>SpectrumDisplayForm</receiver>
- <slot>Waterfall3DIntensityColorTypeChanged(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>92</x>
- <y>44</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>SpectrumTypeTab</sender>
<signal>currentChanged(int)</signal>
<receiver>SpectrumDisplayForm</receiver>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment