Skip to content

Commit

Permalink
Use QToolButton for flat buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni committed Jun 6, 2019
1 parent ffd51df commit 81a8782
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
22 changes: 13 additions & 9 deletions src/app/3d/qgs3dnavigationwidget.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <QGridLayout>
#include <QPushButton>
#include <QToolButton>
#include <QDial>
#include <QObject>
#include <QDebug>
Expand All @@ -12,59 +12,63 @@
Qgs3DNavigationWidget::Qgs3DNavigationWidget(Qgs3DMapCanvas *parent) : QWidget(parent)
{
// Zoom in button
mZoomInButton = new QPushButton(this);
mZoomInButton = new QToolButton(this);
mZoomInButton->setToolTip(QStringLiteral("Zoom In"));
mZoomInButton->setAutoRepeat(true);
mZoomInButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomIn.svg" ) ) );
mZoomInButton->setAutoRaise(true);

QObject::connect(
mZoomInButton,
&QPushButton::clicked,
&QToolButton::clicked,
parent,
[ = ]{
parent->cameraController()->zoom(5);
}
);

// Zoom out button
mZoomOutButton = new QPushButton(this);
mZoomOutButton = new QToolButton(this);
mZoomOutButton->setToolTip(QStringLiteral("Zoom Out"));
mZoomOutButton->setAutoRepeat(true);
mZoomOutButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomOut.svg" ) ) );
mZoomOutButton->setAutoRaise(true);

QObject::connect(
mZoomOutButton,
&QPushButton::clicked,
&QToolButton::clicked,
parent,
[ = ]{
parent->cameraController()->zoom(-5);
}
);

// Tilt up button
mTiltUpButton = new QPushButton(this);
mTiltUpButton = new QToolButton(this);
mTiltUpButton->setToolTip(QStringLiteral("Tilt Up"));
mTiltUpButton->setAutoRepeat(true);
mTiltUpButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionArrowUp.svg" ) ) );
mTiltUpButton->setAutoRaise(true);

QObject::connect(
mTiltUpButton,
&QPushButton::clicked,
&QToolButton::clicked,
parent,
[ = ]{
parent->cameraController()->tiltUpAroundViewCenter(1);
}
);

// Tilt down button
mTiltDownButton = new QPushButton(this);
mTiltDownButton = new QToolButton(this);
mTiltDownButton->setToolTip(QStringLiteral("Tilt Down"));
mTiltDownButton->setAutoRepeat(true);
mTiltDownButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionArrowDown.svg" ) ) );
mTiltDownButton->setAutoRaise(true);

QObject::connect(
mTiltDownButton,
&QPushButton::clicked,
&QToolButton::clicked,
parent,
[ = ]{
parent->cameraController()->tiltUpAroundViewCenter(-1);
Expand Down
10 changes: 5 additions & 5 deletions src/app/3d/qgs3dnavigationwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#define QGS3DNAVIGATIONWIDGET_H

#include <QWidget>
#include <QPushButton>
#include <QDial>
#include <QGridLayout>
#include <QToolButton>

#include "qgs3dmapcanvas.h"
#include "qgscameracontroller.h"
Expand All @@ -36,10 +36,10 @@ class Qgs3DNavigationWidget : public QWidget
public slots:

private:
QPushButton *mZoomInButton = nullptr;
QPushButton *mZoomOutButton = nullptr;
QPushButton *mTiltUpButton = nullptr;
QPushButton *mTiltDownButton = nullptr;
QToolButton *mZoomInButton = nullptr;
QToolButton *mZoomOutButton = nullptr;
QToolButton *mTiltUpButton = nullptr;
QToolButton *mTiltDownButton = nullptr;
QDial *mRotateSceneDial = nullptr;
};

Expand Down

0 comments on commit 81a8782

Please sign in to comment.