void BinaryOutputElement::setInputSize(int inputs) { if(aligment == Vertical){ intRect = QRectF(5, 5, 9, inputs*7 + 2); setContainerRect(intRect.adjusted(-5, -5, 5, 5)); }else{ intRect = QRectF(5, 5, inputs*7 + 2, 9); setContainerRect(intRect.adjusted(-5, -5, 5, 5)); } this->inputs.resize(inputs); update(); }
void core::DotMatrix::init(int dotSize, int rows, int cols, DataFormat dt) { this->size = dotSize; //QActions continuousDrawingAction = new QAction(ICON_FREEHAND, "Dibujo continuo", this); clearAction = new QAction(ICON_CLEAR, "Limpiar", this); fillAction = new QAction(ICON_FILL, "Llenar", this); eraserAction = new QAction(ICON_ERASER, "Borrador", this); continuousDrawingAction->setCheckable(true); eraserAction->setCheckable(true); contextMenu.insertAction(getLockAction(), continuousDrawingAction); contextMenu.insertAction(continuousDrawingAction, fillAction); contextMenu.insertAction(fillAction, clearAction); contextMenu.insertAction(clearAction, eraserAction); setEnableContinuousDrawing(true); setEnableEraserPen(false); setRows(rows); setCols(cols); setEnableEdit(true); setBorder(QPen(Qt::black, 1)); setContainerRect(getContainer()); setDataType(dt); connect(continuousDrawingAction, SIGNAL(triggered(bool)), SLOT(setEnableContinuousDrawing(bool))); connect(clearAction, SIGNAL(triggered()), SLOT(clear())); connect(fillAction, SIGNAL(triggered()), SLOT(fill())); connect(eraserAction, SIGNAL(triggered(bool)), SLOT(setEnableEraserPen(bool))); }
void core::Connector::setEndObject(GraphicObject *end) { if(!end) return; endObject = end; // qDebug() << currentMousePos; //we use currentMousePos instead internal currentMousePos from "end" object due update mouse position problems //there are conflicts when moving mouse so using this currentMousePos ensures mouse pos is always updated // qDebug() << portRect; endPoint = mapFromItem(end, end->getCurrentPortPos(mapToItem(end, currentMousePos))); isBuildingConector = false; // qDebug() << portCenter; QRectF container = getContainerRect(); if(currentMousePos.x() < 0 && currentMousePos.y() < 0){ container.setTopLeft(endPoint ); }else if(currentMousePos.x() < 0 && currentMousePos.y() >= 0){ container.setBottomLeft(endPoint ); }else if(currentMousePos.x() >= 0 && currentMousePos.y() < 0){ container.setTopRight(endPoint ); }else if(currentMousePos.x() >= 0 && currentMousePos.y() >= 0){ container.setBottomRight(endPoint ); }else{ container= QRectF(0, 0, 0, 0); } setContainerRect(container); }
void core::DotMatrix::setCols(int value) { if(cols != value){ cols = value; updateDotList(); setContainerRect(getContainer()); update(); emit colCountChanged(value); } }
void core::DotMatrix::setDotSize(int size) { if(this->size != size){ this->size = size; setContainerRect(getContainer()); update(); emit dotSizeChanged(size); } }
void core::DotMatrix::setRows(int value) { if(rows != value){ rows = value; updateDotList(); setContainerRect(getContainer()); update(); emit rowCountChanged(value); } }
void core::DotMatrix::setMatrixSize(const QSize &size) { if(rows != size.height() || cols != size.width()){ rows = size.height(); cols = size.width(); setContainerRect(getContainer()); updateDotList(); update(getContainerRect()); emit matrixSizeChanged(size); } }
void core::DotMatrix::setInputs(const vector<double> &inputs) { GraphicObject::setInputs(inputs); setInputsSize((int)inputs.size()); updateDotList(); setContainerRect(getContainer()); vector<int> intInputs(inputs.begin(), inputs.end()); update(); emit statusChanged(QVector<int>::fromStdVector(intInputs)); }
void core::Connector::init(GraphicObject *begin, GraphicObject *end) { clearance = 10; beginObject = begin; endObject = end; isBuildingConector = false; getSaveAction()->setVisible(false); getOpenAction()->setVisible(false); getCopyAction()->setVisible(false); getCutAction()->setVisible(false); getPasteAction()->setVisible(false); setContainerRect(QRectF(0, 0, 0, 0)); setObjectLocked(true); }
bool core::Connector::eventFilter(QObject *sender, QEvent *event) { // qDebug () << event->type(); if(event->type() == QEvent::MouseMove){ QMouseEvent *hEvent = (QMouseEvent*)event; GraphicDetailedView *gdv = (GraphicDetailedView*)sender; QPointF pos = mapFromScene(gdv->mapToScene(hEvent->pos())); currentMousePos = pos; // qDebug() << currentMousePos << "<< currentMousePos"; QRectF container = getContainerRect(); if(pos.x() < 0 && pos.y() < 0){ container.setTopLeft(pos); container.setBottomRight(QPointF(0, 0)); }else if(pos.x() < 0 && pos.y() >= 0){ container.setBottomLeft(pos); container.setTopRight(QPointF(0, 0)); }else if(pos.x() >= 0 && pos.y() < 0){ container.setTopRight(pos); container.setBottomLeft(QPointF(0, 0)); }else if(pos.x() >= 0 && pos.y() >= 0){ container.setBottomRight(pos); container.setTopLeft(QPointF(0, 0)); }else{ container= QRectF(0, 0, 0, 0); } setContainerRect(container); if(isBuildingConector){ updateConectorLine(beginPoint, pos); } return true; } return GraphicObject::eventFilter(sender, event); }
void core::ImageEffect::updateImage() { minImage = modImage.scaled(50, 50, Qt::KeepAspectRatio/*, Qt::SmoothTransformation*/); setContainerRect(minImage.rect()); update(); }