reset button working for change dimension dialog
This commit is contained in:
parent
1163969d61
commit
bc15f1bb98
2 changed files with 11 additions and 4 deletions
|
@ -6,6 +6,7 @@
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsLineItem>
|
#include <QGraphicsLineItem>
|
||||||
#include <QGraphicsRectItem>
|
#include <QGraphicsRectItem>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
|
||||||
class ResizableRect;
|
class ResizableRect;
|
||||||
class Editor;
|
class Editor;
|
||||||
|
@ -90,6 +91,7 @@ protected:
|
||||||
private slots:
|
private slots:
|
||||||
void on_spinBox_width_valueChanged(int value);
|
void on_spinBox_width_valueChanged(int value);
|
||||||
void on_spinBox_height_valueChanged(int value);
|
void on_spinBox_height_valueChanged(int value);
|
||||||
|
void on_buttonBox_clicked(QAbstractButton *button);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *parent = nullptr;
|
QWidget *parent = nullptr;
|
||||||
|
|
|
@ -84,7 +84,6 @@ ResizeLayoutPopup::ResizeLayoutPopup(QWidget *parent, Editor *editor) :
|
||||||
this->setWindowModality(Qt::ApplicationModal);
|
this->setWindowModality(Qt::ApplicationModal);
|
||||||
|
|
||||||
this->scene = new CheckeredBgScene(this);
|
this->scene = new CheckeredBgScene(this);
|
||||||
//this->ui->graphicsView->setAlignment(Qt::AlignTop|Qt::AlignLeft);
|
|
||||||
this->ui->graphicsView->setScene(this->scene);
|
this->ui->graphicsView->setScene(this->scene);
|
||||||
this->ui->graphicsView->setRenderHints(QPainter::Antialiasing);
|
this->ui->graphicsView->setRenderHints(QPainter::Antialiasing);
|
||||||
this->ui->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
this->ui->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||||
|
@ -100,12 +99,18 @@ void ResizeLayoutPopup::resetPosition() {
|
||||||
this->setGeometry(QRect(parent->mapToGlobal(QPoint(0, 0)), parent->size()));
|
this->setGeometry(QRect(parent->mapToGlobal(QPoint(0, 0)), parent->size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResizeLayoutPopup::on_buttonBox_clicked(QAbstractButton *button) {
|
||||||
|
if(button == this->ui->buttonBox->button(QDialogButtonBox::Reset) ) {
|
||||||
|
this->scene->clear();
|
||||||
|
setupLayoutView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Custom scene contains
|
/// Custom scene contains
|
||||||
/// (1) pixmap representing the current layout / not resizable / drag-movable
|
/// (1) pixmap representing the current layout / not resizable / drag-movable
|
||||||
/// (1) layout outline / resizable / not movable
|
/// (1) layout outline / resizable / not movable
|
||||||
void ResizeLayoutPopup::setupLayoutView() {
|
void ResizeLayoutPopup::setupLayoutView() {
|
||||||
if (!this->editor || !this->editor->layout) return;
|
if (!this->editor || !this->editor->layout) return;
|
||||||
// TODO: this should be a more robust check probably
|
|
||||||
|
|
||||||
// Border stuff
|
// Border stuff
|
||||||
bool bordersEnabled = projectConfig.useCustomBorderSize;
|
bool bordersEnabled = projectConfig.useCustomBorderSize;
|
||||||
|
@ -153,9 +158,9 @@ void ResizeLayoutPopup::setupLayoutView() {
|
||||||
layoutPixmap->setBoundary(outline);
|
layoutPixmap->setBoundary(outline);
|
||||||
this->outline->rectUpdated(outline->rect().toAlignedRect());
|
this->outline->rectUpdated(outline->rect().toAlignedRect());
|
||||||
|
|
||||||
this->ui->graphicsView->scale(0.5, 0.5);
|
// TODO: is this an ideal size for all maps, or should this adjust based on starting dimensions?
|
||||||
|
this->ui->graphicsView->setTransform(QTransform::fromScale(0.5, 0.5));
|
||||||
this->ui->graphicsView->centerOn(layoutPixmap);
|
this->ui->graphicsView->centerOn(layoutPixmap);
|
||||||
// this->ui->graphicsView->fitInView(cover->rect(), Qt::KeepAspectRatio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResizeLayoutPopup::on_spinBox_width_valueChanged(int value) {
|
void ResizeLayoutPopup::on_spinBox_width_valueChanged(int value) {
|
||||||
|
|
Loading…
Reference in a new issue