1
0
mirror of git://projects.qi-hardware.com/nn-usb-fpga.git synced 2025-04-21 12:27:27 +03:00

First functional example, ADC an Framebuffer Test

This commit is contained in:
Juan64Bits
2010-12-04 15:12:02 -05:00
parent 62d0edf217
commit 8d95564253
138 changed files with 14826 additions and 538 deletions

77
Software/sie_cg/block_editor/diagramtextitem.cpp Normal file → Executable file
View File

@@ -56,14 +56,19 @@ DiagramTextItem::DiagramTextItem(
editableItem=editable;
setPlainText(defaultText);
posOffset=offset;
//setFlag(QGraphicsItem::ItemIsMovable,0);
if(editable)
setFlag(QGraphicsItem::ItemIsSelectable,1);
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
if(myStyleIO==0xFFF)
setFlag(QGraphicsItem::ItemIsMovable,false);
else
setFlag(QGraphicsItem::ItemIsFocusable,0);
setFlag(QGraphicsItem::ItemIsMovable,true);
setFlag(QGraphicsItem::ItemIsSelectable,true);
editorOpened=0;
updatePosition();
moving=0;
}
void DiagramTextItem::updatePosition()
@@ -81,22 +86,25 @@ void DiagramTextItem::updatePosition()
QVariant DiagramTextItem::itemChange(GraphicsItemChange change,
const QVariant &value)
{
if (change == QGraphicsItem::ItemSelectedHasChanged)
emit selectedChange(this);
return value;
}
void DiagramTextItem::focusOutEvent(QFocusEvent *event)
{
if(editableItem)
{
if(toPlainText()=="") setPlainText("?");
//updatePosition();
setTextInteractionFlags(Qt::NoTextInteraction);
emit lostFocus(this);
QGraphicsTextItem::focusOutEvent(event);
}
setPlainText(toPlainText().trimmed());
if(toPlainText()=="") setPlainText("?");
setTextInteractionFlags(Qt::NoTextInteraction);
if(myStyleIO!=0xFFF)
setFlag(QGraphicsItem::ItemIsMovable,true);
QTextCursor cursor = textCursor();
cursor.clearSelection();
setTextCursor(cursor);
QGraphicsTextItem::focusOutEvent(event);
editorOpened=0;
updatePosition();
}
void DiagramTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
@@ -105,36 +113,47 @@ void DiagramTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
if (textInteractionFlags() == Qt::NoTextInteraction)
setTextInteractionFlags(Qt::TextEditorInteraction);
setSelected(1);
setFocus(Qt::MouseFocusReason);
setFlag(QGraphicsItem::ItemIsMovable,false);
editorOpened=1;
}
QGraphicsTextItem::mouseDoubleClickEvent(event);
QGraphicsTextItem::mouseDoubleClickEvent(event);
}
void DiagramTextItem::snapToGrid(QGraphicsSceneMouseEvent *event)
{
if(myStyleIO!=0xFFF)
setOffset(event->scenePos());
updatePosition();
setOffset(event->scenePos());
}
void DiagramTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
moving=1;
//snapToGrid(event);
QGraphicsTextItem::mousePressEvent(event);
if(editorOpened==0)
{
printf("StyleIO:[%x]",myStyleIO); fflush(stdout);
snapToGrid(event);
QGraphicsTextItem::mousePressEvent(event);
}
}
void DiagramTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
moving=0;
QGraphicsTextItem::mouseReleaseEvent(event);
{
if(editorOpened==0 && myStyleIO!=0xFFF)
{
snapToGrid(event);
QGraphicsTextItem::mouseReleaseEvent(event);
}
}
void DiagramTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if(moving)
snapToGrid(event);
QGraphicsTextItem::mouseMoveEvent(event);
if(editorOpened==0 && myStyleIO!=0xFFF)
{
snapToGrid(event);
QGraphicsTextItem::mouseMoveEvent(event);
updatePosition();
}
}
QDomElement DiagramTextItem::toXml(QDomDocument &document) const