Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,221 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Interface-Implementation of LocationDisplay
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// Own
|
||||
#include <Map/pixel_based_textbox_handler.h>
|
||||
#include <GeometryModel/geometry_pixelTextBox.h>
|
||||
#include <Common/situation_map_logging.h>
|
||||
|
||||
// Qt
|
||||
#include <QTextEdit>
|
||||
#include <QPointer>
|
||||
#include <QSizeGrip>
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QGraphicsProxyWidget>
|
||||
#include <QVariant>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
namespace SituationMap
|
||||
{
|
||||
|
||||
class MapImpl;
|
||||
class TB_Data;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class TB_Data
|
||||
//-----------------------------------------------------------------------------
|
||||
class TB_Data : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
friend class PixelBasedTextBoxHandlerImpl;
|
||||
TB_Data();
|
||||
~TB_Data();
|
||||
|
||||
bool hasValidId() const;
|
||||
bool connectGeometryChanges();
|
||||
|
||||
public Q_SLOTS:
|
||||
void onGeometryChanged();
|
||||
|
||||
Q_SIGNALS:
|
||||
void geometryChanged(SituationMap::PBTB_ID pbtbId);
|
||||
void geometryChangedFinished(SituationMap::PBTB_ID pbtbId); // [GUEZE-2947] Undo,Redo fuer PixelBasedTextBoxen
|
||||
|
||||
public:
|
||||
PBTB_ID m_pbtbId;
|
||||
PixelTextBoxData m_ptbd;
|
||||
|
||||
struct TB_GUI_DATA
|
||||
{
|
||||
QPointer<QTextEdit> m_textEdit;
|
||||
QGraphicsRectItem *m_handle_or_proxyControl{nullptr};
|
||||
QGraphicsProxyWidget *m_proxy{nullptr};
|
||||
|
||||
void resetGui()
|
||||
{
|
||||
// ToDo: check
|
||||
// delete without removing from scene/view?
|
||||
|
||||
delete m_handle_or_proxyControl;
|
||||
m_handle_or_proxyControl = nullptr;
|
||||
|
||||
// since m_proxy has m_handle_or_proxyControl as parent...
|
||||
m_proxy = nullptr;
|
||||
|
||||
delete m_textEdit; // QPointer
|
||||
}
|
||||
|
||||
};
|
||||
TB_GUI_DATA m_guiData;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(TB_Data)
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class QTextEditWithDoubleClick
|
||||
//-----------------------------------------------------------------------------
|
||||
class QTextEditWithDoubleClick : public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using BaseClass = QTextEdit;
|
||||
QTextEditWithDoubleClick(QWidget *parent = nullptr)
|
||||
:BaseClass(parent)
|
||||
{}
|
||||
virtual ~QTextEditWithDoubleClick() = default;
|
||||
|
||||
Q_SIGNALS:
|
||||
void doubleClickEvent(PBTB_ID pbtbId);
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QMouseEvent *) override;
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class QGraphicsRectItemWithMoveEvent
|
||||
//-----------------------------------------------------------------------------
|
||||
class QGraphicsRectItemWithEvents : public QObject, public QGraphicsRectItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using BaseClass = QGraphicsRectItem;
|
||||
QGraphicsRectItemWithEvents(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = nullptr)
|
||||
: QObject(), BaseClass(x, y, w, h, parent)
|
||||
{}
|
||||
virtual ~QGraphicsRectItemWithEvents() = default;
|
||||
|
||||
void activatePositionChangedEvents();
|
||||
|
||||
Q_SIGNALS:
|
||||
void positionChangedEvent(PBTB_ID pbtbId);
|
||||
void positionChangedFinishedEvent(PBTB_ID pbtbId); // [GUEZE-2947] Undo,Redo fuer PixelBasedTextBoxen
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onTimeout();
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
|
||||
QTimer *m_qtimer{nullptr};
|
||||
bool m_isMoving{false};
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class QSizeGripWithEvent
|
||||
//-----------------------------------------------------------------------------
|
||||
// [GUEZE-2947] Undo,Redo fuer PixelBasedTextBoxen
|
||||
// class QSizeGripWithEvent is introduced:
|
||||
class QSizeGripWithEvent : public QSizeGrip
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using BaseClass = QSizeGrip;
|
||||
QSizeGripWithEvent(const PBTB_ID &pbtbId, QWidget *parent)
|
||||
: BaseClass(parent), m_pbtbId(pbtbId)
|
||||
{}
|
||||
virtual ~QSizeGripWithEvent() = default;
|
||||
|
||||
Q_SIGNALS:
|
||||
void geometryChangedFinishedEvent(SituationMap::PBTB_ID pbtbId); // [GUEZE-2947] Undo,Redo fuer PixelBasedTextBoxen
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent(QMouseEvent *) override;
|
||||
void mouseReleaseEvent(QMouseEvent *mouseEvent) override;
|
||||
|
||||
PBTB_ID m_pbtbId;
|
||||
bool m_isGeometryChanging{false};
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class PixelBasedTextBoxHandlerImpl
|
||||
//-----------------------------------------------------------------------------
|
||||
class SITUATIONMAP_EXPORT PixelBasedTextBoxHandlerImpl : public SituationMap::PixelBasedTextBoxHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
using BaseClass = SituationMap::PixelBasedTextBoxHandler;
|
||||
|
||||
public:
|
||||
|
||||
explicit PixelBasedTextBoxHandlerImpl(SituationMap::MapImpl *mapImpl);
|
||||
virtual ~PixelBasedTextBoxHandlerImpl();
|
||||
|
||||
PixelBasedTextBoxHandlerImpl(const PixelBasedTextBoxHandlerImpl &other) = delete;
|
||||
PixelBasedTextBoxHandlerImpl &operator=(PixelBasedTextBoxHandlerImpl &other) = delete;
|
||||
|
||||
// create/get
|
||||
QTextEdit *createTextBox(PBTB_ID &pbtbIdRef, const PixelTextBoxData &ptbd, bool enableGeometryModifications = true) override;
|
||||
QTextEdit *updateTextBox(const PBTB_ID &pbtbId, const PixelTextBoxData &ptbd) override;
|
||||
QTextEdit *getTextBox(const PBTB_ID &pbtbId) override;
|
||||
|
||||
|
||||
void removeSelection() override;
|
||||
bool setSelected(const PBTB_ID &pbtbId) override;
|
||||
|
||||
// get:
|
||||
QVector<PBTB_ID> getAllIdsOfParent(const PBTB_ID &pbtbId) const override;
|
||||
PixelTextBoxData getPixelTextBoxData(const PBTB_ID &pbtbId) const override;
|
||||
|
||||
// remove:
|
||||
bool removeTextBox(const PBTB_ID &pbtbId) override;
|
||||
bool removeAllTextBoxesOfParent(int parentId) override;
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
private:
|
||||
QSharedPointer<TB_Data> getCreateTbData(const PBTB_ID &pbtbId) const;
|
||||
QSharedPointer<TB_Data> getTbDataIfExists(const PBTB_ID &pbtbId) const;
|
||||
|
||||
private :
|
||||
LOGGER_T m_logger; ///< Interface of the Logging-Facility
|
||||
|
||||
class Private;
|
||||
/**
|
||||
* The private d->pointer to not break BC when changing internals of this class
|
||||
*/
|
||||
Private *d{nullptr};
|
||||
|
||||
};
|
||||
|
||||
} // namespace SituationMap
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Reference in new issue
Block a user