mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 18:50:44 +00:00
Some more unfinished work on the YAxis context menu
This commit is contained in:
parent
0e8972358a
commit
b77fa2db8e
@ -255,7 +255,7 @@ void gGraph::setDay(Day *day)
|
||||
void gGraph::setZoomY(short zoom)
|
||||
{
|
||||
m_zoomY = zoom;
|
||||
redraw();
|
||||
timedRedraw(0);
|
||||
}
|
||||
|
||||
void gGraph::renderText(QString text, int x, int y, float angle, QColor color, QFont *font, bool antialias)
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <QTimer>
|
||||
#include <QFontMetrics>
|
||||
#include <QWidgetAction>
|
||||
#include <QGridLayout>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
# include <QWindow>
|
||||
@ -356,7 +357,7 @@ gGraphView::gGraphView(QWidget *parent, gGraphView *shared)
|
||||
context_menu->addAction(tr("Reset Graph Layout"), this, SLOT(resetLayout()));
|
||||
|
||||
context_menu->addSeparator();
|
||||
limits_menu = context_menu->addMenu(tr("Graph Limits"));
|
||||
limits_menu = context_menu->addMenu(tr("Y-Axis"));
|
||||
plots_menu = context_menu->addMenu(tr("Plots"));
|
||||
connect(plots_menu, SIGNAL(triggered(QAction*)), this, SLOT(onPlotsClicked(QAction*)));
|
||||
|
||||
@ -1663,10 +1664,9 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
MinMaxWidget::MinMaxWidget(gGraph * graph, QWidget *parent): QWidget(parent), graph(graph)
|
||||
MinMaxWidget::MinMaxWidget(gGraph * graph, QWidget *parent)
|
||||
:QWidget(parent), graph(graph)
|
||||
{
|
||||
|
||||
// setWindowFlags(windowFlags() | Qt::Popup);
|
||||
createLayout();
|
||||
}
|
||||
|
||||
@ -1680,27 +1680,84 @@ void MinMaxWidget::onMaxChanged(double d)
|
||||
graph->rec_maxy = d;
|
||||
graph->timedRedraw(0);
|
||||
}
|
||||
//void MinMaxWidget::onCheckToggled(bool b)
|
||||
//{
|
||||
// graph->setZoomY(b ? 1 : 0);
|
||||
//}
|
||||
|
||||
void MinMaxWidget::onComboChanged(int idx)
|
||||
{
|
||||
minbox->setEnabled(idx == 2);
|
||||
maxbox->setEnabled(idx == 2);
|
||||
|
||||
graph->setZoomY(idx);
|
||||
|
||||
if (idx == 2) {
|
||||
if (qAbs(graph->rec_maxy - graph->rec_miny) < 0.000001) {
|
||||
setMax(graph->rec_maxy = floor(graph->MaxY()));
|
||||
setMin(graph->rec_miny = ceil(graph->MinY()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MinMaxWidget::createLayout()
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout;
|
||||
QGridLayout * layout = new QGridLayout;
|
||||
// layout->set
|
||||
// QHBoxLayout *layout = new QHBoxLayout;
|
||||
layout->setMargin(4);
|
||||
layout->setSpacing(4);
|
||||
checkbox = new QCheckBox(" ",this);
|
||||
checkbox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
// checkbox = new QCheckBox(tr("Auto Scale")+" ",this);
|
||||
// checkbox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
// connect(checkbox, SIGNAL(toggled(bool)), this, SLOT(onCheckToggled(bool)));
|
||||
|
||||
combobox = new QComboBox(this);
|
||||
combobox->addItem(tr("Auto-Fit"), 0);
|
||||
combobox->addItem(tr("Defaults"), 1);
|
||||
combobox->addItem(tr("Override"), 2);
|
||||
connect(combobox, SIGNAL(activated(int)), this, SLOT(onComboChanged(int)));
|
||||
|
||||
minbox = new QDoubleSpinBox(this);
|
||||
maxbox = new QDoubleSpinBox(this);
|
||||
minbox->setMinimum(-99999.9);
|
||||
maxbox->setMinimum(-99999.9);
|
||||
minbox->setMaximum(99999.9);
|
||||
maxbox->setMaximum(99999.9);
|
||||
graph->graphView()->connect(minbox, SIGNAL(valueChanged(double)), this, SLOT(onMinChanged(double)));
|
||||
graph->graphView()->connect(maxbox, SIGNAL(valueChanged(double)), this, SLOT(onMaxChanged(double)));
|
||||
layout->addWidget(checkbox);
|
||||
layout->addWidget(new QLabel(STR_TR_Min));
|
||||
layout->addWidget(minbox);
|
||||
layout->addWidget(new QLabel(STR_TR_Max));
|
||||
layout->addWidget(maxbox);
|
||||
|
||||
int idx = graph->zoomY();
|
||||
combobox->setCurrentIndex(idx);
|
||||
|
||||
minbox->setEnabled(idx == 2);
|
||||
maxbox->setEnabled(idx == 2);
|
||||
|
||||
setMin(graph->rec_miny);
|
||||
setMax(graph->rec_maxy);
|
||||
minbox->setAlignment(Qt::AlignRight);
|
||||
maxbox->setAlignment(Qt::AlignRight);
|
||||
|
||||
minbox->setMinimum(graph->physMinY());
|
||||
maxbox->setMinimum(graph->physMinY());
|
||||
minbox->setMaximum(9999.99);
|
||||
maxbox->setMaximum(9999.99);
|
||||
connect(minbox, SIGNAL(valueChanged(double)), this, SLOT(onMinChanged(double)));
|
||||
connect(maxbox, SIGNAL(valueChanged(double)), this, SLOT(onMaxChanged(double)));
|
||||
|
||||
QLabel * label = new QLabel(tr("Scaling Mode"));
|
||||
QFont font = label->font();
|
||||
font.setBold(true);
|
||||
label->setFont(font);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(label,0,0);
|
||||
layout->addWidget(combobox,1,0);
|
||||
|
||||
label = new QLabel(STR_TR_Min);
|
||||
label->setFont(font);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(label,0,1);
|
||||
layout->addWidget(minbox,1,1);
|
||||
|
||||
label = new QLabel(STR_TR_Max);
|
||||
label->setFont(font);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(label,0,2);
|
||||
layout->addWidget(maxbox,1,2);
|
||||
this->setLayout(layout);
|
||||
}
|
||||
|
||||
@ -1719,9 +1776,9 @@ void gGraphView::populateMenu(gGraph * graph)
|
||||
|
||||
widget->setDefaultWidget(minmax);
|
||||
|
||||
minmax->setMax(graph->rec_maxy);
|
||||
minmax->setMin(graph->rec_miny);
|
||||
minmax->setChecked(true);
|
||||
// minmax->setMax(graph->rec_maxy);
|
||||
// minmax->setMin(graph->rec_miny);
|
||||
// minmax->setComboIndex(graph->zoomY());
|
||||
|
||||
limits_menu->addAction(widget);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <QPixmapCache>
|
||||
#include <QMenu>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
#ifndef BROKEN_OPENGL_BUILD
|
||||
@ -48,17 +49,21 @@ public:
|
||||
}
|
||||
double min() { return minbox->value(); }
|
||||
double max() { return maxbox->value(); }
|
||||
void setComboIndex(int i) { combobox->setCurrentIndex(i); }
|
||||
int comboIndex() { return combobox->currentIndex(); }
|
||||
|
||||
void setChecked(bool b) { checkbox->setChecked(b); }
|
||||
bool checked() { return checkbox->isChecked(); }
|
||||
// void setChecked(bool b) { checkbox->setChecked(b); }
|
||||
// bool checked() { return checkbox->isChecked(); }
|
||||
|
||||
public slots:
|
||||
void onMinChanged(double d);
|
||||
void onMaxChanged(double d);
|
||||
|
||||
void onComboChanged(int idx);
|
||||
//void onCheckToggled(bool b);
|
||||
protected:
|
||||
gGraph * graph;
|
||||
QCheckBox *checkbox;
|
||||
QComboBox *combobox;
|
||||
// QCheckBox *checkbox;
|
||||
QDoubleSpinBox *minbox;
|
||||
QDoubleSpinBox *maxbox;
|
||||
};
|
||||
|
@ -110,7 +110,7 @@ QString GenerateWelcomeHTML()
|
||||
"</table>"
|
||||
"</td>";
|
||||
if (havecpapdata || haveoximeterdata) {
|
||||
html += "<td align=center><font size=+2>or</font></td>"
|
||||
html += "<td align=center><font size=+2>"+QObject::tr("or")+"</font></td>"
|
||||
"<td align=center>"
|
||||
"<table class=curved cellpadding=4>"
|
||||
"<tr><td align=center onmouseover='ChangeColor(this, \"#eeeeee\");' onmouseout='ChangeColor(this, \"#ffffff\");' onclick='alert(\"statistics=1\");'><font size=+1><img src='qrc:/icons/statistics.png' width=128px><br/>" + QObject::tr("View<br/>Statistics")+"</font></td></tr>"
|
||||
|
Loading…
Reference in New Issue
Block a user