当前位置: 首页>>代码示例>>C++>>正文


C++ QRectF::setY方法代码示例

本文整理汇总了C++中QRectF::setY方法的典型用法代码示例。如果您正苦于以下问题:C++ QRectF::setY方法的具体用法?C++ QRectF::setY怎么用?C++ QRectF::setY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QRectF的用法示例。


在下文中一共展示了QRectF::setY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: paint

void RBAlbumArt::paint(QPainter *painter,
                       const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    QRectF drawArea;

    /* Making sure the alignment flags are sane */
    if(hAlign != 'c' && hAlign != 'l' && hAlign != 'r')
        hAlign = 'c';
    if(vAlign != 'c' && vAlign != 't' && vAlign != 'b')
        vAlign = 'c';

    if(artWidth <= size.width() && artHeight <= size.height())
    {
        /* If the art is smaller than the viewport, just center it up */
        drawArea.setX((size.width() - artWidth) / 2);
        drawArea.setY((size.height() - artHeight) / 2);
        drawArea.setWidth(artWidth);
        drawArea.setHeight(artHeight);
    }
    else
    {
        /* Otherwise, figure out our scale factor, and which dimension needs
         * to be scaled, and how to align said dimension
         */
        double xScale = size.width() / artWidth;
        double yScale = size.height() / artHeight;
        double scale = xScale < yScale ? xScale : yScale;

        double scaleWidth = artWidth * scale;
        double scaleHeight = artHeight * scale;

        if(hAlign == 'l')
            drawArea.setX(0);
        else if(hAlign == 'c')
            drawArea.setX((size.width() - scaleWidth) / 2 );
        else
            drawArea.setX(size.width() - scaleWidth);

        if(vAlign == 't')
            drawArea.setY(0);
        else if(vAlign == 'c')
            drawArea.setY((size.height() - scaleHeight) / 2);
        else
            drawArea.setY(size.height() - scaleHeight);

        drawArea.setWidth(scaleWidth);
        drawArea.setHeight(scaleHeight);

    }

    painter->fillRect(drawArea, texture);

    RBMovable::paint(painter, option, widget);
}
开发者ID:4nykey,项目名称:rockbox,代码行数:54,代码来源:rbalbumart.cpp

示例2: renderBubble

void Playground::renderBubble(int x, int y, GLuint color)
{
    QRectF rect;
    rect.setX(x);
    rect.setY(y);
    rect.setHeight(bubbleSize);
    rect.setWidth(bubbleSize);
    drawTexture(rect, color);
    /*glBindTexture( GL_TEXTURE_2D, color);

    glBegin( GL_QUADS );

    glTexCoord2i( 0, 0 );
    glVertex3f( x, y, 0);

    glTexCoord2i( 1, 0 );
    glVertex3f( x + bubbleSize, y, 0);

    glTexCoord2i( 1, 1 );
    glVertex3f( x + bubbleSize, y + bubbleSize, 0);

    glTexCoord2i( 0, 1 );
    glVertex3f( x, y + bubbleSize, 0);
    glEnd();*/
}
开发者ID:geckoxx,项目名称:yasg,代码行数:25,代码来源:playground.cpp

示例3: zoomSync

void PlotZoomer::zoomSync(const QRectF &rect)
{
  if (!_ignoreSync)
  {
//    if (QwtPlotZoomer *zoomer = qobject_cast<QwtPlotZoomer *>(sender()))
//    {
//      setZoomStack(zoomer->zoomStack(), zoomer->zoomRectIndex());
//    }
//    else
//    {
//      zoom(rect);
//    }
    // Adjust the zoom rect according to the zoom mode.
    QRectF adjustedRect = rect;
    switch (_zoomMode)
    {
    default:
    case ZoomBoth:
      break;
    case ZoomX:
      adjustedRect.setY(zoomRect().y());
      adjustedRect.setHeight(zoomRect().height());
      break;
    case ZoomY:
      adjustedRect.setX(zoomRect().x());
      adjustedRect.setWidth(zoomRect().width());
      break;
    }
    zoom(adjustedRect);
  }
}
开发者ID:KazNX,项目名称:ocurves,代码行数:31,代码来源:plotzoomer.cpp

示例4: boundingRect

