1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-14 06:40:40 +00:00
OpenMW/apps/opencs/view/widget/scenetool.cpp

34 lines
929 B
C++
Raw Normal View History

#include "scenetool.hpp"
#include <QMouseEvent>
#include "scenetoolbar.hpp"
2022-09-22 21:26:05 +03:00
CSVWidget::SceneTool::SceneTool(SceneToolbar* parent, Type type)
: PushButton(type, "", parent)
{
2022-09-22 21:26:05 +03:00
setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
setIconSize(QSize(parent->getIconSize(), parent->getIconSize()));
setFixedSize(parent->getButtonSize(), parent->getButtonSize());
2022-09-22 21:26:05 +03:00
connect(this, &SceneTool::clicked, this, &SceneTool::openRequest);
}
void CSVWidget::SceneTool::activate() {}
2022-09-22 21:26:05 +03:00
void CSVWidget::SceneTool::mouseReleaseEvent(QMouseEvent* event)
{
2022-09-22 21:26:05 +03:00
if (getType() == Type_TopAction && event->button() == Qt::RightButton)
showPanel(parentWidget()->mapToGlobal(pos()));
else
2022-09-22 21:26:05 +03:00
PushButton::mouseReleaseEvent(event);
}
void CSVWidget::SceneTool::openRequest()
{
2022-09-22 21:26:05 +03:00
if (getType() == Type_TopAction)
activate();
else
2022-09-22 21:26:05 +03:00
showPanel(parentWidget()->mapToGlobal(pos()));
}