logic: fixes all over the place
* fixed refreshing to send another ui refresh message after parsing * keepContent field for MessageBase so that views won't update * fixed searchmatching to only weigh uppercase letters next to lowercase ones * fixed file not jumping back to snippets when activating edge * clicking into empty space deselects active edge * clear file manager files on every fetch * added db transaction for file clearing * use zooming instead of changing font size
This commit is contained in:
@@ -223,11 +223,21 @@ QWidget* QtCodeFile::findFirstActiveSnippet() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
if (m_maximizeButton->isEnabled())
|
||||
{
|
||||
if (snippet->isActive())
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
{
|
||||
return snippet.get();
|
||||
if (snippet->isActive())
|
||||
{
|
||||
return snippet.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_fileSnippet->isActive())
|
||||
{
|
||||
return m_fileSnippet.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QBoxLayout>
|
||||
#include <QFrame>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
#include <QMouseEvent>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QParallelAnimationGroup>
|
||||
#include <QScrollBar>
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "component/controller/helper/DummyEdge.h"
|
||||
#include "component/controller/helper/DummyNode.h"
|
||||
#include "component/controller/helper/GraphPostprocessor.h"
|
||||
#include "component/view/GraphViewStyle.h"
|
||||
#include "utility/messaging/type/MessageDeactivateEdge.h"
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
@@ -25,6 +27,32 @@
|
||||
#include "qt/view/graphElements/QtGraphNodeExpandToggle.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtGraphicsView::QtGraphicsView(QWidget* parent)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void QtGraphicsView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && !itemAt(event->pos()))
|
||||
{
|
||||
m_last = event->pos();
|
||||
}
|
||||
|
||||
QGraphicsView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void QtGraphicsView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && !itemAt(event->pos()) && event->pos() == m_last)
|
||||
{
|
||||
emit emptySpaceClicked();
|
||||
}
|
||||
|
||||
QGraphicsView::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
||||
QtGraphView::QtGraphView(ViewLayout* viewLayout)
|
||||
: GraphView(viewLayout)
|
||||
, m_rebuildGraphFunctor(
|
||||
@@ -56,13 +84,15 @@ void QtGraphView::initView()
|
||||
widget->setLayout(layout);
|
||||
|
||||
QGraphicsScene* scene = new QGraphicsScene(widget);
|
||||
QGraphicsView* view = new QGraphicsView(widget);
|
||||
QGraphicsView* view = new QtGraphicsView(widget);
|
||||
view->setScene(scene);
|
||||
view->setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
view->setRenderHints(QPainter::Antialiasing);
|
||||
|
||||
widget->layout()->addWidget(view);
|
||||
|
||||
connect(view, SIGNAL(emptySpaceClicked()), this, SLOT(clickedInEmptySpace()));
|
||||
|
||||
doRefreshView();
|
||||
}
|
||||
|
||||
@@ -114,6 +144,23 @@ void QtGraphView::finishedTransition()
|
||||
switchToNewGraphData();
|
||||
}
|
||||
|
||||
void QtGraphView::clickedInEmptySpace()
|
||||
{
|
||||
size_t activeEdgeCount = 0;
|
||||
for (std::shared_ptr<QtGraphEdge> edge : m_oldEdges)
|
||||
{
|
||||
if (edge->getIsActive())
|
||||
{
|
||||
activeEdgeCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (activeEdgeCount == 1)
|
||||
{
|
||||
MessageDeactivateEdge().dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void QtGraphView::switchToNewGraphData()
|
||||
{
|
||||
m_oldGraph = m_graph;
|
||||
@@ -239,6 +286,9 @@ void QtGraphView::doRefreshView()
|
||||
|
||||
std::string css = utility::getStyleSheet("data/gui/graph_view/graph_view.css");
|
||||
getView()->setStyleSheet(css.c_str());
|
||||
|
||||
float zoomFactor = GraphViewStyle::getZoomFactor();
|
||||
getView()->setTransform(QTransform(zoomFactor, 0, 0, zoomFactor, 0, 0));
|
||||
}
|
||||
|
||||
std::shared_ptr<QtGraphNode> QtGraphView::findNodeRecursive(const std::list<std::shared_ptr<QtGraphNode>>& nodes, Id tokenId)
|
||||
|
||||
@@ -1,21 +1,38 @@
|
||||
#ifndef QT_GRAPH_VIEW_H
|
||||
#define QT_GRAPH_VIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QPointF>
|
||||
|
||||
#include "utility/types.h"
|
||||
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
|
||||
#include "component/view/GraphView.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
struct DummyEdge;
|
||||
struct DummyNode;
|
||||
class QGraphicsView;
|
||||
class QMouseEvent;
|
||||
class QSequentialAnimationGroup;
|
||||
class QtGraphEdge;
|
||||
class QtGraphNode;
|
||||
|
||||
class QtGraphicsView
|
||||
: public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtGraphicsView(QWidget* parent);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
signals:
|
||||
void emptySpaceClicked();
|
||||
|
||||
private:
|
||||
QPoint m_last;
|
||||
};
|
||||
|
||||
|
||||
class QtGraphView
|
||||
: public QObject
|
||||
, public GraphView
|
||||
@@ -44,6 +61,7 @@ public:
|
||||
private slots:
|
||||
void centerScrollBars();
|
||||
void finishedTransition();
|
||||
void clickedInEmptySpace();
|
||||
|
||||
private:
|
||||
void switchToNewGraphData();
|
||||
|
||||
@@ -70,7 +70,7 @@ void QtGraphNodeExpandToggle::updateStyle()
|
||||
|
||||
m_icon->setPos(
|
||||
(m_rect->rect().width() - m_icon->pixmap().width() / QtDeviceScaledPixmap::devicePixelRatio()) / 2,
|
||||
(m_invisibleSubNodeCount == 0 ? m_rect->rect().height() / 2 - 2 : m_rect->rect().height() - 8)
|
||||
(m_invisibleSubNodeCount == 0 ? m_rect->rect().height() / 2 - 2 : m_rect->rect().height() - 7)
|
||||
);
|
||||
|
||||
m_icon->setPixmap(utility::colorizePixmap(m_icon->pixmap(), style.iconColor.c_str()));
|
||||
|
||||
Reference in New Issue
Block a user