11#include "MosaicSceneWidget.h"
18 p_primaryAction = NULL;
19 p_toolBarAction = NULL;
22 connect(
this, SIGNAL(activated(
bool)),
this, SLOT(updateTool()));
25 connect(scene, SIGNAL(mouseEnter()),
this, SLOT(mouseEnter()));
26 connect(scene, SIGNAL(mouseLeave()),
this, SLOT(mouseLeave()));
27 connect(scene, SIGNAL(mouseMove(QPointF)),
this, SLOT(mouseMove(QPointF)));
29 connect(scene, SIGNAL(mouseDoubleClick(QPointF)),
30 this, SLOT(mouseDoubleClick(QPointF)));
31 connect(scene, SIGNAL(mouseButtonPress(QPointF, Qt::MouseButton)),
32 this, SLOT(mouseButtonPress(QPointF, Qt::MouseButton)));
33 connect(scene, SIGNAL(mouseButtonRelease(QPointF, Qt::MouseButton)),
34 this, SLOT(mouseButtonRelease(QPointF, Qt::MouseButton)));
35 connect(scene, SIGNAL(mouseWheel(QPointF,
int)),
36 this, SLOT(mouseWheel(QPointF,
int)));
37 connect(scene, SIGNAL(rubberBandComplete(QRectF, Qt::MouseButton)),
38 this, SLOT(rubberBandComplete(QRectF, Qt::MouseButton)));
43 MosaicTool::~MosaicTool() {
46 delete p_toolBarAction;
52 void MosaicTool::addTo(ToolPad *toolPad) {
53 if(!p_primaryAction) {
54 p_primaryAction = getPrimaryAction();
57 p_primaryAction->setCheckable(
true);
58 p_primaryAction->setChecked(p_active);
63 connect(p_primaryAction, SIGNAL(toggled(
bool)),
64 this, SLOT(activate(
bool)));
65 toolPad->addAction(p_primaryAction);
70 void MosaicTool::addTo(
QToolBar *toolBar) {
73 toolBarWidget = getToolBarWidget();
76 p_toolBarAction = toolBar->addWidget(toolBarWidget);
77 connect(p_toolBarAction, SIGNAL(destroyed(
QObject *)),
78 this, SLOT(toolBarDestroyed(
QObject *)));
89 PvlObject MosaicTool::toPvl()
const {
90 if(projectPvlObjectName() ==
"") {
91 PvlObject obj(
"Invalid");
95 throw IException(IException::Programmer,
96 "Please re-implement toPvl in your tool",
101 void MosaicTool::fromPvl(
const PvlObject &obj) {
102 if(projectPvlObjectName() !=
"") {
103 throw IException(IException::Programmer,
104 "Please re-implement fromPvl in your tool",
110 QString MosaicTool::projectPvlObjectName()
const {
117 QString fullPathToFile = QString(path +
"/" + iconName);
118 return QPixmap(fullPathToFile);
122 void MosaicTool::mouseMove(QPointF) {
126 void MosaicTool::mouseDoubleClick(QPointF) {
130 void MosaicTool::mouseButtonPress(QPointF, Qt::MouseButton s) {
134 void MosaicTool::mouseButtonRelease(QPointF, Qt::MouseButton s) {
139 void MosaicTool::mouseWheel(QPointF,
int) {
149 bool activeStateChanged = (
p_active != on);
160 if(activeStateChanged)
165 void MosaicTool::toolBarDestroyed(
QObject *) {
166 p_toolBarAction = NULL;
175 if(p_toolBarAction) {
176 p_toolBarAction->setVisible(
false);
186 if(p_toolBarAction) {
187 p_toolBarAction->setVisible(
true);
File name manipulation and expansion.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.