From 094c33227b5d074b87428624f83086fd3ca09173 Mon Sep 17 00:00:00 2001 From: peri4 Date: Wed, 9 Jun 2021 18:06:30 +0300 Subject: [PATCH] version 2.2.3 Graphic grid fix introspection actualize --- CMakeLists.txt | 2 +- libs/graphic/graphic.cpp | 12 ++--- utils/piconnedit/piconnedit_main.cpp | 66 ++++++++++++++-------------- utils/piintrospector/CMakeLists.txt | 48 ++++++++++---------- 4 files changed, 64 insertions(+), 64 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de68dad..b84b687 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default project(qad) set(qad_MAJOR 2) set(qad_MINOR 2) -set(qad_REVISION 2) +set(qad_REVISION 3) set(qad_SUFFIX ) set(qad_COMPANY SHS) set(qad_DOMAIN org.SHS) diff --git a/libs/graphic/graphic.cpp b/libs/graphic/graphic.cpp index c3e9e9d..7354e7f 100644 --- a/libs/graphic/graphic.cpp +++ b/libs/graphic/graphic.cpp @@ -1035,7 +1035,7 @@ void Graphic::drawAction() { void Graphic::drawGrid() { int gbx = gridborder.x(), gby = gridborder.y(), cwid = canvas->width(), chei = canvas->height(); double px, py, range, step, start; - int wid = cwid - gbx - 5, hei = chei - gby - 5, cx, cy, cnt; + int wid = cwid - gbx - 5, hei = chei - gby - 5, cx, cy, cnt, right = cwid + gbx; QRect rect; QPair str; @@ -1099,7 +1099,7 @@ void Graphic::drawGrid() { if (axis_type_x == Graphic::Numeric) { if (grad_x == Graphic::Auto) step = splitRange(range, wid / gridx / font_sz.width() * 1.4); else step = gridx; - start = roundTo(canvas2realX(wid), step) + step; + start = roundTo(canvas2realX(right), step); px = start + step; if (step > 0.) { cnt = 1000; @@ -1107,7 +1107,7 @@ void Graphic::drawGrid() { px -= step; if (fabs(px) < step * .5) px = 0.; cx = real2canvasX(px); - if (cx > cwid) continue; + if (cx > right) continue; if (cx < gbx) break; painter->setPen(grid_pen); painter->drawLine(cx, hei + 5, cx, 0); @@ -1126,7 +1126,7 @@ void Graphic::drawGrid() { } } cx = real2canvasX(0.); - if (cx <= cwid && cx >= gbx) { + if (cx <= right && cx >= gbx) { QPen _p(grid_pen); _p.setStyle(Qt::SolidLine); painter->setPen(_p); @@ -1135,7 +1135,7 @@ void Graphic::drawGrid() { } else { int cur_scl[7] = {0,0,0,0,0,0,0}; step = splitRangeDate(range, wid / gridx / font_sz.width() * 1.4, &df, cur_scl); - start = roundTo(canvas2realX(wid), step) + step; + start = roundTo(canvas2realX(right), step); px = start + step; QDateTime cd = QDateTime::fromMSecsSinceEpoch(px * grid_numbers_x); roundDateTime(cd, cur_scl); @@ -1145,7 +1145,7 @@ void Graphic::drawGrid() { while (cnt-- > 0) { addDateTime(cd, cur_scl, -1); cx = real2canvasX(cd.toMSecsSinceEpoch() / grid_numbers_x); - if (cx > cwid) continue; + if (cx > right) continue; if (cx < gbx) break; painter->setPen(grid_pen); painter->drawLine(cx, hei + 5, cx, 0); diff --git a/utils/piconnedit/piconnedit_main.cpp b/utils/piconnedit/piconnedit_main.cpp index 487a84a..56dccd1 100644 --- a/utils/piconnedit/piconnedit_main.cpp +++ b/utils/piconnedit/piconnedit_main.cpp @@ -1,33 +1,33 @@ -#include -#include "piqt_connection_edit.h" -#include -#include -#include -#include -#include - - -int main(int argc, char * argv[]) { - PIINTROSPECTION_START - QApplication a(argc, argv); - enableHighDPI(); - ConnectionEdit w; - if (a.arguments().size() > 1) { - QPIConfig cfg(a.arguments()[1]); - QByteArray model = cfg.getValue("connectionmodel").toByteArray(); - if (!model.isEmpty()) w.setModel(model); - } - if (w.exec() == QDialog::Accepted) { - QString c = QFileDialog::getSaveFileName(&w, "Save config to file", a.applicationDirPath(), "*.conf"); - if (!c.isEmpty()) { - QFile f(c); - if (f.open(QIODevice::WriteOnly)) { - QTextStream ts(&f); - ts << w.configuration(); - ts << "connectionmodel = " << QByteArray2QString(w.model()) << "\n"; - f.close(); - } - } - } - return 0; -} +#include +#include "piqt_connection_edit.h" +#include +#include +#include +#include +#include + + +int main(int argc, char * argv[]) { + PIINTROSPECTION_START(piconnedit) + QApplication a(argc, argv); + enableHighDPI(); + ConnectionEdit w; + if (a.arguments().size() > 1) { + QPIConfig cfg(a.arguments()[1]); + QByteArray model = cfg.getValue("connectionmodel").toByteArray(); + if (!model.isEmpty()) w.setModel(model); + } + if (w.exec() == QDialog::Accepted) { + QString c = QFileDialog::getSaveFileName(&w, "Save config to file", a.applicationDirPath(), "*.conf"); + if (!c.isEmpty()) { + QFile f(c); + if (f.open(QIODevice::WriteOnly)) { + QTextStream ts(&f); + ts << w.configuration(); + ts << "connectionmodel = " << QByteArray2QString(w.model()) << "\n"; + f.close(); + } + } + } + return 0; +} diff --git a/utils/piintrospector/CMakeLists.txt b/utils/piintrospector/CMakeLists.txt index 58b9296..ea5f171 100644 --- a/utils/piintrospector/CMakeLists.txt +++ b/utils/piintrospector/CMakeLists.txt @@ -1,24 +1,24 @@ -find_package(PIP) -if (PIP_FOUND AND BUILDING_pip) - - project(piintrospector) - if(APPLE) - set(APP_ICON "") - elseif(WIN32) - set(APP_ICON "") - else() - set(APP_ICON "") - endif() - set(APP_INFO "PIConnection GUI editor") - include(PIPMacros) - set(PII_ROOT "${pip_ROOT_SRC}/libs/main/introspection") - pip_code_model(CCM "${PII_ROOT}/piintrospection_server_p.h" "${PII_ROOT}/piintrospection_threads_p.h" OPTIONS "-DPIP_EXPORT" "-Es" ABSOLUTE) - qad_application(piintrospector "Gui;Widgets" "qad_utils;qad_widgets;qad_application;qad_piqt_utils" ${CCM}) - - foreach(_v ${_QT_VERSIONS_}) - if (LOCAL_FOUND${_v}) - add_dependencies(qad_piqt_utils${_v} pip_cmg) - endif() - endforeach() - -endif() +find_package(PIP) +if (PIP_FOUND AND BUILDING_pip) + + project(piintrospector) + if(APPLE) + set(APP_ICON "") + elseif(WIN32) + set(APP_ICON "") + else() + set(APP_ICON "") + endif() + set(APP_INFO "PIIntrospector") + include(PIPMacros) + set(PII_ROOT "${pip_ROOT_SRC}/libs/main/introspection") + pip_code_model(CCM "${PII_ROOT}/piintrospection_server_p.h" "${PII_ROOT}/piintrospection_threads_p.h" OPTIONS "-DPIP_EXPORT" "-Es" ABSOLUTE) + qad_application(piintrospector "Gui;Widgets" "qad_utils;qad_widgets;qad_application;qad_piqt_utils" ${CCM}) + + foreach(_v ${_QT_VERSIONS_}) + if (LOCAL_FOUND${_v}) + add_dependencies(qad_piqt_utils${_v} pip_cmg) + endif() + endforeach() + +endif()