Add control hiding (CTRL+M) to fast graph to minimize screen usage

Also cleans up a few layout issues.

Thanks to Mike, W9MDB, for this contribution.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7603 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-03-14 14:23:13 +00:00
parent dfecb4ed1f
commit f65242cd74
3 changed files with 258 additions and 260 deletions

View File

@ -12,14 +12,14 @@ FastGraph::FastGraph(QSettings * settings, QWidget *parent) :
QDialog {parent, Qt::Window | Qt::WindowTitleHint | QDialog {parent, Qt::Window | Qt::WindowTitleHint |
Qt::WindowCloseButtonHint | Qt::WindowCloseButtonHint |
Qt::WindowMinimizeButtonHint}, Qt::WindowMinimizeButtonHint},
m_settings (settings), m_settings {settings},
ui(new Ui::FastGraph) m_ave {40},
ui {new Ui::FastGraph}
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowTitle (QApplication::applicationName () + " - " + tr ("Fast Graph")); setWindowTitle (QApplication::applicationName () + " - " + tr ("Fast Graph"));
installEventFilter(parent); //Installing the filter installEventFilter(parent); //Installing the filter
ui->fastPlot->setCursor(Qt::CrossCursor); ui->fastPlot->setCursor(Qt::CrossCursor);
m_ave=40;
//Restore user's settings //Restore user's settings
m_settings->beginGroup("FastGraph"); m_settings->beginGroup("FastGraph");
@ -30,6 +30,7 @@ FastGraph::FastGraph(QSettings * settings, QWidget *parent) :
ui->gainSlider->setValue(ui->fastPlot->m_plotGain); ui->gainSlider->setValue(ui->fastPlot->m_plotGain);
ui->fastPlot->setGreenZero(m_settings->value("GreenZero", 0).toInt()); ui->fastPlot->setGreenZero(m_settings->value("GreenZero", 0).toInt());
ui->greenZeroSlider->setValue(ui->fastPlot->m_greenZero); ui->greenZeroSlider->setValue(ui->fastPlot->m_greenZero);
ui->controls_widget->setVisible (!m_settings->value("HideControls", false).toBool ());
m_settings->endGroup(); m_settings->endGroup();
connect (ui->fastPlot, &FPlotter::fastPick, this, &FastGraph::fastPick); connect (ui->fastPlot, &FPlotter::fastPick, this, &FastGraph::fastPick);
@ -55,6 +56,7 @@ void FastGraph::saveSettings()
m_settings->setValue("PlotGain",ui->fastPlot->m_plotGain); m_settings->setValue("PlotGain",ui->fastPlot->m_plotGain);
m_settings->setValue("GreenZero",ui->fastPlot->m_greenZero); m_settings->setValue("GreenZero",ui->fastPlot->m_greenZero);
m_settings->setValue("GreenGain",ui->fastPlot->m_greenGain); m_settings->setValue("GreenGain",ui->fastPlot->m_greenGain);
m_settings->setValue("HideControls",!ui->controls_widget->isVisible ());
m_settings->endGroup(); m_settings->endGroup();
} }
@ -105,3 +107,17 @@ void FastGraph::setMode(QString mode) //setMode
{ {
ui->fastPlot->setMode(mode); ui->fastPlot->setMode(mode);
} }
void FastGraph::keyPressEvent(QKeyEvent *e)
{
switch(e->key())
{
case Qt::Key_M:
if(e->modifiers() & Qt::ControlModifier) {
ui->controls_widget->setVisible (!ui->controls_widget->isVisible ());
}
break;
default:
QDialog::keyPressEvent (e);
}
}

View File

@ -16,6 +16,7 @@ class FastGraph : public QDialog
protected: protected:
void closeEvent (QCloseEvent *) override; void closeEvent (QCloseEvent *) override;
void keyPressEvent( QKeyEvent *e ) override;
public: public:
explicit FastGraph(QSettings *, QWidget *parent = 0); explicit FastGraph(QSettings *, QWidget *parent = 0);

View File

@ -2,39 +2,16 @@
<ui version="4.0"> <ui version="4.0">
<class>FastGraph</class> <class>FastGraph</class>
<widget class="QDialog" name="FastGraph"> <widget class="QDialog" name="FastGraph">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>710</width>
<height>250</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>710</width>
<height>250</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>710</width>
<height>250</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Fast Graph</string> <string>Fast Graph</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing"> <property name="spacing">
<number>2</number> <number>2</number>
</property> </property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>2</number> <number>2</number>
</property> </property>
@ -47,11 +24,6 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<item> <item>
<widget class="FPlotter" name="fastPlot"> <widget class="FPlotter" name="fastPlot">
<property name="enabled"> <property name="enabled">
@ -87,9 +59,19 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <widget class="QWidget" name="controls_widget" native="true">
<property name="spacing"> <layout class="QHBoxLayout" name="horizontalLayout">
<number>6</number> <property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property> </property>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
@ -101,7 +83,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>99</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -232,15 +214,14 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>99</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> </layout>
</item> </widget>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>