• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sceneRect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sceneRect函数的典型用法代码示例。如果您正苦于以下问题:C++ sceneRect函数的具体用法?C++ sceneRect怎么用?C++ sceneRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: QFontMetrics

void eScopesScene::drawForeground(QPainter *painter, const QRectF &rect)
{
	QGraphicsScene::drawForeground(painter, rect);

	QFont fwFont = painter->font();
    m_rowTextWidth = QFontMetrics(fwFont).width("0000");
    const eU32 fwHeight = QFontMetrics(fwFont).height();
    m_headerHeight = 2+2*fwHeight;

	tfSong *song = m_seqView->getSong();
	if (!song)
		return;

    for (eU32 i=0; i<tfSong::MAX_SEQ_TRACKS; i++)
    {
        if (song->getMuted(i))
        {
            painter->setPen(Qt::black);
            painter->fillRect(
                i*TRACK_WIDTH+m_rowTextWidth+2, 
                sceneRect().top()+m_headerHeight, 
                TRACK_WIDTH, 
                sceneRect().bottom()-m_headerHeight, 
                Qt::Dense4Pattern);
        }
    }

	
}
开发者ID:DX94,项目名称:Enigma-Studio-3,代码行数:29,代码来源:scopesview.cpp


示例2: sceneRect

void GameScene::processViewSizeChange(const QSize &newSize)
{
    viewSize = newSize;
    
    qreal newRatio = ((qreal) newSize.width()) / newSize.height();
    qreal minWidth = 0;
    QList<qreal> minWidthByColumn;
    for (int col = 0; col < playersByColumn.size(); ++col) {
        minWidthByColumn.append(0);
        for (int row = 0; row < playersByColumn[col].size(); ++row) {
            qreal w = playersByColumn[col][row]->getMinimumWidth();
            if (w > minWidthByColumn[col])
                minWidthByColumn[col] = w;
        }
        minWidth += minWidthByColumn[col];
    }
    minWidth += phasesToolbar->getWidth();
    
    qreal minRatio = minWidth / sceneRect().height();
    qreal newWidth;
    if (minRatio > newRatio) {
        // Aspect ratio is dominated by table width.
        newWidth = minWidth;
    } else {
        // Aspect ratio is dominated by window dimensions.
        newWidth = newRatio * sceneRect().height();
    }
    setSceneRect(0, 0, newWidth, sceneRect().height());

    qreal extraWidthPerColumn = (newWidth - minWidth) / playersByColumn.size();
    for (int col = 0; col < playersByColumn.size(); ++col)
        for (int row = 0; row < playersByColumn[col].size(); ++row)
            playersByColumn[col][row]->processSceneSizeChange(minWidthByColumn[col] + extraWidthPerColumn);
}
开发者ID:Akira586,项目名称:Cockatrice,代码行数:34,代码来源:gamescene.cpp


示例3: Q_ASSERT

void GameScene::spawnPlayer()
{
    Q_ASSERT(!m_player);

    addItem(m_player = new GraphicsPlayerObject(PLAYER_HEALTH));

    const auto playerSize = m_player->boundingRect().size();
    QPointF pos{
        sceneRect().width() / 2 - playerSize.width() / 2,
        sceneRect().height()/* - playerSize.height()*/,
    };
    m_player->setPos(pos);
    m_hudObject->setHealth(m_player->health());
    addItem(m_player);
    connect(m_player, &GraphicsPlayerObject::cannonTriggered, this,
        &GameScene::planeShot);
    connect(m_player, &GraphicsPlayerObject::exploded, this,
        &GameScene::planeExploded);
    connect(m_player, &GraphicsPlayerObject::damaged, m_hudObject,
        &GraphicsHudObject::addScore);
    connect(m_player, &GraphicsPlayerObject::damaged, m_hudObject,
        &GraphicsHudObject::setHealth);
    connect(m_player, &GraphicsPlayerObject::exploded, m_hudObject,
        &GraphicsHudObject::playerDeath);
    setFocusItem(m_player);
}
开发者ID:jsfdez,项目名称:1942,代码行数:26,代码来源:gamescene.cpp


