void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) { auto hoverItem = itemAt(e->scenePos(), QTransform()); if (!hoverItem && _nodesInteractable) { auto node = new Node; node->setInteractable(_nodesInteractable); node->setSelected(true); node->setPos(e->scenePos()); addItem(node); } else if (!_nodesInteractable && _currentEdge) { auto nodeItem = dynamic_cast<Node *>(hoverItem); if (nodeItem) { _currentEdge->setEndNode(nodeItem); } else { removeItem(_currentEdge); delete _currentEdge; } _currentEdge = nullptr; } QGraphicsScene::mouseReleaseEvent(e); }
void DesktopWidget::spin() { d->angle += 18; setCacheMode(ItemCoordinateCache); QPointF center = boundingRect().center(); QTransform mat = QTransform(); mat.translate(center.x() , center.y()); mat.rotate(d->angle, Qt::YAxis); mat.translate(- center.x() , - center.y()); setTransform(mat); if (d->angle >= 180) { if (state() == BACKSIDE) { setState(NORMALSIDE); } else { setState(BACKSIDE); } d->spintimer->stop(); resetMatrix(); setCacheMode(DeviceCoordinateCache); d->angle = 0; } }
void svg_renderer::update_cache_item (const renderable_item *item, const render_cache_id &cache_id, const QTransform &transform, renderer_config &cfg, int total_x, int total_y) { int block_size = rendered_items_cache::block_pixel_size (); SkBitmap bitmap; bitmap.setConfig (SkBitmap::kARGB_8888_Config, block_size * total_x, block_size * total_y); bitmap.allocPixels (); SkBitmapDevice device (bitmap); SkCanvas canvas (&device); canvas.drawColor (SK_ColorTRANSPARENT, SkXfermode::kSrc_Mode); QRectF local_rect = cache_id.pixel_rect (transform); QTransform last_inverted = transform.inverted (); QPointF last_pos_local = last_inverted.map (QPointF (0, 0)); QPointF cur_pos_local = last_inverted.map (QPointF (local_rect.x (), local_rect.y ())); QPointF diff = -cur_pos_local + last_pos_local; QTransform pixmap_transform = QTransform (transform).translate (diff.x (), diff.y ()); renderer_state state (QRect (0, 0, block_size * total_x, block_size * total_y), pixmap_transform); draw_item (item, canvas, state, cfg); if (m_queue->is_interrupted ()) return; if (total_x == total_y && total_x == 1) m_cache->add_bitmap (cache_id, bitmap, cfg.use_new_cache ()); else { for (int i = 0; i < total_x; i++) for (int j = 0; j < total_y; j++) { render_cache_id cur_id (cache_id.x () + i, cache_id.y () + j, cache_id.object_type ()); SkBitmap bitmap_part; DEBUG_ASSERT (bitmap.extractSubset (&bitmap_part, SkIRect::MakeXYWH (i * block_size, j * block_size, block_size, block_size))); m_cache->add_bitmap (cur_id, bitmap_part, cfg.use_new_cache ()); } } }
QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) { QImage im = imageForGlyph(glyph, subPixelPosition, 0, QTransform()); QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); QVector<QRgb> colors(256); for (int i=0; i<256; ++i) colors[i] = qRgba(0, 0, 0, i); indexed.setColorTable(colors); for (int y=0; y<im.height(); ++y) { uint *src = (uint*) im.scanLine(y); uchar *dst = indexed.scanLine(y); for (int x=0; x<im.width(); ++x) { *dst = 255 - (m_fontEngineData->pow_gamma[qGray(0xffffffff - *src)] * 255. / 2047.); ++dst; ++src; } } return indexed; }
bool TemplateTrack::loadTemplateFileImpl(bool configuring) { if (!track.loadFrom(template_path, false)) return false; if (!configuring) { Georeferencing* track_crs = new Georeferencing(); if (!track_crs_spec.isEmpty()) track_crs->setProjectedCRS(QString{}, track_crs_spec); track_crs->setTransformationDirectly(QTransform()); track.setTrackCRS(track_crs); bool crs_is_geographic = track_crs_spec.contains(QLatin1String("+proj=latlong")); if (!is_georeferenced && crs_is_geographic) calculateLocalGeoreferencing(); else track.changeMapGeoreferencing(map->getGeoreferencing()); } return true; }
void CGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event) { // static int nbMove=0; //qDebug("CGraphicsScene::mouseMoveEvent %i", m_mode); switch (m_mode) { case MODE_IDLE: QGraphicsScene::mouseMoveEvent(event); if (m_itemRect != NULL) { m_itemRect->setMoveablePoint(event->scenePos()); setSelectionArea(m_itemRect->path(), QTransform()); } break; case MODE_CREATE_ITEM: //Q_ASSERT(false); //Normallement ne doit jamais arrive... QGraphicsScene::mouseMoveEvent(event); break; case MODE_IN_ITEM_CREATION: Q_ASSERT(m_currentItem != NULL); m_currentItem->updateCurrentPoint(event->scenePos()); //QGraphicsScene::mouseMoveEvent(event); pas d'appel a la classe de base pour eviter les moves en meme temps que les creations d'item break; case MODE_IN_ITEM_EVOLUTION: Q_ASSERT(m_currentItem != NULL); m_currentItem->onMouseEventOnAnchor(event, m_pressedAnchor); break; default: Q_ASSERT(false); break; } }
void MapWidget::setViewOnRobot(std::string robot_id) { if (active_view_on_robot_ == robot_id) { return; } RobotGraphicsItem* robot = getRobot(robot_id); QPointF position; double heading; getRobotPosition("/"+robot_id+"/base_link", position, heading); graphicsView_->setTransform(QTransform()); graphicsView_->centerOn(position.x(),position.y()); // graphicsView_->scale(1, -1); graphicsView_->scale(56, -56); active_view_on_robot_ = robot_id; }
void BlurPicker::setIndex(qreal index) { m_index = index; qreal baseline = 0; for (int i = 0; i < m_icons.count(); ++i) { ImageItem *icon = m_icons[i]; qreal a = ((i + m_index) * 2 * M_PI) / m_icons.count(); qreal xs = 380 * qSin(a); qreal ys = 230 * qCos(a); QPointF pos(xs, ys); // pos = QTransform::scale(0,0.2).map(pos); // pos = QTransform().rotate(-20).map(pos); pos = QTransform().rotate(-5).map(pos); pos -= QPointF(40, 40); // pos -= QPoint(10,10); icon->setPos(pos); baseline = qMax(baseline, ys); static_cast<BlurEffect *>(icon->graphicsEffect())->setBaseLine(baseline); } scene()->update(); }
void MainWindow::editListUpdateGraphics() { editListChordScene->clear(); editListChordScene->addPixmap(*guitarArm); ui->editChordGraphicsView->setTransform(QTransform()); QString mainChord = ui->editNormalChordsComboBox->currentText(); QString modifier = ui->editChordsModificatorsComboBox->currentText(); QVarLengthArray<int> frets = getFrets(mainChord, modifier); Braco * braco = new Braco(648, 6, 144); Point * point = NULL; for (int i = 0; i < frets.size(); i++) if (frets.at(i) != 0 && frets.at(i) != -1) { point = braco->getPoint(i, frets.at(i)); editListChordScene->addEllipse(point->X, point->Y, 9, 9, QPen(Qt::NoPen), QBrush(QColor(255, 153, 0))); } delete point; delete braco; }
void ScreeniePixmapItem::updateItemGeometry() { QTransform transform; QTransform scale; QTransform translateBack; qreal centerScale = 1.0 - 0.9 * d->screenieModel.getDistance() / SceneLimits::MaxDistance; scale = QTransform().scale(centerScale, centerScale); QPixmap pixmap = this->pixmap(); qreal dx = pixmap.width() / 2.0; qreal dy; if (d->screenieModel.isReflectionEnabled()) { dy = pixmap.height() / 4.0; } else { dy = pixmap.height() / 2.0; } transform.translate(dx, dy); transform.rotate(d->screenieModel.getRotation(), Qt::YAxis); translateBack.translate(-dx, -dy); transform = translateBack * scale * transform; setTransform(transform, false); }
/*! \reimp */ void QGraphicsDropShadowEffect::draw(QPainter *painter) { Q_D(QGraphicsDropShadowEffect); if (d->filter->blurRadius() <= 0 && d->filter->offset().isNull()) { drawSource(painter); return; } PixmapPadMode mode = PadToEffectiveBoundingRect; if (painter->paintEngine()->type() == QPaintEngine::OpenGL2) mode = NoPad; // Draw pixmap in device coordinates to avoid pixmap scaling. QPoint offset; const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode); if (pixmap.isNull()) return; QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); d->filter->draw(painter, offset, pixmap); painter->setWorldTransform(restoreTransform); }
void NodeLabel::updateStyle() { prepareGeometryChange(); // update the text position m_text.prepare(QTransform(), s_font); QSizeF textSize = m_text.size(); m_textPos = QPointF(textSize.width() / -2., textSize.height() / -2.); // update the label QSizeF labelSize = QSizeF(qMax(textSize.width(), Node::getCoreRadius() * 2.), textSize.height()); m_outlineRect = QRectF((labelSize.width() / -2.) - s_horizontalMargin, m_textPos.y() - s_verticalMargin, labelSize.width() + (s_horizontalMargin * 2.), textSize.height() + (s_verticalMargin * 2.)); // update bounding rectangle qreal halfLine = s_outlineWidth * 0.5; m_boundingRect = m_outlineRect. marginsAdded(QMarginsF(halfLine, halfLine, halfLine, halfLine)); update(); }
void VideoItem::paintExtDockFace(QPainter *p, const QStyleOptionGraphicsItem *e, QWidget *widget) { p->setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing | QPainter::HighQualityAntialiasing); p->setPen(QColor(215, 255, 98)); p->setFont(QFont("Bitstream Charter", 12)); // p->drawText(QRect(8,5,64,64), Qt::AlignCenter ,"Video" ) ; p->save(); QPointF center = e->exposedRect.center(); QTransform mat = QTransform(); mat.translate(center.x(), center.y()); mat.rotate(-9.44, Qt::ZAxis); mat.translate(-center.x(), -center.y()); // mat.shear(0.02,-0.01); p->setTransform(mat); p->setOpacity(0.8); if (snapped == true) p->drawPixmap(15, 43, e->exposedRect.width() - 30, e->exposedRect.height() - 63, snap); p->restore(); }
void ImageWidget::paint(QPainter& painter) { SYNC_WITH(imageView.console); const DebugImage* image = nullptr; RobotConsole::Images& currentImages = imageView.upperCam ? imageView.console.upperCamImages : imageView.console.lowerCamImages; RobotConsole::Images::const_iterator i = currentImages.find(imageView.background); if(i != currentImages.end()) { image = i->second.image; imageWidth = image->getImageWidth(); imageHeight = image->height; } else if(!currentImages.empty()) { imageWidth = currentImages.begin()->second.image->getImageWidth(); imageHeight = currentImages.begin()->second.image->height; } const QSize& size = painter.window().size(); float xScale = float(size.width()) / float(imageWidth); float yScale = float(size.height()) / float(imageHeight); scale = xScale < yScale ? xScale : yScale; scale *= zoom; float imageXOffset = (float(size.width()) - float(imageWidth) * scale) * 0.5f + float(offset.x()) * scale; float imageYOffset = (float(size.height()) - float(imageHeight) * scale) * 0.5f + float(offset.y()) * scale; painter.setTransform(QTransform(scale, 0, 0, scale, imageXOffset, imageYOffset)); if(image) paintImage(painter, *image); else lastImageTimeStamp = 0; paintDrawings(painter); }
bool MozQOrientationSensorFilter::filter(QOrientationReading* reading) { switch (reading->orientation()) { //The Top edge of the device is pointing up. case QOrientationReading::TopDown: mWindowRotationAngle = 90; break; //The Top edge of the device is pointing down. case QOrientationReading::TopUp: mWindowRotationAngle = 270; break; //The Left edge of the device is pointing up. case QOrientationReading::LeftUp: mWindowRotationAngle = 180; break; //The Right edge of the device is pointing up. case QOrientationReading::RightUp: mWindowRotationAngle = 0; break; //The Face of the device is pointing up. case QOrientationReading::FaceUp: //The Face of the device is pointing down. case QOrientationReading::FaceDown: //The orientation is unknown. case QOrientationReading::Undefined: default: return true; } mWindowRotationTransform = QTransform(); mWindowRotationTransform.rotate(mWindowRotationAngle); emit orientationChanged(); return true; // don't store the reading in the sensor }
void wxQtDCImpl::DoSetDeviceClippingRegion(const wxRegion& region) { if ( region.IsEmpty() ) { DestroyClippingRegion(); } else { QRegion qregion = region.GetHandle(); // Save current origin / scale (logical coordinates) QTransform qtrans = m_qtPainter->worldTransform(); // Reset transofrmation to match device coordinates m_qtPainter->setWorldTransform( QTransform() ); // Set QPainter clipping (intersection if not the first one) m_qtPainter->setClipRegion( qregion, m_clipping ? Qt::IntersectClip : Qt::ReplaceClip ); // Restore the transformation (translation / scale): m_qtPainter->setWorldTransform( qtrans ); // Set internal state for getters /* Note: Qt states that QPainter::clipRegion() may be slow, so we * keep the region manually, which should be faster */ if ( m_clipping ) m_clippingRegion.Union( region ); else m_clippingRegion.Intersect( region ); wxRect clipRect = m_clippingRegion.GetBox(); m_clipX1 = clipRect.GetLeft(); m_clipX2 = clipRect.GetRight() + 1; m_clipY1 = clipRect.GetTop(); m_clipY2 = clipRect.GetBottom() + 1; m_clipping = true; } }
void MLabelViewSimple::initializeTextProperties() { if (!dirty) { return; } dirty = false; const MLabelStyle *style = viewPrivate->style(); if (viewPrivate->textOptions.textDirection() == Qt::LayoutDirectionAuto) viewPrivate->autoSetTextDirection(); paintingRect = (viewPrivate->textOptions.textDirection() == Qt::LeftToRight) ? viewPrivate->boundingRect().adjusted(style->paddingLeft(), style->paddingTop(), -style->paddingRight(), -style->paddingBottom()) : viewPrivate->boundingRect().adjusted(style->paddingRight(), style->paddingTop(), -style->paddingLeft(), -style->paddingBottom()); textOffset = paintingRect.topLeft().toPoint(); unconstraintText = textToRender(QSizeF(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); const QString text = textToRender(paintingRect.size()); staticText.setTextWidth(paintingRect.width()); staticText.setTextOption(viewPrivate->textOptions); staticText.setText(text); staticText.prepare(QTransform(), viewPrivate->controller->font()); adjustTextOffset(); clip = textOffset.x() < paintingRect.x() || textOffset.y() < paintingRect.y() || textOffset.x() + staticText.size().width() > paintingRect.right() || textOffset.y() + staticText.size().height() > paintingRect.bottom(); const QColor& color = viewPrivate->model()->color(); pen = QPen(color.isValid() ? color : style->color()); font = QFont(viewPrivate->controller->font()); }
void TestShapeContainer::testModel() { MockContainerModel *model = new MockContainerModel(); MockContainer container(model); MockShape *shape1 = new MockShape(); container.addShape(shape1); QCOMPARE(model->containerChangedCalled(), 0); QCOMPARE(model->childChangedCalled(), 1); QCOMPARE(model->proposeMoveCalled(), 0); shape1->setPosition(QPointF(300, 300)); QCOMPARE(model->containerChangedCalled(), 0); QCOMPARE(model->childChangedCalled(), 2); QCOMPARE(model->proposeMoveCalled(), 0); shape1->rotate(10); QCOMPARE(model->containerChangedCalled(), 0); QCOMPARE(model->childChangedCalled(), 3); QCOMPARE(model->proposeMoveCalled(), 0); shape1->setAbsolutePosition(shape1->absolutePosition() + QPointF(10., 40.)); QCOMPARE(model->containerChangedCalled(), 0); QCOMPARE(model->childChangedCalled(), 5); // we get a generic Matrix as well as a position change... QCOMPARE(model->proposeMoveCalled(), 0); shape1->setTransformation(QTransform()); QCOMPARE(model->containerChangedCalled(), 0); QCOMPARE(model->childChangedCalled(), 6); QCOMPARE(model->proposeMoveCalled(), 0); model->resetCounts(); container.setPosition(QPointF(30, 30)); QCOMPARE(model->containerChangedCalled(), 1); QCOMPARE(model->childChangedCalled(), 0); QCOMPARE(model->proposeMoveCalled(), 0); }
/// Plots the graph. void DiagramScene::drawGraph(DiagramList* list) { QPainterPath path; if (list->getPath(path, _scaleX, _scaleY)) { QPen pen(list->getColor(), 2, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin); pen.setCosmetic(true); _graphs.push_back(addPath(path, pen)); addCaption(list->getName(), pen); int last = _graphs.size() - 1; /** * For correct display the graph needs to be flipped vertically and then * translated back to its original position */ int verticalShift = static_cast<int>(2 * (list->minYValue() * _scaleY) + (_graphs[last]->boundingRect()).height()); _graphs[last]->setTransform(QTransform(QMatrix(1,0,0,-1,0,verticalShift))); } }
void Palette::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if(!event->buttons() & Qt::LeftButton) { return; } if((event->scenePos() - _dragStartPosition).manhattanLength() < QApplication::startDragDistance()) { return; } // Get the pixmap item related to the start of the drag. QGraphicsItem *item = itemAt(_dragStartPosition, QTransform()); if(item == 0) { // Couldn't find an item at the location for some reason. return; } // Static cast is safe because this scene only adds QGraphicsPixmapItem QGraphicsPixmapItem *pixmapItem = static_cast<QGraphicsPixmapItem *>(item); Sprite sprite = _pixmapToSprite[pixmapItem]; // Create a new drag event and put the source image into the mime data. QDrag *drag = new QDrag((QObject *)event->widget()); QMimeData *data = new QMimeData(); data->setImageData(sprite.getTexture()); data->setText(sprite.getFileInfo().absoluteFilePath()); drag->setMimeData(data); // Put the pixmap that was selected onto the cursor QPixmap pixmap = pixmapItem->pixmap(); drag->setPixmap(pixmap); drag->setHotSpot(QPoint(pixmap.width() / 2, pixmap.height() / 2)); // Execute the drag with a copy action. drag->exec(Qt::CopyAction, Qt::CopyAction); }
void CWizShadowEffect::draw(QPainter *painter) { PixmapPadMode mode = PadToEffectiveBoundingRect; if (painter->paintEngine()->type() == QPaintEngine::OpenGL2) mode = NoPad; // Draw pixmap in device coordinates to avoid pixmap scaling. QPoint offset(0, 0); const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode); if (pixmap.isNull()) return; // QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); painter->setBrush(QBrush(Qt::NoBrush)); QSize sz = pixmap.size(); painter->drawPixmap(offset.x(), offset.y(), pixmap); // QRect rcBound(offset.x() - 1, offset.y() - 1, sz.width() + 1, sz.height() + 1); m_shadow->DrawBorder(painter, rcBound); // painter->setWorldTransform(restoreTransform); }
/* * Check that everything works as expected when disconnection occurs and * connection is re-established and new shared memory information is received */ void Ut_MReactionMap::reconnect() { QRect clientRect(0, 0, 100, 50); MReactionMapConnection *testConnection; testConnection = MReactionMapConnection::instance(); // Set 1:1 mapping of coordinates reactionMap1->setTransform(QTransform()); reactionMap1->setTransparentDrawingValue(); reactionMap1->fillRectangle(clientRect); // Check that locally created image is as expected QCOMPARE(checkArea(reactionMap1, 1, clientRect.x(), clientRect.y(), clientRect.width(), clientRect.height()), true); // Send information about shared memory testConnection->setSharedMemoryData(reactionMap1->getPrivatePtr()); // Disconnect, but do not fail testConnection->disconnect(false); // Check that image has not changed QCOMPARE(checkArea(reactionMap1, 1, clientRect.x(), clientRect.y(), clientRect.width(), clientRect.height()), true); // Check that reaction map was added to connections QVERIFY(testConnection->reactionMaps.contains(reactionMap1->getPrivatePtr()) == true); // Send information about shared memory testConnection->setSharedMemoryData(reactionMap1->getPrivatePtr()); // Check that image has not changed QCOMPARE(checkArea(reactionMap1, 1, clientRect.x(), clientRect.y(), clientRect.width(), clientRect.height()), true); }
void QPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) { const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); if (ti.glyphs.numGlyphs == 0) return; if (ti.fontEngine->glyphFormat == QFontEngine::Format_ARGB) { QVarLengthArray<QFixedPoint> positions; QVarLengthArray<glyph_t> glyphs; QTransform matrix = QTransform::fromTranslate(p.x(), p.y() - ti.fontEngine->ascent().toReal()); ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); painter()->save(); painter()->setRenderHint(QPainter::SmoothPixmapTransform, bool((painter()->renderHints() & QPainter::TextAntialiasing) && !(painter()->font().styleStrategy() & QFont::NoAntialias))); for (int i = 0; i < ti.glyphs.numGlyphs; ++i) { QImage glyph = ti.fontEngine->bitmapForGlyph(glyphs[i], QFixed(), QTransform()); painter()->drawImage(positions[i].x.toReal(), positions[i].y.toReal(), glyph); } painter()->restore(); return; } QPainterPath path; path.setFillRule(Qt::WindingFill); ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags); if (!path.isEmpty()) { painter()->save(); painter()->setRenderHint(QPainter::Antialiasing, bool((painter()->renderHints() & QPainter::TextAntialiasing) && !(painter()->font().styleStrategy() & QFont::NoAntialias))); painter()->translate(p.x(), p.y()); painter()->fillPath(path, painter()->pen().brush()); painter()->restore(); } }
//-------------------------------------------------------------------------- // return a thumbnail that respects the orientation flag // only if it seems sane //-------------------------------------------------------------------------- QImage ExifData::getThumbnail() { if ( Thumbnail.isNull() ) return QImage(); // Qt4 NULL->QImage() is it sane? if (orientationCount > 1) return Thumbnail; if ( !Orientation || Orientation == 1 ) return Thumbnail; // now fix orientation QTransform M; QTransform flip = QTransform ( -1,0,0,1,0,0 ); switch ( Orientation ) { // notice intentional fallthroughs case 2: M = flip; break; case 4: M = flip; case 3: M.rotate ( 180 ); break; case 5: M = flip; case 6: M.rotate ( 90 ); break; case 7: M = flip; case 8: M.rotate ( 270 ); break; default: break; // should never happen } return Thumbnail.transformed ( M ); }
void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { switch(event->button()) { case Qt::LeftButton: switch(this->mode) { case POINT: //http://forum.qtfr.org/discussion/13407/selection-multiple-avancee-dans-une-qgraphicsscene emit pointClicked(event->scenePos()); break; case SEGMENT: { QGraphicsScene::mouseReleaseEvent(event); QList<QGraphicsItem*> l = selectedItems(); //if(itemAt(event->scenePos(), QTransform()) == NULL) break; //TODO if(l.size() >= 2) { emit segmentClicked(l); for(auto i : l) ((PointItem*)i)->select(false); ((PointItem*)itemAt(event->scenePos(), QTransform()))->select(true); } } break; case SUPPRESSION: break; } break; case Qt::RightButton: clickOnSelection(event->scenePos()); QGraphicsScene::mouseReleaseEvent(event); break; case Qt::MiddleButton: //translate break; default: break; } }
/*! Returns the adjoint of this matrix. */ QTransform QTransform::adjoint() const { qreal h11, h12, h13, h21, h22, h23, h31, h32, h33; h11 = affine._m22*m_33 - m_23*affine._dy; h21 = m_23*affine._dx - affine._m21*m_33; h31 = affine._m21*affine._dy - affine._m22*affine._dx; h12 = m_13*affine._dy - affine._m12*m_33; h22 = affine._m11*m_33 - m_13*affine._dx; h32 = affine._m12*affine._dx - affine._m11*affine._dy; h13 = affine._m12*m_23 - m_13*affine._m22; h23 = m_13*affine._m21 - affine._m11*m_23; h33 = affine._m11*affine._m22 - affine._m12*affine._m21; //### not a huge fan of this simplification but // i'd like to keep m33 as 1.0 //return QTransform(h11, h12, h13, // h21, h22, h23, // h31, h32, h33); h33 = 1/h33; return QTransform(h11*h33, h12*h33, h13*h33, h21*h33, h22*h33, h23*h33, h31*h33, h32*h33, 1.0); }
void GraphViewer::onSceneMouseDoubleClick(QGraphicsSceneMouseEvent *mouseEvent) { QGraphicsItem * item = _scene.itemAt(mouseEvent->scenePos(), QTransform()); QGraphicsSimpleTextItem* text = qgraphicsitem_cast<QGraphicsSimpleTextItem*>(item); // Modify edge weight if (text) { QGraphicsLineItem* edge = qgraphicsitem_cast<QGraphicsLineItem*>(text->parentItem()); if (edge) { // text is edge weight _editedItem = text; int weight = edge->data(KEY_EDGE_WEIGHT).toInt(); _valueEditor.setText(QString("%1").arg(weight)); _valueEditor.show(); _valueEditor.resize(20,_valueEditor.height()); _valueEditor.move(mouseEvent->screenPos()); } } }
void QRawWebView::sendWheelEvent(QWheelEvent* event) { d->m_webPageProxy->handleWheelEvent(WebKit::NativeWebWheelEvent(event, QTransform())); }
void QRawWebView::sendTouchEvent(QTouchEvent* event) { #if ENABLE(TOUCH_EVENTS) d->m_webPageProxy->handleTouchEvent(WebKit::NativeWebTouchEvent(event, QTransform())); #endif }
void QRawWebView::sendMouseEvent(QMouseEvent* event, int clickCount) { d->m_webPageProxy->handleMouseEvent(WebKit::NativeWebMouseEvent(event, QTransform(), clickCount)); }