SchemaEditor::SchemaEditor(QWidget *parent, SchemaGui *schemaGui, Engine * engine, PanelScrollView *panelScrollView) : QGraphicsView(schemaGui, parent), _contextMenuPos(0,0), _contextGear(NULL), _engine(engine), _schemaGui(schemaGui), _scale(1), _panelScrollView(panelScrollView), _maxZValue(1), _selectionChangeBypass(false) { _schemaGui->setSchemaEditor(this); setDragMode(QGraphicsView::RubberBandDrag); setRenderHint(QPainter::Antialiasing, true); setFrameStyle(Sunken | StyledPanel); setOptimizationFlags(QGraphicsView::DontSavePainterState | QGraphicsView::IndirectPainting); setViewportUpdateMode(QGraphicsView::FullViewportUpdate); setTransformationAnchor(QGraphicsView::AnchorUnderMouse); // render with OpenGL if(0) setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); resetTransform(); setAcceptDrops(TRUE); }
void TablePile::setSize(double width, double height) { m_cardsDisplayRegion = QRect(0, 0, width, height); m_numCardsVisible = width / G_COMMON_LAYOUT.m_cardNormalHeight + 1; resetTransform(); translate(-width / 2, -height / 2); }
void AnimatorView::systemReset () { m_currentZoomFactor = 1; resetTransform (); }
bool QSanSelectableItem::_load(const QString &filename, QSize size, bool useNewSize, bool center_as_origin) { bool success = _m_mainPixmap.load(filename); if (!success) { QImageReader reader(filename); QString error_string = reader.errorString(); QString warning = tr("Can not load image %1[%2], error string is %3") .arg(filename).arg(metaObject()->className()).arg(error_string); QMessageBox::warning(NULL, tr("Warning"), warning); } else { if (useNewSize) { _m_width = size.width(); _m_height = size.height(); } else { _m_width = _m_mainPixmap.width(); _m_height = _m_mainPixmap.height(); } if (center_as_origin) { resetTransform(); setTransform(QTransform::fromTranslate(-_m_width / 2, -_m_height / 2), true); } else this->prepareGeometryChange(); } return success; }
void ProfileGraphicsView::clear() { scene()->clear(); resetTransform(); zoomLevel = 0; toolTip = 0; }
void ImageView::setScaleFactor(double factor) { if(factor != scaleFactor_) { scaleFactor_ = factor; resetTransform(); scale(factor, factor); queueGenerateCache(); } }
PathBlock* PathBlock::scale(float scaleX, float scaleY) { changeScale(scaleX, scaleY); resetTransform(); return this; }
PathBlock* PathBlock::rotate(const Angle& angle) { rotation += angle; resetTransform(); return this; }
void SceneView::setScene(Scene * scene) { if (m_scene != NULL) delete m_scene; m_scene = scene; resetTransform(); emit updateGL(); }
void MainRSTView::rePort() { resetTransform(); centerOn(father_->fx_, father_->fy_); scale(father_->sc_, father_->sc_); emit portChanged(width() / father_->sc_, height() / father_->sc_); }
void FormView::showForm(AbstractForm * form) { QGraphicsScene *s = scene(); s->clear(); resetTransform(); if(form == 0){ return; } if(form->get_number_of_points() <= 0) { return; } int factor = 100; QPolygonF polygon; for(int i=0; i<form->get_number_of_points(); ++i){ Point point = form->get_point_at_index(i); polygon.push_back(QPointF(point.get_x()*factor, point.get_y()*factor)); } s->addPolygon(polygon, QPen(), QBrush(Qt::SolidPattern)); QRectF bound = polygon.boundingRect(); s->setSceneRect(bound); float realwidth = container->width() - 50; float width = bound.width(); float realheight = container->height() - 50; float height = bound.height(); float relw = 1; if(width > 0){ relw = realwidth / width; } float relh = 1; if(height > 0){ relh = realheight / height; } float rel = relw; if(relh < relw){ rel = relh; } scale(rel,rel); }
void ImageView::zoomOut() { autoZoomFit_ = false; if(!image_.isNull()) { resetTransform(); scaleFactor_ /= 1.1; scale(scaleFactor_, scaleFactor_); queueGenerateCache(); } }
PathBlock* PathBlock::translate(float x, float y) { translation.x += x; translation.y += y; resetTransform(); return this; }
MyWindow::MyWindow() : Fl_Gl_Window(1024, 768, "Pinocchio"), flatShading(true), floor(true), skeleton(false) { size_range(20, 20, 5000, 5000); end(); resetTransform(); win = this; Fl::add_idle(idle); }
void RenderArea::openFile(QFile &svgFile) { graphicsScene->clear(); resetTransform(); QGraphicsItem *loadItem; loadItem = new QGraphicsSvgItem(svgFile.fileName()); graphicsScene->addItem(loadItem); }
void PianoKeybd::setRotation(int r) { if (r != m_rotation) { m_rotation = r; resetTransform(); rotate(m_rotation); fitInView(m_scene->sceneRect(), Qt::KeepAspectRatio); } }
QSanSelectableItem::QSanSelectableItem(bool center_as_origin) : markable(false), marked(false) { if (center_as_origin) { resetTransform(); setTransform(QTransform::fromTranslate(-_m_mainPixmap.width() / 2, -_m_mainPixmap.height() / 2), true); } _m_width = _m_height = 0; }
// Main themable function. Called for any theme change. The sprites needs to // resize and redraw here. void TextSprite::changeTheme() { // Get scaling change double scale = thememanager()->getScale(); Themable::setScale(scale); // Retrieve theme data from configuration KConfigGroup config = thememanager()->config(id()); QPoint offset = thememanager()->getOffset(); // Size double width = config.readEntry("width", 1.0); double height = config.readEntry("height", 0.0); width *= scale; height *= scale; // Position QPointF pos = config.readEntry("pos", QPointF(1.0,1.0)); pos *= scale; setPos(pos.x(), pos.y()); // z-Value double zValue = config.readEntry("zValue", 0.0); setZValue(zValue); // Text font bool bold = config.readEntry("bold", false); QFont font; font.setPixelSize(int(height)); font.setBold(bold); setFont(font); if (width < boundingRect().width()) { setTextWidth(width); } // Retrieve font color QColor fontColor; fontColor = config.readEntry("fontColor", QColor(Qt::white)); setDefaultTextColor(fontColor); // Centering bool center = config.readEntry("center", false); resetTransform(); if (center) { translate(-boundingRect().width()/2.0+offset.x(), 0.0+offset.y()); } else { translate(offset.x(),offset.y()); } update(); }
Pixmap::Pixmap(bool center_as_origin) :markable(false), marked(false) { if(center_as_origin) { resetTransform(); this->translate(-pixmap.width() / 2, -pixmap.height()/2); } _m_width = _m_height = 0; }
void ProfileGraphicsView::clear() { resetTransform(); zoomLevel = 0; if(toolTip){ scene()->removeItem(toolTip); toolTip->deleteLater(); toolTip = 0; } scene()->clear(); }
void ResizingView::recomputeScale() { // set transform resetTransform(); const qreal widthScale(0.95*qreal(viewport()->width())/qreal(scene()->width())); const qreal heightScale(qreal(viewport()->height()) / qreal(80+410*3)); computedScale = qMin(widthScale, heightScale); scale(computedScale, computedScale); wasResized = true; QTimer::singleShot(0, this, SLOT(resetResizedFlag())); }
MyWindow::MyWindow() : Fl_Gl_Window(1024, 768, "Pinocchio"), flatShading(false), floor(true), skeleton(false), drawTri(true), drawh(true), drawsph(false), drawline(false), drawskl(false), drawbefore(false), onAnimation(true) { size_range(20, 20, 5000, 5000); end(); resetTransform(); win = this; Fl::add_idle(idle); }
void Overview::zoom(int level) { m_scale_level = qBound(m_min_scale_level, level, 9); float s = ZoomSlider::scaleFactor(m_scale_level); resetTransform(); scale(s, s); Qt::ScrollBarPolicy policy = (m_scale_level > m_min_scale_level) ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff; setHorizontalScrollBarPolicy(policy); setVerticalScrollBarPolicy(policy); }
void QBlockDiagramView::wheelEvent( QWheelEvent *event ) { QGraphicsView::wheelEvent( event ); int numDegrees = event->delta() / 8; int numSteps = numDegrees / 15; m_fZoom += numSteps*0.05f; if(m_fZoom < 0.05f) m_fZoom = 0.05f; if(m_fZoom > 10.f) m_fZoom = 10.f; resetTransform (); scale(m_fZoom,m_fZoom); }
void resetCube(pScene sc,pCube cube,pMesh mesh) { resetTransform(cube->cubetr); cube->active |= C_REDO; cube->cmi[0] = mesh->xmin; cube->cmi[1] = mesh->ymin; cube->cmi[2] = mesh->zmin; cube->cma[0] = mesh->xmax; cube->cma[1] = mesh->ymax; cube->cma[2] = mesh->zmax; }
void DisplayItem::updateVisibleArea() { returnScaleToBounds(); returnLookAtToBounds(); resetTransform(); translate(0.5 * m_frame->size().width(), 0.5 * m_frame->size().height()); scale(factor(), factor()); translate(-effectiveLookAt().x(), -effectiveLookAt().y()); QRectF rect(QPointF(), m_frame->size()); setVisibleArea(matrix().inverted().mapRect(rect)); }
void ImageView::zoom(double scale) { if (m_scaleFactor == scale) return; m_autoZoomFit = false; resetTransform(); m_scaleFactor = scale; this->scale(scale, scale); queueGenerateCache(); }
void PreviewWidget::zoomTo(int zoom) { qreal z=((double)zoom/100)*((double)QDesktopWidget().screen()->width()/(screen_widthMM*10)); if (z > m_zoomMax) z = m_zoomMax; if (z < m_zoomMin) z = m_zoomMin; resetTransform(); scale(z, z); m_currentZoom = z; }
void CardItem::_initialize() { setFlag(QGraphicsItem::ItemIsMovable); m_opacityAtHome = 1.0; m_currentAnimation = NULL; _m_width = G_COMMON_LAYOUT.m_cardNormalWidth; _m_height = G_COMMON_LAYOUT.m_cardNormalHeight; _m_showFootnote = true; m_isSelected = false; _m_isUnknownGeneral = false; auto_back = true; frozen = false; resetTransform(); setTransform(QTransform::fromTranslate(-_m_width / 2, -_m_height / 2), true); }
void CardItem::_initialize() { m_opacityAtHome = 1.0; m_currentAnimation = NULL; _m_width = G_COMMON_LAYOUT.m_cardNormalWidth; _m_height = G_COMMON_LAYOUT.m_cardNormalHeight; // _m_footnoteItem = new QGraphicsPixmapItem(this); _m_showFootnote = true; m_isSelected = false; _m_isUnknownGeneral = false; auto_back = true; frozen = false; resetTransform(); this->translate(-_m_width / 2, -_m_height / 2); }