From 60ab744496b48758c043ae8ff06264b8cbc61022 Mon Sep 17 00:00:00 2001 From: peri4 Date: Mon, 21 Aug 2023 11:21:32 +0300 Subject: [PATCH] graphic in fullscreen now show all controls --- CMakeLists.txt | 2 +- libs/graphic/graphic.cpp | 30 +- libs/graphic/graphic.h | 1 - libs/graphic/graphic.ui | 751 +++++++++--------- .../graphic_analysis_stat.cpp | 4 + 5 files changed, 403 insertions(+), 385 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51ef492..22dd7b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default project(QAD) set(QAD_MAJOR 2) -set(QAD_MINOR 18) +set(QAD_MINOR 19) set(QAD_REVISION 0) set(QAD_SUFFIX ) set(QAD_COMPANY SHS) diff --git a/libs/graphic/graphic.cpp b/libs/graphic/graphic.cpp index b059f03..8e00dba 100644 --- a/libs/graphic/graphic.cpp +++ b/libs/graphic/graphic.cpp @@ -147,6 +147,7 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this), 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->actionLeaveFullscreen, &QAction::triggered, this, &Graphic::leaveFullscreen); connect(ui->canvas_raster, &UWidget::paintEvent, this, &Graphic::canvasPaintEvent); prepareCanvas(ui->canvas_raster); icon_exp_x = QIcon(":/icons/expand_x.png"); @@ -197,6 +198,7 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this), setBorderInputsVisible(false); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ui->layoutButtons->update(); + ui->widgetTop->addAction(ui->actionLeaveFullscreen); updateLegend(); setRectToLines(); conf = new GraphicConf(graphics, this); @@ -314,7 +316,6 @@ void Graphic::prepareCanvas(QWidget * w) { connect(w, SIGNAL(mouseDoubleClickEvent(QMouseEvent *)), this, SLOT(canvasMouseDoubleClickEvent(QMouseEvent *))); connect(w, SIGNAL(wheelEvent(QWheelEvent *)), this, SLOT(canvasWheelEvent(QWheelEvent *))); connect(w, SIGNAL(leaveEvent(QEvent *)), this, SLOT(canvasLeaveEvent(QEvent *))); - connect(w, SIGNAL(keyPressEvent(QKeyEvent *)), this, SLOT(canvasKeyPressEvent(QKeyEvent *))); w->grabGesture(Qt::TapAndHoldGesture); w->grabGesture(Qt::PanGesture); w->grabGesture(Qt::PinchGesture); @@ -666,15 +667,6 @@ void Graphic::canvasLeaveEvent(QEvent *) { isHover = false; if (guides) repaintCanvas(true); if (ui->status->isVisible()) ui->status->setText(tr("Cursor") + ": ( ; )"); - leaveFullscreen(); -} - - -void Graphic::canvasKeyPressEvent(QKeyEvent * e) { - switch (e->key()) { - case Qt::Key_Escape: leaveFullscreen(); - default: break; - }; } @@ -2558,11 +2550,12 @@ void Graphic::enterFullscreen() { leaveFullscreen(); return; #else - ui->layoutCanvas->removeWidget(canvas); - canvas->setParent(0); - canvas->showFullScreen(); - canvas->setFocus(); - canvas->raise(); + layout()->removeWidget(ui->widgetTop); + ui->widgetTop->setParent(0); + ui->widgetTop->showFullScreen(); + ui->widgetTop->setFocus(); + ui->widgetTop->raise(); + canvas->show(); #endif } @@ -2573,12 +2566,15 @@ void Graphic::leaveFullscreen() { #endif if (!fullscr) return; fullscr = false; -#ifndef Q_OS_ANDROID +#ifdef Q_OS_ANDROID canvas->showNormal(); canvas->hide(); -#endif ui->layoutCanvas->addWidget(canvas); canvas->show(); +#else + layout()->addWidget(ui->widgetTop); + canvas->show(); +#endif } diff --git a/libs/graphic/graphic.h b/libs/graphic/graphic.h index b3bdd7e..1efacb8 100644 --- a/libs/graphic/graphic.h +++ b/libs/graphic/graphic.h @@ -485,7 +485,6 @@ protected slots: void canvasMouseDoubleClickEvent(QMouseEvent *); void canvasWheelEvent(QWheelEvent *); void canvasLeaveEvent(QEvent *); - void canvasKeyPressEvent(QKeyEvent *); void graphicVisibleChange(bool checked); void graphicAllVisibleChange(bool checked); void lineXMinChanged(double value); diff --git a/libs/graphic/graphic.ui b/libs/graphic/graphic.ui index 3d092e6..cb3fab8 100644 --- a/libs/graphic/graphic.ui +++ b/libs/graphic/graphic.ui @@ -6,8 +6,8 @@ 0 0 - 575 - 440 + 626 + 490 @@ -17,9 +17,6 @@ - - 0 - 0 @@ -33,387 +30,401 @@ 0 - - - 2 - - - - - - - -10 - 0 - 35 - 420 - + + + + 0 + + + 0 + + + 0 + + + 0 + + + 2 + + + + + Qt::RichText + + + Qt::AlignCenter - - - 2 - - - - - Autofit - - - - :/icons/view-autofit.png:/icons/view-autofit.png - - - - - - - Cursor axis - - - - :/icons/edit-guides.png:/icons/edit-guides.png - - - true - - - - - - - Fullscreen - - - - :/icons/view-fullscreen.png:/icons/view-fullscreen.png - - - - - - - Border inputs - - - - :/icons/border-line.png:/icons/border-line.png - - - true - - - - - - - Legend - - - - :/icons/legend.png:/icons/legend.png - - - true - - - false - - - - - - - Pause - - - - :/icons/media-playback-pause.png:/icons/media-playback-pause.png - - - true - - - - - - - Configure ... - - - - :/icons/configure.png:/icons/configure.png - - - - - - - Save image ... - - - - :/icons/document-save.png:/icons/document-save.png - - - QToolButton::InstantPopup - - - - - - - Record graphic - - - - :/icons/media-record.png:/icons/media-record.png - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 0 - 30 - - - - - - - - Clear - - - - :/icons/edit-clear.png:/icons/edit-clear.png - - - - - - - Close - - - - :/icons/dialog-close.png:/icons/dialog-close.png - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - Qt::RichText - - - Qt::AlignCenter - - - - - - - - - - - 0 - 0 - - - - QFrame::Box - - - QFrame::Sunken - - - - 0 + + + + + + + + + 0 + 0 + - - 0 + + QFrame::Box - - 0 + + QFrame::Sunken - - 0 - - - - - - 0 - 0 - - - + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 - - 2 - - - 2 - - - 2 - - - 2 - - - - Qt::Horizontal + + + true - - - 40 - 20 - - - + - - - - + + + + + + 0 + 0 + + + + + 0 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 1 + + + 1 + + + 1 + + + 1 + + + 4 + + + 2 + + + + + + + + + + + Cursor: ( ; ) + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + -10 + 0 + 35 + 420 + + + - 0 + 2 - - + + + Autofit + + + + :/icons/view-autofit.png:/icons/view-autofit.png + + + + + + + Cursor axis + + + + :/icons/edit-guides.png:/icons/edit-guides.png + + true + + + + Fullscreen + + + + :/icons/view-fullscreen.png:/icons/view-fullscreen.png + + + + + + + Border inputs + + + + :/icons/border-line.png:/icons/border-line.png + + + true + + + + + + + Legend + + + + :/icons/legend.png:/icons/legend.png + + + true + + + false + + + + + + + Pause + + + + :/icons/media-playback-pause.png:/icons/media-playback-pause.png + + + true + + + + + + + Configure ... + + + + :/icons/configure.png:/icons/configure.png + + + + + + + Save image ... + + + + :/icons/document-save.png:/icons/document-save.png + + + QToolButton::InstantPopup + + + + + + + Record graphic + + + + :/icons/media-record.png:/icons/media-record.png + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 0 + 30 + + + + + + + + Clear + + + + :/icons/edit-clear.png:/icons/edit-clear.png + + + + + + + Close + + + + :/icons/dialog-close.png:/icons/dialog-close.png + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + - - - - - - 0 - 0 - - - - - 0 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - 1 - - - 1 - - - 1 - - - 1 - - - 4 - - - 2 - - - - - - - - - - - Cursor: ( ; ) - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - + + + + + @@ -487,6 +498,14 @@ Export to CSV current view + + + Leave fullscreen + + + Esc + + diff --git a/libs/graphic_analysis/graphic_analysis_stat.cpp b/libs/graphic_analysis/graphic_analysis_stat.cpp index b7d6948..1382489 100644 --- a/libs/graphic_analysis/graphic_analysis_stat.cpp +++ b/libs/graphic_analysis/graphic_analysis_stat.cpp @@ -4,11 +4,15 @@ #include "ui_graphic_analysis_stat.h" #include +#include GraphicAnalysisStatistics::GraphicAnalysisStatistics(QWidget * parent): QDialog(parent) { ui = new Ui::GraphicAnalysisStatistics(); ui->setupUi(this); + int fh = qMax(fontMetrics().height(), 22); + QSize sz(fh * 2.5, fh); + ui->comboGraphic->setIconSize(sz); }