QRectF GraphicNetNode::boundingRect() const {
	QRectF bounds;

	qreal height = icon->boundingRect().height() + (2.0 * CLOUD_Y_MARGIN);
	qreal width = icon->boundingRect().width() + (2.0 * CLOUD_X_MARGIN);

	if(addressText->isVisible()){
		width = fmax(width, addressText->boundingRect().width());
		height += addressText->boundingRect().height();
	}

	if(hostnameText->isVisible()){
		width = fmax(width, hostnameText->boundingRect().width());
		height += hostnameText->boundingRect().height();
	}

	if(secondAddrsText->isVisible()){
		width = fmax(width, secondAddrsText->boundingRect().width());
		height += secondAddrsText->boundingRect().height();
	}

	bounds.setX(0);
	bounds.setY(0);

	bounds.setWidth(width);
	bounds.setHeight(height);

	return bounds;
}
开发者ID:sevenbitbyte,项目名称:fctdev,代码行数:29,代码来源:networkgraphics.cpp

示例5: bkgnd

Queue::Queue(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Queue)
{
    ui->setupUi(this);
    QGraphicsScene *scene = new QGraphicsScene(this);
    ui->graphicsView->setScene(scene);
    QPixmap bkgnd(":files/images/bckgnd.png");
    bkgnd = bkgnd.scaled(this->size(), Qt::IgnoreAspectRatio);
    QPalette palette;
    palette.setBrush(QPalette::Background, bkgnd);
    this->setPalette(palette);
    QRectF coords;
    coords.setX(-500); coords.setY(-500);
    coords.setWidth(1000); coords.setHeight(1000);
    rPoint.setX(-500);
    rPoint.setY(-387);
    rLineCoords.setLine(-480, -387, -480, -410);
    qList = new Ui::List(ui->graphicsView, scene, coords, rPoint, rLineCoords, "Rear");

    QFont font;
    fPoint.setX(-500);
    fPoint.setY(-500);
    fLineCoords.setLine(-480, -480, -480, -460);
    fLabel = ui->graphicsView->scene()->addText("Front", font);
    fLabel->setPos(fPoint);
    fLine = ui->graphicsView->scene()->addLine(fLineCoords);
    v = new QIntValidator(0, 65535, this);
    ui->lineEdit->setValidator(v);
}
开发者ID:DaytimeAH,项目名称:DataVisualize,代码行数:30,代码来源:queue.cpp

示例6: getFormFields

static QList<FormField> getFormFields(Poppler::Page *popplerPage)
{
    QList<FormField> formFields;

//QTime t = QTime::currentTime();
    QList<Poppler::FormField*> popplerFormFields = popplerPage->formFields();
//qCritical() << t.msecsTo(QTime::currentTime());
    QSizeF popplerPageSizeF = popplerPage->pageSizeF();
    for (int i = 0; i < popplerFormFields.size(); ++i)
    {
        FormField formField;
        Poppler::FormField* popplerFormField = popplerFormFields.at(i);
        const QRectF popplerFormFieldRect = popplerFormField->rect();
        QRectF formFieldRect;
        formFieldRect.setX(popplerFormFieldRect.x() * popplerPageSizeF.width());
        formFieldRect.setY(popplerFormFieldRect.y() * popplerPageSizeF.height());
        formFieldRect.setWidth((popplerFormFieldRect.right() - popplerFormFieldRect.left()) * popplerPageSizeF.width());
        formFieldRect.setHeight((popplerFormFieldRect.bottom() - popplerFormFieldRect.top()) * popplerPageSizeF.height());
        formField.rect = formFieldRect;
//		if (popplerFormField->type() == Poppler::FormField::FormText)
//			formField.text = static_cast<Poppler::FormFieldText*>(popplerFormField)->text();
        formField.field = popplerFormField;
        formFields << formField;
    }

    return formFields;
}
开发者ID:damoguyan,项目名称:pdfviewer,代码行数:27,代码来源:pageitem.cpp

示例7: alignLegend

