Examples of QPointF


Examples of com.trolltech.qt.core.QPointF

      }
       
      rows = device.getRows();
      cols = device.getColumns();
      sceneSize = new QSize((cols + 1) * (tileSize + 1), (rows + 1) * (tileSize + 1));
      setSceneRect(new QRectF(new QPointF(0, 0), new QSizeF(sceneSize)));
      drawFPGAFabric(drawPrimitives);
    }
    else{
      setSceneRect(new QRectF(0, 0, tileSize + 1, tileSize + 1));
    }
View Full Code Here

Examples of com.trolltech.qt.core.QPointF

    return getTile(event.scenePos().x(), event.scenePos().y());
  }
 
  @Override
  public void mouseMoveEvent(QGraphicsSceneMouseEvent event) {
    QPointF mousePos = event.scenePos();
    if (device != null) {
      Tile tile = getTile(mousePos.x(), mousePos.y());
      if(tile != null){
        String tileName = device.getPartName() + " | " +  tile.getName() +
        " | " + tile.getType() + " (" + currX + "," + currY + ")";
        this.updateStatus.emit(tileName, tile);
        prevX = currX;
View Full Code Here

Examples of com.trolltech.qt.core.QPointF

    super.mouseMoveEvent(event);
  }
 
  @Override
  public void mouseDoubleClickEvent(QGraphicsSceneMouseEvent event){
    QPointF mousePos = event.scenePos();
    currX = (int) Math.floor((mousePos.x()) / tileSize);
    currY = (int) Math.floor((mousePos.y()) / tileSize);

    if (currX >= 0 && currY >= 0 && currX < cols && currY < rows){
      updateCursor();
    }     
 
View Full Code Here

Examples of com.trolltech.qt.core.QPointF

    // Go down right side, adding profile points
    for (int i = 0; i < height; i++) {
      for (int j = 0; j < width; j++) {
        if (hmTileMap[i][j]
            && (j + 1 > width - 1 || !hmTileMap[i][j + 1])) {
          QPointF pTR = new QPointF((j + 1) * tileSize - 1, i
              * tileSize - 1);
          hmPolygon.add(this.pos().add(pTR));
          QPointF pBR = new QPointF((j + 1) * tileSize - 1, (i + 1)
              * tileSize - 1);
          hmPolygon.add(this.pos().add(pBR));
          break;
        }
      }
    }
    // Go up left side, adding profile points
    for (int i = height - 1; i >= 0; i--) {
      for (int j = width - 1; j >= 0; j--) {
        if (hmTileMap[i][j] && (j - 1 < 0 || !hmTileMap[i][j - 1])) {
          QPointF pBL = new QPointF((j) * tileSize - 1, (i + 1)
              * tileSize - 1);
          hmPolygon.add(this.pos().add(pBL));
          QPointF pTL = new QPointF((j) * tileSize - 1, (i)
              * tileSize - 1);
          hmPolygon.add(this.pos().add(pTL));
          break;
        }
      }
View Full Code Here

Examples of com.trolltech.qt.core.QPointF

        && scene() != null) {
      moved.emit();
    } else if (change == GraphicsItemChange.ItemPositionChange
        && scene() != null) {
      // value is the new position.
      QPointF newPos = (QPointF) value;
      QRectF rect = scene().sceneRect();

      double width = this.boundingRect().width();
      width = Math.floor(width / scene.tileSize);
      double height = this.boundingRect().height();
      height = Math.floor(height / scene.tileSize);
      QPointF p = rect.bottomRight();
      //p.setX((fpScene.device.getColumns() - width) * fpScene.tileSize);
      //p.setY((fpScene.device.getRows() - height) * fpScene.tileSize);
     
      p.setX((scene.cols - width) * scene.tileSize);
      p.setY((scene.rows - height) * scene.tileSize);
      rect.setBottomRight(p);
      if (!rect.contains(newPos)) {
        // Keep the item inside the scene rect.
        newPos.setX(Math.min(rect.right(), Math.max(newPos.x(), rect
            .left())));
View Full Code Here

Examples of com.trolltech.qt.core.QPointF

    }
    //int x = anchorInst.getTile().getColumn();
    //int y = anchorInst.getTile().getRow();
    int x = scene.getDrawnTileX(anchorInst.getTile());
    int y = scene.getDrawnTileY(anchorInst.getTile());
    this.anchorOffset = (new QPointF(x*scene.tileSize,y*scene.tileSize)).subtract(this.pos());
  }
 
View Full Code Here

Examples of com.trolltech.qt.core.QPointF

  public void mouseMoveEvent(QMouseEvent event){
    if (rightPressed){
      if (lastPan != null && !lastPan.isNull()) {
        hasPanned = true;
        // Get how much we panned
        QPointF s1 = mapToScene(new QPoint((int) lastPan.x(),
            (int) lastPan.y()));
        QPointF s2 = mapToScene(new QPoint((int) event.pos().x(),
            (int) event.pos().y()));
        QPointF delta = new QPointF(s1.x() - s2.x(), s1.y() - s2.y());
        lastPan = event.pos();
        // Scroll the scrollbars ie. do the pan
        double zoom = this.matrix().m11();
        this.horizontalScrollBar().setValue((int) (this.horizontalScrollBar().value()+zoom*delta.x()));
        this.verticalScrollBar().setValue((int) (this.verticalScrollBar().value()+zoom*delta.y()));
      }
    }
    super.mouseMoveEvent(event);
  }
 
View Full Code Here

Examples of com.trolltech.qt.core.QPointF

   * In this case, it allows the user to zoom in and out of the
   * array of tiles.
   */
  public void wheelEvent(QWheelEvent event){
    // Get the position of the mouse before scaling, in scene coords
    QPointF pointBeforeScale = mapToScene(event.pos());

    // Scale the view ie. do the zoom
    double zoom = this.matrix().m11();
    if (event.delta() > 0) {
      // Zoom in (if not at limit)
      if(zoom < zoomMax)
        scale(scaleFactor, scaleFactor);
    } else {
      // Zoom out (if not at limit)
      if(zoom > zoomMin)
        scale(1.0 / scaleFactor, 1.0 / scaleFactor);
    }

    // Get the position after scaling, in scene coords
    QPointF pointAfterScale = mapToScene(event.pos());

    // Get the offset of how the screen moved
    QPointF offset = new QPointF(
        pointBeforeScale.x() - pointAfterScale.x(), pointBeforeScale.y() - pointAfterScale.y());
    this.horizontalScrollBar().setValue((int) (this.horizontalScrollBar().value()+zoom*offset.x()));
    this.verticalScrollBar().setValue((int) (this.verticalScrollBar().value()+zoom*offset.y()));
  }
 
View Full Code Here

Examples of com.trolltech.qt.core.QPointF

    painter.drawImage(0, 0, qImage);
  }

  @Override
  public void mouseMoveEvent(QGraphicsSceneMouseEvent event) {
    QPointF mousePos = event.scenePos();
    currX = Math.floor((mousePos.x()) / tileSize);
    currY = Math.floor((mousePos.y()) / tileSize);
    if (currX >= 0 && currY >= 0 && currX < numCols && currY < numRows
        && (currX != prevX || currY != prevY)) {
      this.updateStatus.emit();
      updateCursor();
      prevX = currX;
View Full Code Here

Examples of com.trolltech.qt.core.QPointF

  public void mouseMoveEvent(QMouseEvent event) {
    if (rightPressed) {
      if (lastPan != null && !lastPan.isNull()) {
        // Get how much we panned
        QPointF s1 = mapToScene(new QPoint((int) lastPan.x(),
            (int) lastPan.y()));
        QPointF s2 = mapToScene(new QPoint((int) event.pos().x(),
            (int) event.pos().y()));
        QPointF delta = new QPointF(s1.x() - s2.x(), s1.y() - s2.y());
        lastPan = event.pos();
        // Scroll the scrollbars ie. do the pan
        double zoom = this.matrix().m11();
        this.horizontalScrollBar().setValue((int) (this.horizontalScrollBar().value()+zoom*delta.x()));
        this.verticalScrollBar().setValue((int) (this.verticalScrollBar().value()+zoom*delta.y()));
      }
    }
    super.mouseMoveEvent(event);
  }
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.