示例4: sceneRect

void CSharedPainterScene::drawBackgroundImage( boost::shared_ptr<CBackgroundImageItem> image )
{
	backgroundImageItem_ = image;

	if( image )
	{
		backgroundPixmap_ = image->createPixmap();

		int newSceneW = sceneRect().width();
		int newSceneH = sceneRect().height();

		QSize size = backgroundPixmap_.size();
		if( newSceneW < size.width() )
			newSceneW = size.width();
		if( newSceneH < size.height() )
			newSceneH = size.height();
		setSceneRect( 0, 0, newSceneW, newSceneH );
	}
	else
	{
		clearBackgroundImage();
		return;
	}

	resetBackground( sceneRect () );
}
开发者ID:gunoodaddy,项目名称:SharedPainter,代码行数:26,代码来源:SharedPainterScene.cpp


示例5: sceneRect

void PaintScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    qreal widthScene = sceneRect().width();
    qreal sceneHeight = sceneRect().height();
    QImage image(widthScene, sceneHeight,QImage::Format_RGB32);
    //image.fill(Qt::white);
    QPainter painter(&image);
    painter.setRenderHint(QPainter::Antialiasing);
    render(&painter);

    QPoint newPos;
    newPos.setX(event->scenePos().x());
    newPos.setY(event->scenePos().y());

    QPen pen;
    pen.setWidth(brushWidth());
    pen.setColor(brushColor());
    painter.setPen(pen);
    QString type("Pencil");
    QRect rect = drawRect(type, painter, m_oldPos, newPos);
    m_oldPos = newPos;

    QBrush br(image);
    br.setColor(Qt::transparent);
    setBackgroundBrush(br);

    update();
    QGraphicsScene::mouseMoveEvent(event);
}
开发者ID:4js-qtguys,项目名称:android,代码行数:29,代码来源:PaintScene.cpp


示例6: sceneRect

void ReportRectEntity::mousePressEvent(QGraphicsSceneMouseEvent * event)
{
    //Update and show properties
    m_ppos->setScenePos(QPointF(sceneRect().x(), sceneRect().y()));
    m_reportDesigner->changeSet(m_pset);
    setSelected(true);
    scene()->update();
}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:8,代码来源:reportrectentity.cpp


示例7: expander

void GraphDrawingScene::expandSceneRect(const QPoint& position)
{
    // start by creating a rectangle around the position that has been passed
    QRect expander(position.x() - 250, position.y() - 250, 500, 500);
    // calculate the bounding rectangle of what we already have and what we wan to add
    setSceneRect(sceneRect().united(expander));
    dynamic_cast<GraphDrawingView*>(parent())->setSceneRect(sceneRect());
}
开发者ID:jvaelen,项目名称:graph_toolkit,代码行数:8,代码来源:graphdrawingscene.cpp


示例8: setSceneRect

 void MessageView::setWidth(int width)
 {
     setSceneRect(sceneRect().x(), sceneRect().y(), width, sceneRect().height());
     QListIterator<YawnerNS::UiNS::ViewNS::MessageViewNS::MessageItem*> it(_messagesItems);
     while (it.hasNext()) {
         it.next()->setWidth(width - std::min(4, verticalScrollBar()->width()));
     }
     layoutItems(&_messagesItems);
 }
开发者ID:henkelund,项目名称:Yawner,代码行数:9,代码来源:MessageView.cpp


示例9: connect

void SinglePlayerView::hideMsg()
{
	connect( msgtline, SIGNAL( finished() ), this, SLOT( cleanUpMsg() ) );
	msganimation->setPosAt( 0, sceneRect().center() - msg->boundingRect().center() );
	msganimation->setScaleAt( 0, 1, 1 );
	msganimation->setPosAt( 1, QPointF( sceneRect().center().x(), sceneRect().bottomRight().y() ) );
	msganimation->setScaleAt( 1, 0.01, 0.01 );
	msgtline->start();
}
开发者ID:rockdreamer,项目名称:tarta,代码行数:9,代码来源:singleplayerview.cpp


