1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-24 18:23:54 +00:00
openmw/apps/opencs/view/widget/scenetool.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

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"
CSVWidget::SceneTool::SceneTool(SceneToolbar* parent, Type type)
: PushButton(type, "", parent)
{
setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
2014-04-03 11:00:19 +00:00
setIconSize(QSize(parent->getIconSize(), parent->getIconSize()));
setFixedSize(parent->getButtonSize(), parent->getButtonSize());
connect(this, &SceneTool::clicked, this, &SceneTool::openRequest);
}
void CSVWidget::SceneTool::activate() {}
void CSVWidget::SceneTool::mouseReleaseEvent(QMouseEvent* event)
{
if (getType() == Type_TopAction && event->button() == Qt::RightButton)
showPanel(parentWidget()->mapToGlobal(pos()));
else
PushButton::mouseReleaseEvent(event);
}
void CSVWidget::SceneTool::openRequest()
{
if (getType() == Type_TopAction)
activate();
else
showPanel(parentWidget()->mapToGlobal(pos()));
}