Skip to content

Commit

Permalink
FIX TTF and style
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Aug 14, 2021
1 parent da8e546 commit 13d546d
Show file tree
Hide file tree
Showing 12 changed files with 2,191 additions and 95 deletions.
2,001 changes: 2,001 additions & 0 deletions datasamples/simple_fft.csv

Large diffs are not rendered by default.

39 changes: 10 additions & 29 deletions plotjuggler_app/plotwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,10 @@ QDomElement PlotWidget::xmlSaveState(QDomDocument& doc) const
{
plot_el.setAttribute("style", "Dots");
}
else if (curveStyle() == PlotWidgetBase::STICKS)
{
plot_el.setAttribute("style", "Sticks");
}

for (auto& it : curveList())
{
Expand Down Expand Up @@ -723,6 +727,10 @@ bool PlotWidget::xmlLoadState(QDomElement& plot_widget)
{
changeCurvesStyle( PlotWidgetBase::DOTS );
}
else if (style == "Sticks" )
{
changeCurvesStyle( PlotWidgetBase::STICKS );
}
}

updateMaximumZoomArea();
Expand Down Expand Up @@ -1242,42 +1250,15 @@ void PlotWidget::on_pasteAction_triggered()

bool PlotWidget::eventFilter(QObject* obj, QEvent* event)
{
if( event->type() == QEvent::Destroy )
if( PlotWidgetBase::eventFilter(obj, event) )
{
return false;
}
QwtScaleWidget* bottomAxis = qwtPlot()->axisWidget(QwtPlot::xBottom);
QwtScaleWidget* leftAxis = qwtPlot()->axisWidget(QwtPlot::yLeft);

if (magnifier() &&
(obj == bottomAxis || obj == leftAxis)
&& !(isXYPlot()
&& keepRatioXY()))
{
if (event->type() == QEvent::Wheel)
{
auto wheel_event = dynamic_cast<QWheelEvent*>(event);
if (obj == bottomAxis)
{
magnifier()->setDefaultMode(PlotMagnifier::X_AXIS);
}
else
{
magnifier()->setDefaultMode(PlotMagnifier::Y_AXIS);
}
magnifier()->widgetWheelEvent(wheel_event);
}
return true;
}

if (obj == qwtPlot()->canvas())
{
if (magnifier())
{
magnifier()->setDefaultMode(PlotMagnifier::BOTH_AXES);
}
return canvasEventFilter(event);
}

return false;
}

Expand Down
13 changes: 13 additions & 0 deletions plotjuggler_app/plotwidget_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ PlotwidgetEditor::PlotwidgetEditor(PlotWidget *plotwidget, QWidget *parent) :
{
ui->radioPoints->setChecked(true);
}
else if( _plotwidget->curveStyle() == PlotWidgetBase::STICKS)
{
ui->radioSticks->setChecked(true);
}
else {
ui->radioBoth->setChecked(true);
}
Expand Down Expand Up @@ -282,6 +286,15 @@ void PlotwidgetEditor::on_radioBoth_toggled(bool checked)
}
}

void PlotwidgetEditor::on_radioSticks_toggled(bool checked)
{
if(checked)
{
_plotwidget->changeCurvesStyle( PlotWidgetBase::STICKS );
}
}


void PlotwidgetEditor::on_checkBoxMax_toggled(bool checked)
{
ui->lineLimitMax->setEnabled(checked);
Expand Down
2 changes: 2 additions & 0 deletions plotjuggler_app/plotwidget_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ private slots:

void on_lineLimitMax_textChanged(const QString &text);

void on_radioSticks_toggled(bool checked);

private:
Ui::PlotWidgetEditor *ui;

Expand Down
7 changes: 7 additions & 0 deletions plotjuggler_app/plotwidget_editor.ui
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,13 @@
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioSticks">
<property name="text">
<string>Sticks</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
12 changes: 9 additions & 3 deletions plotjuggler_app/resources/stylesheet_dark.qss
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ item_selection_background: #148CD2

QWidget {
background: transparent;
border: 0px solid ${border_default};
padding: 0px;
color: ${default_text};
font-size: 10pt;
}


QWidget:disabled{
color: ${disabled_text};
background: ${widget_background_disabled};
Expand Down Expand Up @@ -802,7 +800,10 @@ QSplitter#mainSplitter::handle:horizontal::hover {
stop:0.6 #cc00cc, stop:1.0 #1177ff);
}

QWidget#framePlotPreview{
QFrame#framePlotPreview,
QFrame#framePlotPreviewA,
QFrame#framePlotPreviewB,
QFrame#framePlotPreviewC {
background-color: ${widget_background};
border: 1px solid ${border_default};
margin: 0px;
Expand Down Expand Up @@ -832,6 +833,11 @@ QwtPlot {
border: 0px;
}

QWidget#qwtCanvas {
background: ${widget_background};
border: 0px;
}

