Fix zoom fit best current after adding new pattern piece.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-09-25 18:28:58 +03:00
parent 6bd1a460e6
commit e1075dfdf5
2 changed files with 20 additions and 2 deletions

View file

@ -294,7 +294,8 @@ void MainWindow::AddPP(const QString &PPName)
// Show best for new PP
VMainGraphicsView::NewSceneRect(ui->view->scene(), ui->view);
ZoomFitBestCurrent();
//ZoomFitBestCurrent();
QApplication::postEvent(this, new FitBestCurrentEvent());
ui->actionNewDraw->setEnabled(true);
helpLabel->setText("");
@ -1446,6 +1447,10 @@ void MainWindow::customEvent(QEvent *event)
{
qApp->getUndoStack()->undo();
}
else if (event->type() == FIT_BEST_CURRENT_EVENT)
{
ZoomFitBestCurrent();
}
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -32,7 +32,7 @@
#include <qcompilerdetection.h>
#include <QEvent>
enum CustomEventType { UndoEventType = 1, LiteParseEventType = 2 };
enum CustomEventType { UndoEventType = 1, LiteParseEventType = 2, FitBestCurrentEventType = 3 };
// Define undo event identifier
const QEvent::Type UNDO_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::UndoEventType);
@ -59,4 +59,17 @@ public:
virtual ~LiteParseEvent() =default;
};
const QEvent::Type FIT_BEST_CURRENT_EVENT = static_cast<QEvent::Type>(QEvent::User +
CustomEventType::FitBestCurrentEventType);
class FitBestCurrentEvent : public QEvent
{
public:
FitBestCurrentEvent()
: QEvent(FIT_BEST_CURRENT_EVENT)
{}
virtual ~FitBestCurrentEvent() =default;
};
#endif // CUSTOMEVENTS_H