/*!
  Align the legend to the canvas
  \param canvasRect Geometry of the canvas
  \param legendRect Maximum geometry for the legend
  \return Geometry for the aligned legend
*/
QRectF QwtPlotLayout::alignLegend( const QRectF &canvasRect,
    const QRectF &legendRect ) const
{
    QRectF alignedRect = legendRect;

    if ( d_data->legendPos == QwtPlot::BottomLegend
        || d_data->legendPos == QwtPlot::TopLegend )
    {
        if ( d_data->layoutData.legend.hint.width() < canvasRect.width() )
        {
            alignedRect.setX( canvasRect.x() );
            alignedRect.setWidth( canvasRect.width() );
        }
    }
    else
    {
        if ( d_data->layoutData.legend.hint.height() < canvasRect.height() )
        {
            alignedRect.setY( canvasRect.y() );
            alignedRect.setHeight( canvasRect.height() );
        }
    }

    return alignedRect;
}
开发者ID:01iv3r,项目名称:OpenPilot,代码行数:31,代码来源:qwt_plot_layout.cpp

示例8: paint

void PieChart::paint(QPainter *painter)
{
    painter->setRenderHints(QPainter::Antialiasing, true);
    //Обчислення області для малювання
    QRectF fillRect = boundingRect();
    if(fillRect.height() > fillRect.width()){
        fillRect.setY(fillRect.y() + (fillRect.height()-fillRect.width())/2);
        fillRect.setHeight(fillRect.width());
    } else {
        fillRect.setX(fillRect.x() + (fillRect.width()-fillRect.height())/2);
        fillRect.setWidth(fillRect.height());
    }
    fillRect.adjust(pStrokePen->width(), pStrokePen->width(), -pStrokePen->width(),
                    -pStrokePen->width());

    //Малювання сегментів
    painter->setPen(pStrokePen->getPen());
    double beginAngle = pAngleOffset;
    double segmentAngle;
    for(PieSlice* i:slicesList){
        painter->setBrush(QBrush(i->color()));
        segmentAngle = 5760.0 * fabs(i->value())/sumSliceValue;
        painter->drawPie(fillRect, beginAngle, segmentAngle);
        beginAngle += segmentAngle;
    }
}
开发者ID:balashVI,项目名称:BVIChart,代码行数:26,代码来源:piechart.cpp

示例9: brush

void ArrowAlu3::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    QFont font = painter->font() ;

    painter->setPen(Qt::black);
    font.setPixelSize(13);
    painter->setFont(font);

    QRectF rect = boundingRect();
    rect.setX(rect.x()+22);
    rect.setY(rect.y()-4);
    rect.setHeight(15);
    rect.setWidth(100);

    painter->drawText(rect,Qt::AlignLeft," ALU 3");

    if(!this->isActive) {
        QBrush brush(QColor(150, 150, 150,255));

        painter->setPen(Qt::NoPen);
        painter->setBrush(notActiveColor);
        painter->drawPolygon(polygon());
    } else {
        QBrush brush(QColor(255, 174, 201,255));

        painter->setPen(Qt::NoPen);
        painter->setBrush(activeColor);
        painter->drawPolygon(polygon());
    }
}
开发者ID:ec-m,项目名称:processorsimulation,代码行数:30,代码来源:arrowalu3.cpp

示例10: end

bool PlotZoomer::end(bool ok)
{
  // Code here is taken from QwtPlotZoomer. The only modification is around the _zoomMode handling.
  ok = QwtPlotPicker::end(ok);
  if (!ok)
  {
    return false;
  }

  QwtPlot *plot = QwtPlotZoomer::plot();
  if (!plot)
  {
    return false;
  }

  const QPolygon &pa = selection();
  if (pa.count() < 2)
  {
    return false;
  }

  QRect rect = QRect(pa[0], pa[int(pa.count() - 1)]);
  rect = rect.normalized();

  QRectF currentZoomRect = zoomRect();
  QRectF zoomRect = invTransform(rect).normalized();

  switch (_zoomMode)
  {
  default:
  case ZoomBoth:
    // nothing.
    break;

  case ZoomX:
    // Maintain current zoom y and height.
    zoomRect.setY(currentZoomRect.y());
    zoomRect.setHeight(currentZoomRect.height());
    break;

  case ZoomY:
    // Maintain current zoom x and width.
    zoomRect.setX(currentZoomRect.x());
    zoomRect.setWidth(currentZoomRect.width());
    break;
  }

  const QSizeF minSize = minZoomSize();
  if (minSize.isValid())
  {
    const QPointF center = zoomRect.center();
    zoomRect.setSize(zoomRect.size().expandedTo(minZoomSize()));
    zoomRect.moveCenter(center);
  }

  zoom(zoomRect);

  return true;
}
开发者ID:KazNX,项目名称:ocurves,代码行数:59,代码来源:plotzoomer.cpp