QDialog#PlotWidgetEditor QListView::item:selected {
background-color: ${main_background};
}
Expand Down
14 changes: 11 additions & 3 deletions plotjuggler_app/resources/stylesheet_light.qss
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ item_selection_background: #62c5ff

QWidget {
background: transparent;
border: 0px solid ${border_default};
padding: 0px;
color: ${default_text};
font-size: 10pt;
font-size: 11pt;
}

QWidget:disabled{
Expand Down Expand Up @@ -812,12 +811,16 @@ QSplitter#mainSplitter::handle:horizontal::hover {
stop:0.6 #cc00cc, stop:1.0 #1177ff);
}

QWidget#framePlotPreview{
QFrame#framePlotPreview,
QFrame#framePlotPreviewA,
QFrame#framePlotPreviewB,
QFrame#framePlotPreviewC {
background-color: ${widget_background};
border: 1px solid ${border_default};
margin: 0px;
}


QWidget#formulaPage{
background-color: ${main_background};
}
Expand All @@ -842,6 +845,11 @@ QwtPlot {
border: 0px;
}

QWidget#qwtCanvas {
background: ${widget_background};
border: 0px;
}

QDialog#PlotWidgetEditor QListView::item:selected {
background-color: ${main_background};
}
Expand Down
4 changes: 3 additions & 1 deletion plotjuggler_base/include/PlotJuggler/plotwidget_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PlotWidgetBase: public QObject
LINES,
DOTS,
LINES_AND_DOTS,
HISTOGRAM
STICKS
};

struct CurveInfo
Expand Down Expand Up @@ -131,6 +131,8 @@ public slots:

void updateMaximumZoomArea();

bool eventFilter(QObject* obj, QEvent* event);

private:
bool _xy_mode;

Expand Down
41 changes: 40 additions & 1 deletion plotjuggler_base/src/plotwidget_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ PlotWidgetBase::PlotWidgetBase(QWidget *parent):
canvas->setPaintAttribute(QwtPlotCanvas::BackingStore, true);
abs_canvas = canvas;
}
abs_canvas->setObjectName("qwtCanvas");

p = new QwtPlotPimpl(this, abs_canvas, onViewResized, onEvent);

Expand Down Expand Up @@ -507,6 +508,44 @@ void PlotWidgetBase::setAcceptDrops(bool accept)
qwtPlot()->setAcceptDrops(accept);
}

bool PlotWidgetBase::eventFilter(QObject* obj, QEvent* event)
{
if( event->type() == QEvent::Destroy )
{
return false;
}

QwtScaleWidget* bottomAxis = qwtPlot()->axisWidget(QwtPlot::xBottom);
QwtScaleWidget* leftAxis = qwtPlot()->axisWidget(QwtPlot::yLeft);

if (magnifier() &&
(obj == bottomAxis || obj == leftAxis)
&& !(isXYPlot()
&& keepRatioXY()))
{
if (event->type() == QEvent::Wheel)
{
auto wheel_event = dynamic_cast<QWheelEvent*>(event);
if (obj == bottomAxis)
{
magnifier()->setDefaultMode(PlotMagnifier::X_AXIS);
}
else
{
magnifier()->setDefaultMode(PlotMagnifier::Y_AXIS);
}
magnifier()->widgetWheelEvent(wheel_event);
}
}
if (obj == qwtPlot()->canvas())
{
if (magnifier())
{
magnifier()->setDefaultMode(PlotMagnifier::BOTH_AXES);
}
}
return false;
}

QColor PlotWidgetBase::getColorHint(PlotData* data)
{
Expand Down Expand Up @@ -592,7 +631,7 @@ void PlotWidgetBase::setStyle( QwtPlotCurve* curve, CurveStyle style )
break;
case DOTS: curve->setStyle( QwtPlotCurve::Dots );
break;
case HISTOGRAM: curve->setStyle( QwtPlotCurve::Sticks );
case STICKS: curve->setStyle( QwtPlotCurve::Sticks );
}
}

Expand Down
Loading

0 comments on commit 13d546d

Please sign in to comment.