Subclassed QGraphicsItem and QGraphicsItemLine.
--HG-- branch : dfighter-toolshg/feature/qt5
parent
83566116d9
commit
adece7564a
@ -0,0 +1,44 @@
|
||||
// Ryzom Core Studio - Georges Editor Plugin
|
||||
//
|
||||
// Copyright (C) 2014 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "expression_link.h"
|
||||
#include <QGraphicsItem>
|
||||
#include <QPen>
|
||||
|
||||
ExpressionLink::ExpressionLink( QGraphicsItem *parent ) :
|
||||
QGraphicsLineItem( parent )
|
||||
{
|
||||
m_from = NULL;
|
||||
m_to = NULL;
|
||||
}
|
||||
|
||||
ExpressionLink::~ExpressionLink()
|
||||
{
|
||||
}
|
||||
|
||||
void ExpressionLink::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
|
||||
{
|
||||
if( m_from != NULL )
|
||||
setLine( QLineF( m_from->pos(), m_to->pos() ) );
|
||||
|
||||
setPen( QPen( Qt::darkRed ) );
|
||||
|
||||
QGraphicsLineItem::paint( painter, option, widget );
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,44 @@
|
||||
// Ryzom Core Studio - Georges Editor Plugin
|
||||
//
|
||||
// Copyright (C) 2014 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef EXPRESSION_LINK
|
||||
#define EXPRESSION_LINK
|
||||
|
||||
#include <QGraphicsItem>
|
||||
|
||||
class ExpressionLink : public QGraphicsLineItem
|
||||
{
|
||||
public:
|
||||
ExpressionLink( QGraphicsItem *parent = NULL );
|
||||
~ExpressionLink();
|
||||
|
||||
void link( QGraphicsItem *from, QGraphicsItem *to ){
|
||||
m_from = from;
|
||||
m_to = to;
|
||||
}
|
||||
|
||||
void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget );
|
||||
|
||||
private:
|
||||
QGraphicsItem *m_from;
|
||||
QGraphicsItem *m_to;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,50 @@
|
||||
// Ryzom Core Studio - Georges Editor Plugin
|
||||
//
|
||||
// Copyright (C) 2014 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "expression_node.h"
|
||||
#include <QPainter>
|
||||
#include <QStyleOption>
|
||||
|
||||
ExpressionNode::ExpressionNode( QGraphicsItem *parent ) :
|
||||
QGraphicsItem( parent )
|
||||
{
|
||||
}
|
||||
|
||||
ExpressionNode::~ExpressionNode()
|
||||
{
|
||||
}
|
||||
|
||||
QRectF ExpressionNode::boundingRect() const
|
||||
{
|
||||
return QRectF( 0, 0, 100, 100 );
|
||||
}
|
||||
|
||||
void ExpressionNode::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
|
||||
{
|
||||
if( option->state & QStyle::State_Selected )
|
||||
{
|
||||
QPen outline;
|
||||
outline.setStyle( Qt::DotLine );
|
||||
painter->setPen( outline );
|
||||
|
||||
}
|
||||
|
||||
painter->drawRect( boundingRect() );
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
// Ryzom Core Studio - Georges Editor Plugin
|
||||
//
|
||||
// Copyright (C) 2014 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef EXPRESSION_NODE
|
||||
#define EXPRESSION_NODE
|
||||
|
||||
#include <QGraphicsItem>
|
||||
|
||||
class ExpressionNode : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
ExpressionNode( QGraphicsItem *parent = NULL );
|
||||
~ExpressionNode();
|
||||
|
||||
QRectF boundingRect() const;
|
||||
void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget );
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue