refactor: abstract type check
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
#include <QWidget>
|
||||
#include <qgraphicsitem.h>
|
||||
#include <typeinfo>
|
||||
#include "gui/network/NetworkGraphicsView.h"
|
||||
#include "gui/network/NetworkGraphicsScene.h"
|
||||
#include "gui/network/SocketGraphic.h"
|
||||
@@ -27,6 +29,12 @@ private:
|
||||
void keyReleaseEvent(QKeyEvent *event) override;
|
||||
void destroyFloatingEdge();
|
||||
|
||||
template<typename T>
|
||||
bool isType(QGraphicsItem* item)
|
||||
{
|
||||
return item && typeid(*item)==typeid(T);
|
||||
}
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user