forked from teamnwah/openmw-tes3coop
added right-click handling support to SceneTool class
This commit is contained in:
parent
f913d51e35
commit
4337d05126
6 changed files with 38 additions and 1 deletions
|
@ -91,4 +91,9 @@ bool CSVWidget::PushButton::hasKeepOpen() const
|
||||||
QString CSVWidget::PushButton::getBaseToolTip() const
|
QString CSVWidget::PushButton::getBaseToolTip() const
|
||||||
{
|
{
|
||||||
return mToolTip;
|
return mToolTip;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSVWidget::PushButton::Type CSVWidget::PushButton::getType() const
|
||||||
|
{
|
||||||
|
return mType;
|
||||||
}
|
}
|
|
@ -51,6 +51,8 @@ namespace CSVWidget
|
||||||
|
|
||||||
/// Return tooltip used at construction (without any button-specific modifications)
|
/// Return tooltip used at construction (without any button-specific modifications)
|
||||||
QString getBaseToolTip() const;
|
QString getBaseToolTip() const;
|
||||||
|
|
||||||
|
Type getType() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
#include "scenetool.hpp"
|
#include "scenetool.hpp"
|
||||||
|
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#include "scenetoolbar.hpp"
|
#include "scenetoolbar.hpp"
|
||||||
|
|
||||||
CSVWidget::SceneTool::SceneTool (SceneToolbar *parent, Type type)
|
CSVWidget::SceneTool::SceneTool (SceneToolbar *parent, Type type)
|
||||||
|
@ -13,7 +15,20 @@ CSVWidget::SceneTool::SceneTool (SceneToolbar *parent, Type type)
|
||||||
connect (this, SIGNAL (clicked()), this, SLOT (openRequest()));
|
connect (this, SIGNAL (clicked()), this, SLOT (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()
|
void CSVWidget::SceneTool::openRequest()
|
||||||
{
|
{
|
||||||
showPanel (parentWidget()->mapToGlobal (pos()));
|
if (getType()==Type_TopAction)
|
||||||
|
activate();
|
||||||
|
else
|
||||||
|
showPanel (parentWidget()->mapToGlobal (pos()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,14 @@ namespace CSVWidget
|
||||||
|
|
||||||
virtual void showPanel (const QPoint& position) = 0;
|
virtual void showPanel (const QPoint& position) = 0;
|
||||||
|
|
||||||
|
/// This function will only called for buttons of type Type_TopAction. The default
|
||||||
|
/// implementation is empty.
|
||||||
|
virtual void activate();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void mouseReleaseEvent (QMouseEvent *event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void openRequest();
|
void openRequest();
|
||||||
|
|
|
@ -29,6 +29,11 @@ CSVWidget::SceneToolRun::SceneToolRun (SceneToolbar *parent, const QString& tool
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWidget::SceneToolRun::showPanel (const QPoint& position)
|
void CSVWidget::SceneToolRun::showPanel (const QPoint& position)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWidget::SceneToolRun::activate()
|
||||||
{
|
{
|
||||||
if (mCurrentIndex!=-1)
|
if (mCurrentIndex!=-1)
|
||||||
emit runRequest (mProfiles[mCurrentIndex]);
|
emit runRequest (mProfiles[mCurrentIndex]);
|
||||||
|
|
|
@ -31,6 +31,8 @@ namespace CSVWidget
|
||||||
|
|
||||||
virtual void showPanel (const QPoint& position);
|
virtual void showPanel (const QPoint& position);
|
||||||
|
|
||||||
|
virtual void activate();
|
||||||
|
|
||||||
void removeProfile (const std::string& profile);
|
void removeProfile (const std::string& profile);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
Loading…
Reference in a new issue