1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 20:45:34 +00:00
openmw/apps/opencs/view/widget/scenetool.cpp

36 lines
980 B
C++
Raw Normal View History

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