node socket UI implemented
This commit is contained in:
@@ -71,8 +71,6 @@ void VecInput::SetFrameRate(const double &rate)
|
||||
|
||||
void VecInput::SetSingleValueMode(bool on)
|
||||
{
|
||||
qDebug() << "i'm here";
|
||||
|
||||
single_value_mode_ = on;
|
||||
|
||||
// Disable all fields except the first
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "nodeimageoutput.h"
|
||||
|
||||
NodeImageOutput::NodeImageOutput()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef NODEIMAGEOUTPUT_H
|
||||
#define NODEIMAGEOUTPUT_H
|
||||
|
||||
|
||||
class NodeImageOutput
|
||||
{
|
||||
public:
|
||||
NodeImageOutput();
|
||||
};
|
||||
|
||||
#endif // NODEIMAGEOUTPUT_H
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef MEDIANODE_H
|
||||
#define MEDIANODE_H
|
||||
|
||||
class MediaNode
|
||||
class NodeMedia
|
||||
{
|
||||
public:
|
||||
MediaNode();
|
||||
NodeMedia();
|
||||
};
|
||||
|
||||
#endif // MEDIANODE_H
|
||||
@@ -189,7 +189,6 @@ SOURCES += \
|
||||
ui/waveform.cpp \
|
||||
panels/nodeeditor.cpp \
|
||||
ui/nodeview.cpp \
|
||||
nodes/medianode.cpp \
|
||||
ui/nodeui.cpp \
|
||||
panels/effectspanel.cpp \
|
||||
nodes/nodedatatypes.cpp \
|
||||
@@ -203,7 +202,9 @@ SOURCES += \
|
||||
nodes/widgets/labelwidget.cpp \
|
||||
nodes/inputs/fileinput.cpp \
|
||||
nodes/widgets/buttonwidget.cpp \
|
||||
nodes/nodegraph.cpp
|
||||
nodes/nodegraph.cpp \
|
||||
nodes/nodemedia.cpp \
|
||||
nodes/nodeimageoutput.cpp
|
||||
|
||||
HEADERS += \
|
||||
ui/mainwindow.h \
|
||||
@@ -347,7 +348,6 @@ HEADERS += \
|
||||
ui/waveform.h \
|
||||
panels/nodeeditor.h \
|
||||
ui/nodeview.h \
|
||||
nodes/medianode.h \
|
||||
ui/nodeui.h \
|
||||
panels/effectspanel.h \
|
||||
nodes/nodedatatypes.h \
|
||||
@@ -362,7 +362,9 @@ HEADERS += \
|
||||
nodes/widgets/labelwidget.h \
|
||||
nodes/inputs/fileinput.h \
|
||||
nodes/widgets/buttonwidget.h \
|
||||
nodes/nodegraph.h
|
||||
nodes/nodegraph.h \
|
||||
nodes/nodemedia.h \
|
||||
nodes/nodeimageoutput.h
|
||||
|
||||
FORMS +=
|
||||
|
||||
|
||||
+51
-10
@@ -8,6 +8,7 @@
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsProxyWidget>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QPainter>
|
||||
|
||||
#include "ui/effectui.h"
|
||||
@@ -67,17 +68,13 @@ void NodeUI::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
|
||||
{
|
||||
Q_UNUSED(widget)
|
||||
|
||||
if (proxy_ != nullptr) {
|
||||
Effect* e = central_widget_->GetEffect();
|
||||
QVector<QRectF> sockets = GetNodeSocketRects();
|
||||
if (!sockets.isEmpty()) {
|
||||
painter->setPen(Qt::black);
|
||||
painter->setBrush(Qt::gray);
|
||||
|
||||
for (int i=0;i<e->row_count();i++) {
|
||||
if (e->row(i)->CanConnectNodes()) {
|
||||
int y = central_widget_->GetRowY(i);
|
||||
|
||||
painter->setPen(Qt::black);
|
||||
painter->setBrush(Qt::gray);
|
||||
painter->drawEllipse(QPointF(rect().x() + kNodePlugSize / 2, proxy_->pos().y() + y), kNodePlugSize, kNodePlugSize);
|
||||
}
|
||||
for (int i=0;i<sockets.size();i++) {
|
||||
painter->drawEllipse(sockets.at(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,3 +88,47 @@ void NodeUI::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
|
||||
painter->setBrush(palette.window());
|
||||
painter->drawPath(path_);
|
||||
}
|
||||
|
||||
void NodeUI::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
QVector<QRectF> sockets = GetNodeSocketRects();
|
||||
|
||||
bool clicked_socket = false;
|
||||
|
||||
for (int i=0;i<sockets.size();i++) {
|
||||
if (sockets.at(i).contains(event->pos())) {
|
||||
clicked_socket = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (clicked_socket) {
|
||||
qDebug() << "CLICKED SOCKET!";
|
||||
} else {
|
||||
QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QRectF> NodeUI::GetNodeSocketRects()
|
||||
{
|
||||
QVector<QRectF> rects;
|
||||
|
||||
if (proxy_ != nullptr) {
|
||||
Effect* e = central_widget_->GetEffect();
|
||||
|
||||
for (int i=0;i<e->row_count();i++) {
|
||||
if (e->row(i)->CanConnectNodes()) {
|
||||
int y = central_widget_->GetRowY(i);
|
||||
|
||||
rects.append(QRectF(rect().x(),
|
||||
proxy_->pos().y() + y - kNodePlugSize/2,
|
||||
kNodePlugSize,
|
||||
kNodePlugSize));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rects;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,11 @@ public:
|
||||
void SetWidget(EffectUI* widget);
|
||||
protected:
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
|
||||
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
|
||||
private:
|
||||
QVector<QRectF> GetNodeSocketRects();
|
||||
|
||||
EffectUI* central_widget_;
|
||||
QGraphicsProxyWidget* proxy_;
|
||||
QPainterPath path_;
|
||||
|
||||
Reference in New Issue
Block a user