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


C++ QProgressBar::setAttribute方法代码示例

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


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

示例1: rasterRender

void RenderCommand::rasterRender(bool isPreview)
{
	ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();

	if (isPreview) {
		//Let the PreviewFxManager own the rest. Just pass him the current output node.
		PreviewFxManager::instance()->showNewPreview((TFx *)scene->getXsheet()->getFxDag()->getCurrentOutputFx());
		return;
	}

	string ext = m_fp.getType();

#ifdef WIN32
	if (ext == "avi" && !isPreview) {
		TPropertyGroup *props = scene->getProperties()->getOutputProperties()->getFileFormatProperties(ext);
		string codecName = props->getProperty(0)->getValueAsString();
		TDimension res = scene->getCurrentCamera()->getRes();
		if (!AviCodecRestrictions::canWriteMovie(toWideString(codecName), res)) {
			QString msg(QObject::tr("The resolution of the output camera does not fit with the options chosen for the output file format."));
			MsgBox(WARNING, msg);
			return;
		}
	}
#endif;

	//Extract output properties
	TOutputProperties *prop = isPreview ? scene->getProperties()->getPreviewProperties() : scene->getProperties()->getOutputProperties();

	//Build thread count
	/*-- Dedicated CPUs のコンボボックス (Single, Half, All) --*/
	int index = prop->getThreadIndex();

	const int procCount = TSystem::getProcessorCount();
	const int threadCounts[3] = {1, procCount / 2, procCount};

	int threadCount = threadCounts[index];

	/*-- MovieRendererを作る。Previewの場合はファイルパスは空 --*/
	MovieRenderer movieRenderer(scene, isPreview ? TFilePath() : m_fp, threadCount, isPreview);

	TRenderSettings rs = prop->getRenderSettings();

	//Build raster granularity size
	index = prop->getMaxTileSizeIndex();

	const int maxTileSizes[4] = {
		(std::numeric_limits<int>::max)(),
		TOutputProperties::LargeVal,
		TOutputProperties::MediumVal,
		TOutputProperties::SmallVal};
	rs.m_maxTileSize = maxTileSizes[index];

//Build

#ifdef BRAVODEMO
	rs.m_mark = loadBravo(scene->getCurrentCamera()->getRes());
#endif
	/*-- RenderSettingsをセット --*/
	movieRenderer.setRenderSettings(rs);
	/*-- カメラDPIの取得、セット --*/
	TPointD cameraDpi = isPreview ? scene->getCurrentPreviewCamera()->getDpi() : scene->getCurrentCamera()->getDpi();
	movieRenderer.setDpi(cameraDpi.x, cameraDpi.y);
	movieRenderer.enablePrecomputing(true);

	/*-- プログレス ダイアログの作成 --*/
	RenderListener *listener =
		new RenderListener(movieRenderer.getTRenderer(), m_fp, ((m_numFrames - 1) / m_step) + 1, isPreview);
	QObject::connect(listener, SIGNAL(canceled()), &movieRenderer, SLOT(onCanceled()));
	movieRenderer.addListener(listener);

	bool fieldRendering = rs.m_fieldPrevalence != TRenderSettings::NoField;

	/*-- buildSceneFxの進行状況を表示するプログレスバー --*/
	QProgressBar *buildSceneProgressBar = new QProgressBar(TApp::instance()->getMainWindow());
	buildSceneProgressBar->setAttribute(Qt::WA_DeleteOnClose);
	buildSceneProgressBar->setWindowFlags(Qt::SubWindow | Qt::Dialog | Qt::WindowStaysOnTopHint);
	buildSceneProgressBar->setMinimum(0);
	buildSceneProgressBar->setMaximum(m_numFrames - 1);
	buildSceneProgressBar->setValue(0);
	buildSceneProgressBar->move(600, 500);
	buildSceneProgressBar->setWindowTitle("Building Schematic...");
	buildSceneProgressBar->show();

	for (int i = 0; i < m_numFrames; ++i, m_r += m_stepd) {
		buildSceneProgressBar->setValue(i);

		if (rs.m_stereoscopic)
			scene->shiftCameraX(-rs.m_stereoscopicShift / 2);
		TFxPair fx;
		fx.m_frameA = buildSceneFx(scene, m_r, rs.m_shrinkX, isPreview);

		if (fieldRendering && !isPreview)
			fx.m_frameB = buildSceneFx(scene, m_r + 0.5 / m_timeStretchFactor, rs.m_shrinkX, isPreview);
		else if (rs.m_stereoscopic) {
			scene->shiftCameraX(rs.m_stereoscopicShift);
			fx.m_frameB = buildSceneFx(scene, m_r + 0.5 / m_timeStretchFactor, rs.m_shrinkX, isPreview);
			scene->shiftCameraX(-rs.m_stereoscopicShift / 2);
		} else
			fx.m_frameB = TRasterFxP();
		/*-- movieRendererにフレーム毎のFxを登録 --*/
//.........这里部分代码省略.........
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:101,代码来源:rendercommand.cpp

示例2: if

void
Progress::timerEvent(QTimerEvent * event)
{
    if (event->timerId() != timer.timerId() || noAnimations())
        return;

    //Update the registered progressbars.
    Items::iterator iter;
    QProgressBar *pb;
    bool mkProper = false;
    animationUpdate = true;
    for (iter = items.begin(); iter != items.end(); iter++)
    {
        QWidget *w = const_cast<QWidget*>(iter.key().data());
        if (!w) // not a progressbar - shouldn't be in items, btw...
            { mkProper = true; continue; }

        pb = qobject_cast<QProgressBar*>(w);
        if (!pb)
            continue; // not a progressbar - shouldn't be in items, btw...

        if (pb->maximum() != 0 || pb->minimum() != 0 || pb->paintingActive() || !pb->isVisible())
        {
            pb->setAttribute(Qt::WA_OpaquePaintEvent, false);
            continue; // no paint necessary
        }

        pb->setAttribute(Qt::WA_OpaquePaintEvent);

        ++iter.value();

        // dump pb geometry
        int x,y,l,t, *step = &iter.value()._step;
        if ( pb->orientation() == Qt::Vertical ) // swapped values
            pb->rect().getRect(&y,&x,&t,&l);
        else
            pb->rect().getRect(&x,&y,&l,&t);

        if (*step > l/_speed)
            *step = l/36-(int)(l/_speed);
        else if (*step == -1)
            *step = l/36-1;

        int s = qMin(qMax(l / 10, 16), qMin(t, 20));
        int ss = (3*s)/4;
        int n = l/s;
        if ( pb->orientation() == Qt::Vertical)
            { x = pb->rect().bottom(); x -= (l - n*s)/2 + ss; /*s = -s;*/ }
        else
            { x += (l - n*s)/2; /*s = qAbs(s);*/ }

        x += qMax((int)(_speed*qAbs(*step)*n*s/l) - s, 0);
        if ( pb->orientation() == Qt::Vertical )
            pb->repaint(y,x-s,s,3*s);
        else
            pb->repaint(x-s,y,3*s,s);
    }
    animationUpdate = false;
    if (mkProper)
        _release(NULL);
}
开发者ID:netrunner-debian-kde-extras,项目名称:bespin,代码行数:61,代码来源:aprogress.cpp


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