示例10: sig_viewportScrolled

void MapView::scrollContentsBy(int dx, int dy)
{
	QGraphicsView::scrollContentsBy( dx, dy );
	
	emit sig_viewportScrolled(
	std::max(0.0, (double)mapToScene(rect()).boundingRect().x() / (double)sceneRect().width()),
	std::max(0.0, (double)mapToScene(rect()).boundingRect().y() / (double)sceneRect().height()));
	
}
开发者ID:q4a,项目名称:attal,代码行数:9,代码来源:mapView.cpp


示例11: pixmap

void GraphicsScene::printPage(int index, int percentual , QPainter &painter, QPrinter * printer)
{
  
    QPixmap pixmap(painter.viewport().width(),painter.viewport().height());   /* virtual paper */
    bool portrait = printer->orientation() == QPrinter::Portrait ? true : false;
    
    const qreal wit = qMin(printer->pageRect().width(),printer->paperRect().width());
	  const qreal hei = qMin(printer->pageRect().height(),printer->paperRect().height());
    const qreal faktor_print = qMax(wit,hei) / qMin(wit,hei);
    
    const QRect Paper_Rect = printer->pageRect();   
    qreal onepagescene_HI = sceneRect().width() * faktor_print;
    if (!portrait) {
    onepagescene_HI = sceneRect().width() / faktor_print;
    } 
    
    QRectF rectScenePiece = QRectF (0.,0.,sceneRect().width(),onepagescene_HI); /* first slice from scene */
    
    const qreal page = sceneRect().height() / onepagescene_HI;   /* page need */
	  int PageSumm = page;
    
	    if (page > PageSumm) {
			 PageSumm++;   /* float to next int */
			}
      
    if ( index > PageSumm ) {
    return;   /* not having this page */
    }
    
    qreal InitOnYtop = 0;
    
    if (index != 0) {
          InitOnYtop = rectScenePiece.height() * index;
    }
    QRect pagepiece = QRect(0,InitOnYtop,rectScenePiece.width(),rectScenePiece.height());
    //////////qDebug() << "### page  " << index << "," << percentual << "," << printer->pageRect();
    const qreal smallpart = qMax(pixmap.width(),pixmap.height()) / faktor_print;
    
    QRectF AFormatPaper;
    /* Paper dimension from printer Faktor run */
    if (portrait) {
    AFormatPaper = QRect(0,0,smallpart,qMax(pixmap.width(),pixmap.height()));
    } else {
    AFormatPaper = QRect(0,0,qMax(pixmap.width(),pixmap.height()),smallpart);    
    }
    
    
    QRectF ZoomFaktorPage = Reduce(AFormatPaper,percentual);   /* zoom rect */
    QRect WhitePaper = CenterRectSlaveFromMaster(pixmap.rect(),AFormatPaper).toRect(); 
    QRect RenderPage = CenterRectSlaveFromMaster(pixmap.rect(),ZoomFaktorPage).toRect(); 
    
    painter.fillRect(painter.viewport(),QBrush(Qt::lightGray));  /* device to cover */
    painter.fillRect(WhitePaper,QBrush(Qt::white));   /* paper */
    /////////painter.fillRect(RenderPage,QBrush(Qt::red));   /* page result */
    render(&painter,RenderPage,pagepiece,Qt::KeepAspectRatio);
}
开发者ID:SorinS,项目名称:fop-miniscribus,代码行数:56,代码来源:GraphicsScene.cpp


示例12: tr

