basic overlay for graph view
This commit is contained in:
@@ -248,6 +248,8 @@ add_files(
|
||||
utility/messaging/type/MessageGraphNodeExpand.h
|
||||
utility/messaging/type/MessageGraphNodeMove.h
|
||||
utility/messaging/type/MessageInterruptTasks.h
|
||||
utility/messaging/type/MessageLoadAfter.h
|
||||
utility/messaging/type/MessageLoadBefore.h
|
||||
utility/messaging/type/MessageLoadProject.h
|
||||
utility/messaging/type/MessageMoveIDECursor.h
|
||||
utility/messaging/type/MessageProjectEdit.h
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef MESSAGE_LOAD_AFTER_H
|
||||
#define MESSAGE_LOAD_AFTER_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageLoadAfter
|
||||
: public Message<MessageLoadAfter>
|
||||
{
|
||||
public:
|
||||
MessageLoadAfter()
|
||||
{
|
||||
setSendAsTask(false);
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageLoadAfter";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_LOAD_AFTER_H
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef MESSAGE_LOAD_BEFORE_H
|
||||
#define MESSAGE_LOAD_BEFORE_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageLoadBefore
|
||||
: public Message<MessageLoadBefore>
|
||||
{
|
||||
public:
|
||||
MessageLoadBefore()
|
||||
{
|
||||
setSendAsTask(false);
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageLoadBefore";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_LOAD_BEFORE_H
|
||||
@@ -102,6 +102,8 @@ add_files(
|
||||
qt/view/QtUndoRedoView.h
|
||||
qt/view/QtViewFactory.cpp
|
||||
qt/view/QtViewFactory.h
|
||||
qt/view/QtViewOverlay.cpp
|
||||
qt/view/QtViewOverlay.h
|
||||
qt/view/QtViewWidgetWrapper.cpp
|
||||
qt/view/QtViewWidgetWrapper.h
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
#include "qt/graphics/QtGraphicsView.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "qt/view/graphElements/nodeComponents/QtGraphNodeComponentClickable.h"
|
||||
#include "qt/view/graphElements/nodeComponents/QtGraphNodeComponentMoveable.h"
|
||||
#include "qt/view/graphElements/QtGraphEdge.h"
|
||||
@@ -27,6 +26,8 @@
|
||||
#include "qt/view/graphElements/QtGraphNodeBundle.h"
|
||||
#include "qt/view/graphElements/QtGraphNodeData.h"
|
||||
#include "qt/view/graphElements/QtGraphNodeExpandToggle.h"
|
||||
#include "qt/view/QtViewOverlay.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtGraphView::QtGraphView(ViewLayout* viewLayout)
|
||||
@@ -72,6 +73,8 @@ void QtGraphView::initView()
|
||||
|
||||
connect(view, SIGNAL(emptySpaceClicked()), this, SLOT(clickedInEmptySpace()));
|
||||
|
||||
m_overlay = new QtViewOverlay(widget);
|
||||
|
||||
doRefreshView();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ class QSequentialAnimationGroup;
|
||||
class QtGraphEdge;
|
||||
class QtGraphicsView;
|
||||
class QtGraphNode;
|
||||
class QtViewOverlay;
|
||||
|
||||
class QtGraphView
|
||||
: public QObject
|
||||
@@ -108,6 +109,8 @@ private:
|
||||
|
||||
std::shared_ptr<QSequentialAnimationGroup> m_transition;
|
||||
QPointF m_sceneRectOffset;
|
||||
|
||||
QtViewOverlay* m_overlay;
|
||||
};
|
||||
|
||||
#endif // QT_GRAPH_VIEW_H
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
#include "qt/view/QtViewOverlay.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QEvent>
|
||||
|
||||
ResizeFilter::ResizeFilter(QWidget* widget)
|
||||
: m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
bool ResizeFilter::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::Resize)
|
||||
{
|
||||
QWidget* parent = dynamic_cast<QWidget*>(obj);
|
||||
m_widget->setGeometry(0, 0, parent->width(), parent->height());
|
||||
}
|
||||
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
|
||||
QtViewOverlay::QtViewOverlay(QWidget* parent)
|
||||
: m_parent(parent)
|
||||
, m_beforeFunctor(std::bind(&QtViewOverlay::doBefore, this))
|
||||
, m_afterFunctor(std::bind(&QtViewOverlay::doAfter, this))
|
||||
{
|
||||
m_overlay = new QWidget(m_parent);
|
||||
m_parent->installEventFilter(new ResizeFilter(m_overlay));
|
||||
|
||||
std::string frameStyle =
|
||||
"#overlay {"
|
||||
"background: #55FF0000; "
|
||||
"}";
|
||||
m_overlay->setStyleSheet(frameStyle.c_str());
|
||||
m_overlay->setObjectName("overlay");
|
||||
m_overlay->hide();
|
||||
}
|
||||
|
||||
void QtViewOverlay::handleMessage(MessageLoadBefore* message)
|
||||
{
|
||||
m_beforeFunctor();
|
||||
}
|
||||
|
||||
void QtViewOverlay::handleMessage(MessageLoadAfter* message)
|
||||
{
|
||||
m_afterFunctor();
|
||||
}
|
||||
|
||||
void QtViewOverlay::doBefore()
|
||||
{
|
||||
m_overlay->show();
|
||||
}
|
||||
|
||||
void QtViewOverlay::doAfter()
|
||||
{
|
||||
m_overlay->hide();
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#ifndef QT_VIEW_OVERLAY
|
||||
#define QT_VIEW_OVERLAY
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageLoadBefore.h"
|
||||
#include "utility/messaging/type/MessageLoadAfter.h"
|
||||
|
||||
class QWidget;
|
||||
|
||||
class ResizeFilter
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
signals:
|
||||
void triggered();
|
||||
|
||||
public:
|
||||
ResizeFilter(QWidget* widget);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
|
||||
private:
|
||||
QWidget* m_widget;
|
||||
};
|
||||
|
||||
|
||||
class QtViewOverlay
|
||||
: public MessageListener<MessageLoadBefore>
|
||||
, public MessageListener<MessageLoadAfter>
|
||||
{
|
||||
public:
|
||||
QtViewOverlay(QWidget* parent = 0);
|
||||
|
||||
private:
|
||||
void handleMessage(MessageLoadBefore* message);
|
||||
void handleMessage(MessageLoadAfter* message);
|
||||
|
||||
void doBefore();
|
||||
void doAfter();
|
||||
|
||||
QWidget* m_parent;
|
||||
QWidget* m_overlay;
|
||||
|
||||
QtThreadedFunctor<void> m_beforeFunctor;
|
||||
QtThreadedFunctor<void> m_afterFunctor;
|
||||
};
|
||||
|
||||
#endif // QT_VIEW_OVERLAY
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
|
||||
#include "utility/messaging/type/MessageFind.h"
|
||||
#include "utility/messaging/type/MessageInterruptTasks.h"
|
||||
#include "utility/messaging/type/MessageLoadBefore.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
#include "utility/messaging/type/MessageRedo.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
@@ -370,6 +371,8 @@ void QtMainWindow::showStartScreen()
|
||||
|
||||
connect(startScreen, SIGNAL(openOpenProjectDialog()), this, SLOT(openProject()));
|
||||
connect(startScreen, SIGNAL(openNewProjectDialog()), this, SLOT(newProject()));
|
||||
|
||||
MessageLoadBefore().dispatch();
|
||||
}
|
||||
|
||||
void QtMainWindow::hideStartScreen()
|
||||
|
||||
Reference in New Issue
Block a user