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 |
Qt::WindowCloseButtonHint |
Qt::WindowMinimizeButtonHint},
m_settings (settings),
ui(new Ui::FastGraph)
m_settings {settings},
m_ave {40},
ui {new Ui::FastGraph}
{
ui->setupUi(this);
setWindowTitle (QApplication::applicationName () + " - " + tr ("Fast Graph"));
installEventFilter(parent); //Installing the filter
ui->fastPlot->setCursor(Qt::CrossCursor);
m_ave=40;
//Restore user's settings
m_settings->beginGroup("FastGraph");
@ -30,6 +30,7 @@ FastGraph::FastGraph(QSettings * settings, QWidget *parent) :
ui->gainSlider->setValue(ui->fastPlot->m_plotGain);
ui->fastPlot->setGreenZero(m_settings->value("GreenZero", 0).toInt());
ui->greenZeroSlider->setValue(ui->fastPlot->m_greenZero);
ui->controls_widget->setVisible (!m_settings->value("HideControls", false).toBool ());
m_settings->endGroup();
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("GreenZero",ui->fastPlot->m_greenZero);
m_settings->setValue("GreenGain",ui->fastPlot->m_greenGain);
m_settings->setValue("HideControls",!ui->controls_widget->isVisible ());
m_settings->endGroup();
}
@ -105,3 +107,17 @@ void FastGraph::setMode(QString mode) //setMode
{
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:
void closeEvent (QCloseEvent *) override;
void keyPressEvent( QKeyEvent *e ) override;
public:
explicit FastGraph(QSettings *, QWidget *parent = 0);

View File

@ -2,39 +2,16 @@
<ui version="4.0">
<class>FastGraph</class>
<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">
<string>Fast Graph</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>2</number>
</property>
@ -47,11 +24,6 @@
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="FPlotter" name="fastPlot">
<property name="enabled">
@ -87,9 +59,19 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>6</number>
<widget class="QWidget" name="controls_widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<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>
<item>
<spacer name="horizontalSpacer_2">
@ -101,7 +83,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>99</width>
<height>20</height>
</size>
</property>
@ -232,15 +214,14 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>99</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>