void OpenInfraPlatform::UserInterface::Alignment2DScene::exportToFile(QWidget* parent)
{
	QString filter;
	QString fn = QFileDialog::getSaveFileName(parent, tr("Save Vertical Alignment as..."), QString(), tr("PNG File (*.png);; JPG File (*.jpg);; PDF File (*.pdf);; SVG File (*.svg)"), &filter);
	if(fn.isEmpty())
		return;

	if(filter == "PNG File (*.png)" || filter == "JPG File (*.jpg)")
	{
		QImage image(sceneRect().size().toSize(), QImage::Format::Format_ARGB32);
		image.fill(Qt::darkGray);

		QPainter painter(&image);
		painter.setRenderHints(QPainter::Antialiasing);
		render(&painter);
		image.save(fn);
	}
	else
	{
		QPrinter printer;
		QSvgGenerator svgGen;

		QPaintDevice* device;
		if(filter == "PDF File (*.pdf)")
		{
			printer.setResolution(QPrinter::HighResolution);
			printer.setPageSize( QPrinter::A4 );
			printer.setOrientation( QPrinter::Landscape );
			printer.setOutputFormat( QPrinter::PdfFormat );
			printer.setOutputFileName(fn);

			device = &printer;
		}
		else if(filter == "SVG File (*.svg)")
		{
			QRectF rect = sceneRect(); 

			svgGen.setFileName(fn);
			svgGen.setSize(QSize(rect.width(),rect.height()));
			svgGen.setViewBox(QRect(0,0,rect.width(),rect.height()));
			svgGen.setTitle("Vertical Alignment");			
			
			device = &svgGen;
		}
		else
		{
			return;
		}

		QPainter painter(device);

		configureColors(A2D_DrawState::A2D_Print);
		render(&painter);
		configureColors(A2D_DrawState::A2D_Draw);
	}
}
开发者ID:bigdoods,项目名称:OpenInfraPlatform,代码行数:56,代码来源:Alignment2DScene.cpp


示例13: fm

void
AnimatorScene::setSceneInfoText(QString text, bool show)
{
    m_sceneInfoText->setText (text);
    m_sceneInfoText->setVisible (show);
    QFontMetrics fm (font ());
    QRectF r = sceneRect ();
    QPointF pos = QPointF ((sceneRect ().width () - fm.width (text))/2, r.center ().y ());
    m_sceneInfoText->setPos (pos);
}
开发者ID:apanda,项目名称:pilo-ns3,代码行数:10,代码来源:animatorscene.cpp


示例14: setSceneRect

void Tchart::ajustChartHeight() {
	qreal factor = (viewport()->rect().height() / scene->sceneRect().height()) * 0.95;
	if (viewport()->rect().width() > (scene->sceneRect().width() + qAbs(sceneRect().x())) * factor) {
		setSceneRect(0, 0, viewport()->rect().width() / factor, scene->sceneRect().height());
	}	else {
    setSceneRect(sceneRect().adjusted(-sceneRect().x(), 0, qAbs(sceneRect().x()), 0));
	}
	scale(factor, factor);
	horizontalScrollBar()->setValue(horizontalScrollBar()->minimum());
}
开发者ID:SeeLook,项目名称:nootka,代码行数:10,代码来源:tchart.cpp


示例15: backgroundBrush

void FormEditorGraphicsView::drawBackground(QPainter *painter, const QRectF &rect)
{
    painter->save();
    painter->setBrushOrigin(0, 0);
    painter->fillRect(rect.intersected(sceneRect()), backgroundBrush());
    // paint rect around editable area
    painter->setPen(Qt::black);
    QRectF frameRect = sceneRect().adjusted(0, 0, 0, 0);
    painter->drawRect(frameRect);
    painter->restore();
}
开发者ID:TheProjecter,项目名称:project-qtcreator,代码行数:11,代码来源:formeditorgraphicsview.cpp


示例16: QSizeF

