Skip to content
Snippets Groups Projects
Commit dc145f24 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

format for CorrMaxPercent taken from tango db 'format'

parent 1ca1334f
No related branches found
No related tags found
......@@ -27,9 +27,6 @@ bool PlotObjFilter::eventFilter(QObject *obj, QEvent *event)
sli->setOrientation(Qt::Horizontal);
sli->setMinimumSize(QSize(250, 40));
sliw->setDefaultWidget(sli);
// slider value[1-300]. span = pow(10, value/100) --> span 0-1000
// slider with span 20 [-10; 10] --> setValue log10(20) * 100 = 130
sli->setMinimum(1);
sli->setMaximum(300);
sli->setValue(obj->property("yScale").isNull() ? 130 : obj->property("yScale").toInt()); // -10 - 10
......@@ -73,7 +70,6 @@ void CircularPlotMan::setup() {
o[TTT::Period] = 50;
watchers[i]->getContext()->setOptions(o);
connect(watchers[i], SIGNAL(newData(CuData)), this, SLOT(update(CuData)));
watchers[i + 2] = new QuWatcher(parent());
watchers[i + 2]->getContext()->setOptions(o);
number_drawables[i] = new NumberDrawable(circular_plots[i]);
......@@ -146,14 +142,14 @@ void CircularPlotMan::update(const CuData &da) {
NumberDrawable *dra = number_drawables[dra_i];
if(dra) {
QuCircularPlotCurve *c = idx == 0 ? plot->engine()->findCurve("hordata") : plot->engine()->findCurve("verdata");
const int& idx = c->selected(), &siz = m_corrnames.size();
const size_t& idx = c->selected(), &siz = m_corrnames.size();
bool right = idx > siz / 4 && idx < siz * 3 /4; // text drawn on the right side
if(c && idx < y.size() && idx < (int) m_corrnames.size()) {
char v[32];
if(c && idx < v.size() && idx < m_corrnames.size()) {
char vs[32];
const char *corr = m_corrnames[idx].c_str();
if(right) snprintf(v, 32, "%.1f ← %s", y[idx], corr);
else snprintf(v, 32, "%s → %.1f", corr, y[idx]);
dra->setText(v);
if(right) snprintf(vs, 32, "%.1f ← %s", v[idx], corr);
else snprintf(vs, 32, "%s → %.1f", corr, v[idx]);
dra->setText(vs);
}
}
}
......
......@@ -30,6 +30,14 @@
#define VERSION "2.0.0"
int main( int argc, char ** argv ) {
if(QT_VERSION < QT_VERSION_CHECK(6,0,0)) {
printf("setenv: QT_QPA_PLATFORMTHEME=qt5ct\n");
setenv("QT_QPA_PLATFORMTHEME", "qt5ct", 0);
}
else {
printf("setenv: QT_QPA_PLATFORMTHEME=qt6ct\n");
setenv("QT_QPA_PLATFORMTHEME", "qt6ct", 0);
}
CumbiaPool *p = new CumbiaPool();
CuControlsFactoryPool fpool;
QuApplication a( argc, argv, p, &fpool);
......@@ -42,6 +50,8 @@ int main( int argc, char ** argv ) {
}
Gof* mw = new Gof(0, argv[1], argv[2]);
if(argc > 1 && strcmp(argv[1] ,"sr/feedback/gof2_profile")==0)
mw->setWindowTitle("GOF (experimental)");
mw->show();
......
......@@ -5,7 +5,7 @@
#include <qupalette.h>
NumberDrawable::NumberDrawable(QObject *parent)
: QObject(parent), m_s("#") {}
: QObject(parent), m_s("#"), m_fmt("%.1f") {}
void NumberDrawable::setText(const std::string &t) {
m_s = t;
......@@ -26,7 +26,11 @@ std::string NumberDrawable::text() const {
void NumberDrawable::update(const CuData &da) {
const std::string& src = da.s(TTT::Src);
if(!da.B(TTT::Err)) {
m_s = da.s(TTT::Value);
if(da.s(TTT::Type) == "property") {
m_fmt = da.s(TTT::NumberFormat);
}
bool ok;
m_s = da[TTT::Value].toString(&ok, m_fmt.c_str());
} else {
m_s = "##";
}
......
......@@ -25,7 +25,7 @@ public:
int z() const;
void draw(QPainter *p, const QuCircularPlotEngine *plot_e, double inner_radius, double outer_radius, const QRectF &rect, QWidget *widget);
std::string m_s;
std::string m_s, m_fmt;
double m_w, m_h;
QPointF m_pos;
QFont m_font;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment