ui tweak and minor bug fixes
This commit is contained in:
parent
e11ca3bba5
commit
ef3b942fec
|
@ -36,7 +36,9 @@ BottomButtonGroup::BottomButtonGroup(QWidget *parent)
|
|||
addButton(newBtn("zoom-original", [this]() {
|
||||
emit resetToOriginalBtnClicked();
|
||||
}));
|
||||
addButton(newBtn("view-fullscreen", [](){qDebug()<< "TODO: view-fullscreen";}));
|
||||
addButton(newBtn("view-fullscreen", [this]() {
|
||||
emit toggleWindowMaximum();
|
||||
}));
|
||||
addButton(newBtn("zoom-in", [this]() {
|
||||
emit zoomInBtnClicked();
|
||||
}));
|
||||
|
|
|
@ -14,6 +14,7 @@ public:
|
|||
|
||||
signals:
|
||||
void resetToOriginalBtnClicked();
|
||||
void toggleWindowMaximum();
|
||||
void zoomInBtnClicked();
|
||||
void zoomOutBtnClicked();
|
||||
void toggleCheckerboardBtnClicked();
|
||||
|
|
|
@ -193,6 +193,8 @@ void GraphicsView::resizeEvent(QResizeEvent *event)
|
|||
} else {
|
||||
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||
}
|
||||
} else {
|
||||
emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), m_rotateAngle);
|
||||
}
|
||||
return QGraphicsView::resizeEvent(event);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
this->setCentralWidget(m_graphicsView);
|
||||
|
||||
m_gv = new NavigatorView(this);
|
||||
m_gv->setFixedSize(250, 160);
|
||||
m_gv->setFixedSize(220, 160);
|
||||
m_gv->setScene(scene);
|
||||
m_gv->setMainView(m_graphicsView);
|
||||
m_gv->fitInView(m_gv->sceneRect(), Qt::KeepAspectRatio);
|
||||
|
@ -79,6 +79,14 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
|
||||
connect(m_bottomButtonGroup, &BottomButtonGroup::resetToOriginalBtnClicked,
|
||||
this, [ = ](){ m_graphicsView->resetScale(); });
|
||||
connect(m_bottomButtonGroup, &BottomButtonGroup::toggleWindowMaximum,
|
||||
this, [ = ](){
|
||||
if (isMaximized()) {
|
||||
showNormal();
|
||||
} else {
|
||||
showMaximized();
|
||||
}
|
||||
});
|
||||
connect(m_bottomButtonGroup, &BottomButtonGroup::zoomInBtnClicked,
|
||||
this, [ = ](){ m_graphicsView->zoomView(1.25); });
|
||||
connect(m_bottomButtonGroup, &BottomButtonGroup::zoomOutBtnClicked,
|
||||
|
|
|
@ -11,7 +11,7 @@ NavigatorView::NavigatorView(QWidget *parent)
|
|||
{
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setStyleSheet("background-color: rgba(0, 0, 0, 220);"
|
||||
setStyleSheet("background-color: rgba(0, 0, 0, 120);"
|
||||
"border-radius: 3px;");
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ void NavigatorView::mousePressEvent(QMouseEvent *event)
|
|||
|
||||
if (m_mainView) {
|
||||
m_mainView->centerOn(mapToScene(event->pos()));
|
||||
update();
|
||||
}
|
||||
|
||||
return QGraphicsView::mousePressEvent(event);
|
||||
|
@ -43,6 +44,7 @@ void NavigatorView::mouseMoveEvent(QMouseEvent *event)
|
|||
{
|
||||
if (m_mouseDown && m_mainView) {
|
||||
m_mainView->centerOn(mapToScene(event->pos()));
|
||||
update();
|
||||
}
|
||||
|
||||
return QGraphicsView::mouseMoveEvent(event);
|
||||
|
|
Loading…
Reference in New Issue
Block a user