graphic in fullscreen now show all controls

This commit is contained in:
2023-08-21 11:21:32 +03:00
parent bf5718cc1d
commit 60ab744496
5 changed files with 403 additions and 385 deletions

View File

@@ -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
}