示例11: GetRect

QRectF ItemLocation::GetRect() const {
    QRectF result;
    result.setX(MINIMAP_SIZE * x_ / INVENTORY_SLOTS);
    result.setY(MINIMAP_SIZE * y_ / INVENTORY_SLOTS);
    result.setWidth(MINIMAP_SIZE * w_ / INVENTORY_SLOTS);
    result.setHeight(MINIMAP_SIZE * h_ / INVENTORY_SLOTS);
    return result;
}
开发者ID:Flomeni,项目名称:acquisition,代码行数:8,代码来源:itemlocation.cpp

示例12: setY

void RectF::setY(qreal y)
{
	QRectF s = value().toRectF();
	qreal h = s.height();
	s.setY(y);
	s.setHeight(h);
	setValue(s);
}
开发者ID:Energid,项目名称:propertyeditor,代码行数:8,代码来源:rectf.cpp

示例13: context

KoFilterEffectStack * FilterEffectResource::toFilterStack() const
{
    KoFilterEffectStack * filterStack = new KoFilterEffectStack();
    if (!filterStack)
        return 0;

    QByteArray data = m_data.toByteArray();
    KoXmlDocument doc;
    doc.setContent(data);
    KoXmlElement e = doc.documentElement();

    // only allow obect bounding box units
    if (e.hasAttribute("filterUnits") && e.attribute("filterUnits") != "objectBoundingBox")
        return 0;

    if (e.attribute("primitiveUnits") != "objectBoundingBox")
        return 0;

    // parse filter region rectangle
    QRectF filterRegion;
    filterRegion.setX(fromPercentage(e.attribute("x", "-0.1")));
    filterRegion.setY(fromPercentage(e.attribute("y", "-0.1")));
    filterRegion.setWidth(fromPercentage(e.attribute("width", "1.2")));
    filterRegion.setHeight(fromPercentage(e.attribute("height", "1.2")));
    filterStack->setClipRect(filterRegion);

    KoFilterEffectLoadingContext context(QString(""));

    KoFilterEffectRegistry * registry = KoFilterEffectRegistry::instance();

    // create the filter effects and add them to the shape
    for (KoXmlNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) {
        KoXmlElement primitive = n.toElement();
        KoFilterEffect * filterEffect = registry->createFilterEffectFromXml(primitive, context);
        if (!filterEffect) {
            qWarning() << "filter effect" << primitive.tagName() << "is not implemented yet";
            continue;
        }

        // parse subregion
        qreal x = fromPercentage(primitive.attribute("x", "0"));
        qreal y = fromPercentage(primitive.attribute("y", "0"));
        qreal w = fromPercentage(primitive.attribute("width", "1"));
        qreal h = fromPercentage(primitive.attribute("height", "1"));
        QRectF subRegion(QPointF(x, y), QSizeF(w, h));

        if (primitive.hasAttribute("in"))
            filterEffect->setInput(0, primitive.attribute("in"));
        if (primitive.hasAttribute("result"))
            filterEffect->setOutput(primitive.attribute("result"));

        filterEffect->setFilterRect(subRegion);

        filterStack->appendFilterEffect(filterEffect);
    }

    return filterStack;
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:58,代码来源:FilterEffectResource.cpp

示例14: setSizeScene

void GameManager::setSizeScene(qreal w, qreal h)
{
	QRectF sRect;
	sRect.setX((w / 2) * (-1));
	sRect.setY((h / 2) * (-1));
	sRect.setWidth(w);
	sRect.setHeight(h);
	scene->setSceneRect(sRect);
}
开发者ID:Horsmir,项目名称:frog,代码行数:9,代码来源:gamemanager.cpp

示例15: boundingRect

QRectF Sprite::boundingRect() const
{
    QRectF t;
    t.setX(this->pos().x());
    t.setY(this->pos().y());
    t.setWidth(stateBox[currState]->getPixmap().rect().width());
    t.setHeight(stateBox[currState]->getPixmap().rect().height());
    return t;
}
开发者ID:qwertylevel3,项目名称:WorldCreator,代码行数:9,代码来源:sprite.cpp


注:本文中的QRectF::setY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。