ui: Added style for graph zoom buttons

* moved zoom buttons to QtGraphicsView due to stylesheet and repositioning on resize
This commit is contained in:
Eberhard Graether
2017-01-30 16:28:32 +01:00
parent 85be119e7f
commit 00cba732df
7 changed files with 87 additions and 54 deletions
+2 -39
View File
@@ -40,10 +40,6 @@ QtGraphView::QtGraphView(ViewLayout* viewLayout)
, m_refreshFunctor(std::bind(&QtGraphView::doRefreshView, this))
, m_focusInFunctor(std::bind(&QtGraphView::doFocusIn, this, std::placeholders::_1))
, m_focusOutFunctor(std::bind(&QtGraphView::doFocusOut, this, std::placeholders::_1))
, m_zoomInButton()
, m_zoomOutButton()
, m_zoomInButtonSpeed(20.0f)
, m_zoomOutButtonSpeed(-20.0f)
{
}
@@ -74,22 +70,6 @@ void QtGraphView::initView()
widget->layout()->addWidget(view);
m_zoomInButton = new QPushButton(widget);
m_zoomInButton->setObjectName("zoom_in_button");
m_zoomInButton->setText("+");
m_zoomInButton->setGeometry(QRect(5, 5, 25, 25));
m_zoomInButton->setAutoRepeat(true);
m_zoomInButton->setToolTip("Zoom in (Shift + Mousewheel forward)");
connect(m_zoomInButton, SIGNAL(pressed()), this, SLOT(zoomInPressed()));
m_zoomOutButton = new QPushButton(widget);
m_zoomOutButton->setObjectName("zoom_out_button");
m_zoomOutButton->setText("-");
m_zoomOutButton->setGeometry(QRect(5, 34, 25, 25));
m_zoomOutButton->setAutoRepeat(true);
m_zoomOutButton->setToolTip("Zoom out (Shift + Mousewheel back)");
connect(m_zoomOutButton, SIGNAL(pressed()), this, SLOT(zoomOutPressed()));
connect(view, SIGNAL(emptySpaceClicked()), this, SLOT(clickedInEmptySpace()));
m_scrollSpeedChangeListenerHorizontal.setScrollBar(view->horizontalScrollBar());
@@ -101,6 +81,8 @@ void QtGraphView::initView()
void QtGraphView::refreshView()
{
m_refreshFunctor();
getView()->refreshStyle();
}
void QtGraphView::rebuildGraph(
@@ -166,16 +148,6 @@ void QtGraphView::clickedInEmptySpace()
}
}
void QtGraphView::zoomInPressed()
{
zoom(m_zoomInButtonSpeed);
}
void QtGraphView::zoomOutPressed()
{
zoom(m_zoomOutButtonSpeed);
}
void QtGraphView::switchToNewGraphData()
{
m_oldGraph = m_graph;
@@ -752,12 +724,3 @@ void QtGraphView::doFocusOut(const std::vector<Id>& tokenIds)
}
}
}
void QtGraphView::zoom(const float delta)
{
QtGraphicsView* view = getView();
if (view != NULL)
{
view->updateZoom(delta);
}
}