void TrackInfo::plot(QPainter *painter, const QRectF &target)
{
	qreal ratio = painter->paintEngine()->paintDevice()->logicalDpiX()
	  / SCREEN_DPI;
	QSizeF canvas = QSizeF(target.width() / ratio, target.height() / ratio);
	QSizeF diff = QSizeF(qAbs(canvas.width() - sceneRect().width()),
	  qAbs(canvas.height() - sceneRect().height()));
	QRectF adj = sceneRect().adjusted(0, -diff.height()/2, diff.width(),
	  diff.height()/2);

	render(painter, target, adj);
}
开发者ID:tumic0,项目名称:GPXSee,代码行数:12,代码来源:trackinfo.cpp


示例17: sceneRect

void ObjectGroup::move(int x, int y)
{
    QRect prevSceneRect = sceneRect();
    int difX, difY;
    Object::move(x, y);

    difX = sceneRect().topLeft().x() - prevSceneRect.topLeft().x();
    difY = sceneRect().topLeft().y() - prevSceneRect.topLeft().y();

    for(int i=mObjects.size()-1; i >=0; --i) {
        mObjects[i]->move( mObjects[i]->x()+difX,  mObjects[i]->y()+difY);
    }
}
开发者ID:vcarluer,项目名称:Belle,代码行数:13,代码来源:objectgroup.cpp


示例18: scene

void chatGraphicsView::addMessage(const QString& user, const QString& message)
{
    if(m_scene)
        m_scene->addMessage(user, message);

    QRectF rect = scene()->sceneRect();
    rect.adjust(-4, -4, 4, 4);
    setSceneRect(rect);

    rect = sceneRect();
    rect.setTop(sceneRect().height() - 20);
    rect.setWidth(20);
    ensureVisible(rect, 50, 50);
}
开发者ID:berndhs,项目名称:qxmpp,代码行数:14,代码来源:chatGraphicsView.cpp


示例19: sceneRect

void SnapshotCanvas::adjustMaximumSize()
{
    QRectF sr = sceneRect();

    int width = sr.width() + frameWidth() * 2;
    int height = sr.height() + frameWidth() * 2;

    if (minimumWidth() > width) {
        width = minimumWidth();
    }

    if (minimumHeight() > height) {
        height = minimumHeight();
    }

    int scrollBarExtent = style()->pixelMetric(QStyle::PM_ScrollBarExtent);

    if (verticalScrollBar()->isVisible()) {
        width += scrollBarExtent + frameWidth() * 2;
    }

    if (horizontalScrollBar()->isVisible()) {
        height += scrollBarExtent + frameWidth() * 2;
    }

    setMaximumSize(width, height);
}
开发者ID:benklop,项目名称:kaption,代码行数:27,代码来源:snapshotcanvas.cpp


示例20: setSceneRect

void DisplayGroupGraphicsView::resizeEvent( QResizeEvent * resizeEvt )
{
    // compute the scene rectangle to show such that the aspect ratio
    // corresponds to the actual aspect ratio of the tiled display
    const float tiledDisplayAspect = g_configuration->getAspectRatio();
    const float windowAspect = (float)width() / (float)height();

    float sceneWidth, sceneHeight;

    if( tiledDisplayAspect >= windowAspect )
    {
        sceneWidth = 1.;
        sceneHeight = tiledDisplayAspect / windowAspect;
    }
    else // tiledDisplayAspect < windowAspect
    {
        sceneHeight = 1.;
        sceneWidth = windowAspect / tiledDisplayAspect;
    }

    // make sure we have a small buffer around the (0,0,1,1) scene rectangle
    float border = 0.05;

    sceneWidth = std::max( sceneWidth, (float)1. + border );
    sceneHeight = std::max( sceneHeight, (float)1. + border );

    setSceneRect( -(sceneWidth - 1.)/2., -(sceneHeight - 1.)/2.,
                  sceneWidth, sceneHeight );

    fitInView(sceneRect());

    QGraphicsView::resizeEvent(resizeEvt);
}
开发者ID:holstgr-kaust,项目名称:DisplayCluster,代码行数:33,代码来源:DisplayGroupGraphicsView.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ scf_error函数代码示例发布时间:2022-05-30
下一篇:
C++ scenePos函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap