2013-09-28 09:06:56 +00:00
|
|
|
#include "scenetool.hpp"
|
|
|
|
|
2014-09-07 11:35:30 +00:00
|
|
|
#include <QMouseEvent>
|
|
|
|
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <apps/opencs/view/widget/pushbutton.hpp>
|
|
|
|
|
2013-10-07 09:14:11 +00:00
|
|
|
#include "scenetoolbar.hpp"
|
|
|
|
|
2014-09-06 14:11:06 +00:00
|
|
|
CSVWidget::SceneTool::SceneTool(SceneToolbar* parent, Type type)
|
|
|
|
: PushButton(type, "", parent)
|
2013-09-28 09:06:56 +00:00
|
|
|
{
|
|
|
|
setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
2014-04-03 11:00:19 +00:00
|
|
|
setIconSize(QSize(parent->getIconSize(), parent->getIconSize()));
|
2013-10-07 09:14:11 +00:00
|
|
|
setFixedSize(parent->getButtonSize(), parent->getButtonSize());
|
2013-09-28 11:10:42 +00:00
|
|
|
|
2022-08-23 02:28:58 +00:00
|
|
|
connect(this, &SceneTool::clicked, this, &SceneTool::openRequest);
|
2013-09-28 11:10:42 +00:00
|
|
|
}
|
|
|
|
|
2014-09-07 11:35:30 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2014-07-08 10:39:12 +00:00
|
|
|
void CSVWidget::SceneTool::openRequest()
|
2013-09-28 11:10:42 +00:00
|
|
|
{
|
2014-09-07 11:35:30 +00:00
|
|
|
if (getType() == Type_TopAction)
|
|
|
|
activate();
|
|
|
|
else
|
|
|
|
showPanel(parentWidget()->mapToGlobal(pos()));
|
2013-09-28 11:10:42 +00:00
|
|
|
}
|