graphic fixes

This commit is contained in:
2023-01-23 18:33:00 +03:00
parent 8bec648940
commit 98da491402
3 changed files with 15 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default
project(QAD)
set(QAD_MAJOR 2)
set(QAD_MINOR 14)
set(QAD_REVISION 0)
set(QAD_REVISION 1)
set(QAD_SUFFIX )
set(QAD_COMPANY SHS)
set(QAD_DOMAIN org.SHS)

View File

@@ -125,8 +125,7 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
agroup->addAction(ui->graphic_actionGuidesTrace);
ui->graphic_actionGuidesFree->setProperty("_value", (int)Free);
ui->graphic_actionGuidesTrace->setProperty("_value", (int)Trace);
ui->graphic_actionGuidesFree->setChecked(true);
connect(agroup, SIGNAL(triggered(QAction *)), this, SLOT(actionGuidesTriggered(QAction *)));
connect(agroup, &QActionGroup::triggered, this, &Graphic::actionGuidesTriggered);
ui->graphic_checkGuides->addAction(ui->graphic_actionGuidesFree);
ui->graphic_checkGuides->addAction(ui->graphic_actionGuidesTrace);
ui->graphic_buttonAutofit->addAction(ui->graphic_actionExpandX);
@@ -146,11 +145,11 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
line_x_max.setClearButtonVisible(true);
line_y_min.setClearButtonVisible(true);
line_y_max.setClearButtonVisible(true);
connect(&line_x_min, SIGNAL(valueChanged(double)), this, SLOT(lineXMinChanged(double)));
connect(&line_x_max, SIGNAL(valueChanged(double)), this, SLOT(lineXMaxChanged(double)));
connect(&line_y_min, SIGNAL(valueChanged(double)), this, SLOT(lineYMinChanged(double)));
connect(&line_y_max, SIGNAL(valueChanged(double)), this, SLOT(lineYMaxChanged(double)));
connect(ui->canvas_raster, SIGNAL(paintEvent(QPaintEvent *)), this, SLOT(canvasPaintEvent()));
connect(&line_x_min, &EvalSpinBox::valueChanged, this, &Graphic::lineXMinChanged);
connect(&line_x_max, &EvalSpinBox::valueChanged, this, &Graphic::lineXMaxChanged);
connect(&line_y_min, &EvalSpinBox::valueChanged, this, &Graphic::lineYMinChanged);
connect(&line_y_max, &EvalSpinBox::valueChanged, this, &Graphic::lineYMaxChanged);
connect(ui->canvas_raster, &UWidget::paintEvent, this, &Graphic::canvasPaintEvent);
prepareCanvas(ui->canvas_raster);
icon_exp_x = QIcon(":/icons/expand_x.png");
icon_exp_y = QIcon(":/icons/expand_y.png");
@@ -203,7 +202,7 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
updateLegend();
setRectToLines();
conf = new GraphicConf(graphics, this);
connect(conf, SIGNAL(exportClicked()), this, SLOT(on_graphic_actionExportCSV_triggered()));
connect(conf, &GraphicConf::exportClicked, this, &Graphic::on_graphic_actionExportCSV_triggered);
}
@@ -241,7 +240,7 @@ void Graphic::showEvent(QShowEvent *) {
// qDebug() << "create GL on show";
canvas_gl = new UGLWidget();
ui->layoutCanvas->addWidget(canvas_gl);
connect(canvas_gl, SIGNAL(paintSignal()), this, SLOT(canvasPaintEvent()));
connect(canvas_gl, &UGLWidget::paintSignal, this, &Graphic::canvasPaintEvent);
prepareCanvas(canvas_gl);
ui->canvas_raster->hide();
canvas_gl->show();
@@ -1209,7 +1208,7 @@ void Graphic::setOpenGL(bool on) {
// qDebug() << "create GL on setter";
canvas_gl = new UGLWidget();
ui->layoutCanvas->addWidget(canvas_gl);
connect(canvas_gl, SIGNAL(paintSignal()), this, SLOT(canvasPaintEvent()));
connect(canvas_gl, &UGLWidget::paintSignal, this, &Graphic::canvasPaintEvent);
prepareCanvas(canvas_gl);
}
}
@@ -2052,13 +2051,13 @@ QPolygonF Graphic::canvas2real(const QPolygonF & canvas_polygon) const {
double Graphic::getScaleX() const {
int gbx = gridborder.x() + margins_.left();
int wid = lastw - gbx - margins_.width();
return selrect.width() / (double)wid;
return (double)wid / selrect.width();
}
double Graphic::getScaleY() const {
int gby = gridborder.y() + margins_.top();
int hei = lasth - gby - margins_.height();
return selrect.height() / (double)hei;
return (double)hei / selrect.height();
}

View File

@@ -440,6 +440,9 @@
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Snap trace</string>
</property>