void TemporalScenarioView::movedAsked(const QPointF& p) { QRectF r = QRectF{m_previousPoint.x(), m_previousPoint.y() , 1, 1}; ensureVisible(mapRectFromScene(r), 30, 30); emit moved(p); m_previousPoint = p; // we use the last pos, because if not there's a larsen and crash }
void DesktopSelectionRectangle::setCoordinates(int x, int y, int width, int height) { x_ = x; y_ = y; width_ = width; height_ = height; setRect(mapRectFromScene(x_-PEN_WIDTH/2, y_-PEN_WIDTH/2, width_+PEN_WIDTH, height_+PEN_WIDTH)); }
void ContentWindowGraphicsItem::setSize(double w, double h, ContentWindowInterface * source) { ContentWindowInterface::setSize(w, h, source); if(source != this) { setPos(x_, y_); setRect(mapRectFromScene(x_, y_, w_, h_)); } }
void ContentWindowGraphicsItem::setPosition(double x, double y, ContentWindowInterface * source) { ContentWindowInterface::setPosition(x, y, source); if(source != this) { setPos(x_, y_); setRect(mapRectFromScene(x_, y_, w_, h_)); } }
void Highlight::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { QColor pen_color = pen.color(); painter->setPen(pen); if(time < total_time ){ //don't want to keep adding them past animation length int expected_num_rings = (int)ceil(frequency * time); if( expected_num_rings > rings.length()){ rings.append(time); } //velocity= 200.0 - (time*total_time*2.0);//pretty cool //velocity= 200.0*(1.0-done_ratio);//pretty cool, about the same //frequency = 3.0*(1.0-done_ratio);//pretty cool for(int i=0; i<rings.length(); i++){ //qreal dist = diameter + ( velocity * (time - rings.at(i))); qreal t = (time - rings.at(i)); qreal dist = diameter + ( velocity * t ) + (0.5 * -5.0 * t*t); //qDebug() << "dist:" << dist << " outerDiameter:" << outerDiameter; QRectF s(x()-dist/2.0, y()-dist/2.0,dist,dist); QRectF r = mapRectFromScene(x()-dist/2.0, y()-dist/2.0,dist,dist); pen.setWidth(20.0+50.0* dist/outerDiameter); QRadialGradient radialGrad; radialGrad.setCenter(r.center()); radialGrad.setFocalPoint(r.center()); radialGrad.setCenterRadius(r.width()/2.0+pen.widthF()/2.0); radialGrad.setFocalRadius(r.width()/2.0-pen.widthF()/2.0); /* not entirely sure I get it, but I think focal radius * needs to be either the center of the pen or its inner edge * while center radius is the outer edge. */ QColor green(0,255,0,255); QColor yellow(255,255,0,255); /* pen_color.setAlphaF(1.0-(dist/outerDiameter)); //surface waves don't inverse square */ green.setAlphaF(1.0-(dist/outerDiameter)); yellow.setAlphaF((1.0-(dist/outerDiameter))); radialGrad.setColorAt(.0, yellow ); radialGrad.setColorAt( .5, green ); radialGrad.setColorAt(1, yellow ); brush = QBrush(radialGrad); pen.setBrush(brush); painter->setPen(pen); painter->drawEllipse(r); } } }
void MozQWidget::NotifyVKB(const QRect& rect) { QRegion region(scene()->views()[0]->rect()); region -= rect; QRectF bounds = mapRectFromScene(region.boundingRect()); nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); if (observerService) { QString rect = QString("{\"left\": %1, \"top\": %2, \"right\": %3, \"bottom\": %4}") .arg(bounds.x()).arg(bounds.y()).arg(bounds.width()).arg(bounds.height()); observerService->NotifyObservers(nsnull, "softkb-change", rect.utf16()); } }
QRectF KeyLabel::boundingRect() const { PianoKey* key = static_cast<PianoKey*>(parentItem()); return mapRectFromScene(key->rect()); }
QRectF Highlight::boundingRect() const { return mapRectFromScene(x()-((outerDiameter)/2.0),y()-((outerDiameter)/2.0) , outerDiameter, outerDiameter); //this->advance(); }