forked from mirror/openmw-tes3mp
Add context menu for orbit camera.
parent
4ef9981544
commit
6c471349f0
@ -0,0 +1,37 @@
|
||||
#include "orbitcameramode.hpp"
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
#include "worldspacewidget.hpp"
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
OrbitCameraMode::OrbitCameraMode(WorldspaceWidget* worldspaceWidget, const QIcon& icon, const QString& tooltip,
|
||||
QWidget* parent)
|
||||
: ModeButton(icon, tooltip, parent)
|
||||
, mWorldspaceWidget(worldspaceWidget)
|
||||
, mCenterOnSelection(0)
|
||||
{
|
||||
}
|
||||
|
||||
void OrbitCameraMode::activate(CSVWidget::SceneToolbar* toolbar)
|
||||
{
|
||||
mCenterOnSelection = new QAction("Center on selected object", this);
|
||||
connect(mCenterOnSelection, SIGNAL(triggered()), this, SLOT(centerSelection()));
|
||||
}
|
||||
|
||||
bool OrbitCameraMode::createContextMenu(QMenu* menu)
|
||||
{
|
||||
if (menu)
|
||||
{
|
||||
menu->addAction(mCenterOnSelection);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OrbitCameraMode::centerSelection()
|
||||
{
|
||||
mWorldspaceWidget->centerOrbitCameraOnSelection();
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
#ifndef CSV_RENDER_ORBITCAMERAPICKMODE_H
|
||||
#define CSV_RENDER_ORBITCAMERAPICKMODE_H
|
||||
|
||||
#include "../widget/modebutton.hpp"
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
class WorldspaceWidget;
|
||||
|
||||
class OrbitCameraMode : public CSVWidget::ModeButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
OrbitCameraMode(WorldspaceWidget* worldspaceWidget, const QIcon& icon, const QString& tooltip = "",
|
||||
QWidget* parent = 0);
|
||||
|
||||
virtual void activate(CSVWidget::SceneToolbar* toolbar);
|
||||
virtual bool createContextMenu(QMenu* menu);
|
||||
|
||||
private:
|
||||
|
||||
WorldspaceWidget* mWorldspaceWidget;
|
||||
QAction* mCenterOnSelection;
|
||||
|
||||
private slots:
|
||||
|
||||
void centerSelection();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue