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


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

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


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

示例1: SLOT

void
MessageBar::show( const QString& message, const QString& id )
{    
    QLabel* label = findChild<QLabel*>( id );
    
    if (label && id.size()) {
        if (message.isEmpty())
        {
            QProgressBar* p = label->findChild<QProgressBar*>();
            if (p)
                p->setRange( 0, 1 ),
                p->setValue( 1 );
            QTimer::singleShot( 3000, label, SLOT(deleteLater()) );
        }
        else
            label->setText( message );
        return;
    }
    
    label = new QLabel( message, ui.papyrus );
    label->setBackgroundRole( QPalette::Base );
    label->setMargin( 8 );
    label->setIndent( 4 );
    label->setTextFormat( Qt::RichText );
    label->setOpenExternalLinks( true );
    label->setTextInteractionFlags( Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse );
    
    ImageButton* close = new ImageButton( ":/buckets/radio_clear_all_x.png" );
    QHBoxLayout* h = new QHBoxLayout( label );
    h->addStretch();
    
    if (id.size())
    {
        label->setObjectName( id );
        
        QProgressBar* p;
        h->addWidget( p = new QProgressBar );
        p->setRange( 0, 0 );
        p->setFixedWidth( 90 );
    }

    h->addWidget( close );
    h->setMargin( 4 );
    
    label->setFixedWidth( width() );
    label->adjustSize();
    label->show();
    
    ui.papyrus->move( 0, -label->height() );

    doLayout();
    
    connect( close, SIGNAL(clicked()), label, SLOT(deleteLater()) );    
    connect( label, SIGNAL(destroyed()), SLOT(onLabelDestroyed()), Qt::QueuedConnection );
        
    m_timeline->setFrameRange( height(), ui.papyrus->height() );
    m_timeline->start();
}
开发者ID:RJ,项目名称:lastfm-desktop,代码行数:58,代码来源:MessageBar.cpp

示例2: generateEditorWithQrmc

void MetaEditorSupportPlugin::generateEditorWithQrmc()
{
    qrmc::MetaCompiler metaCompiler(*mLogicalRepoApi, ".");

    IdList const metamodels = mLogicalRepoApi->children(Id::rootId());

    QProgressBar *progress = new QProgressBar(mMainWindowInterface->windowWidget());
    progress->show();
    int const progressBarWidth = 240;
    int const progressBarHeight = 20;

    QApplication::processEvents();
    QRect const screenRect = qApp->desktop()->availableGeometry();
    progress->move(screenRect.width() / 2 - progressBarWidth / 2, screenRect.height() / 2 - progressBarHeight / 2);
    progress->setFixedWidth(progressBarWidth);
    progress->setFixedHeight(progressBarHeight);
    progress->setRange(0, 100);

    int forEditor = 60 / metamodels.size();

    foreach (Id const &key, metamodels) {
        QString const objectType = key.element();
        if (objectType == "MetamodelDiagram" && mLogicalRepoApi->isLogicalElement(key)) {
            QString nameOfTheDirectory = mLogicalRepoApi->stringProperty(key, "name of the directory");
            QString nameOfMetamodel = mLogicalRepoApi->stringProperty(key, "name");
            QString nameOfPlugin = nameOfTheDirectory.split("/").last();

            if (QMessageBox::question(mMainWindowInterface->windowWidget()
                                      , tr("loading..")
                                      , QString(tr("Do you want to compile and load editor %1?")).arg(nameOfPlugin)
                                      , QMessageBox::Yes, QMessageBox::No)
                    == QMessageBox::No)
            {
                continue;
            }

            progress->setValue(5);

            const QString normalizedName = nameOfMetamodel.at(0).toUpper() + nameOfMetamodel.mid(1);
            const bool stateOfLoad = mMainWindowInterface->pluginLoaded(normalizedName);
            if (!mMainWindowInterface->unloadPlugin(normalizedName)) {
                progress->close();
                delete progress;
                return;
            }

            if (!metaCompiler.compile(nameOfMetamodel)) { // generating source code for all metamodels
                QMessageBox::warning(mMainWindowInterface->windowWidget()
                                     , tr("error")
                                     , tr("Cannot generate source code for editor ") + nameOfPlugin);
                continue;
            }
            progress->setValue(20);

            QStringList qmakeArgs;
            qmakeArgs.append("CONFIG+=" + mLogicalRepoApi->stringProperty(key, "buildConfiguration"));
            qmakeArgs.append(nameOfMetamodel + ".pro");

            QProcess builder;
            builder.setWorkingDirectory(nameOfTheDirectory);
            const QStringList environment = QProcess::systemEnvironment();
            builder.setEnvironment(environment);
            builder.start(SettingsManager::value("pathToQmake").toString(), qmakeArgs);

            qDebug()  << "qmake";
            if ((builder.waitForFinished()) && (builder.exitCode() == 0)) {
                progress->setValue(40);
                builder.start(SettingsManager::value("pathToMake").toString());

                bool finished = builder.waitForFinished(100000);
                qDebug()  << "make";

                if (finished && (builder.exitCode() == 0)) {
                    if (stateOfLoad) {
                        QMessageBox::warning(mMainWindowInterface->windowWidget()
                                             , tr("Attention!"), tr("Please restart QReal."));
                        progress->close();
                        delete progress;
                        return;
                    }
                    qDebug()  << "make ok";
                    progress->setValue(progress->value() + forEditor / 2);

                    if (!nameOfMetamodel.isEmpty()) {
                        if (!mMainWindowInterface->unloadPlugin(normalizedName)) {
                            QMessageBox::warning(mMainWindowInterface->windowWidget()
                                                 , tr("error")
                                                 , tr("cannot unload plugin ") + normalizedName);
                            progress->close();
                            delete progress;
                            continue;
                        }
                    }

                    QString suffix = "";
                    if (mLogicalRepoApi->stringProperty(key, "buildConfiguration") == "debug") {
                        suffix = "-d";
                    }

                    QString const generatedPluginFileName = SettingsManager::value("prefix").toString()
//.........这里部分代码省略.........
开发者ID:qreal,项目名称:qreal,代码行数:101,代码来源:metaEditorSupportPlugin.cpp

示例3: settings

MainWindow::MainWindow()
	: mUi(new Ui::MainWindowUi())
	, mListenerManager(NULL)
	, mPropertyModel(NULL)
{
	QSettings settings("SPbSU", "QReal");
	//bool showSplash = settings.value("Splashscreen", true).toBool();
	bool showSplash = false;
	QSplashScreen* splash =
			new QSplashScreen(QPixmap(":/icons/kroki3.PNG"), Qt::SplashScreen | Qt::WindowStaysOnTopHint);

	QProgressBar *progress = new QProgressBar((QWidget*) splash);
	progress->move(20,270);
	progress->setFixedWidth(600);
	progress->setFixedHeight(15);
	progress->setRange(0, 100);

	// Step 1: splash screen loaded, progress bar initialized.
	progress->setValue(5);
	if (showSplash)
	{
		splash->show();
		QApplication::processEvents();
	}
	mUi->setupUi(this);

#if defined(Q_WS_WIN)
	mUi->menuSvn->setEnabled(false);  // Doesn't work under Windows anyway.
#endif

	mUi->tabs->setTabsClosable(true);
	mUi->tabs->setMovable(true);

	if (!showSplash)
		mUi->actionShowSplash->setChecked(false);

	mUi->minimapView->setRenderHint(QPainter::Antialiasing, true);

	// Step 2: Ui is ready, splash screen shown.
	progress->setValue(20);
	mUi->actionShow_grid->setChecked(settings.value("ShowGrid", true).toBool());
	mUi->actionShow_alignment->setChecked(settings.value("ShowAlignment", true).toBool());
	mUi->actionSwitch_on_grid->setChecked(settings.value("ActivateGrid", false).toBool());
	mUi->actionSwitch_on_alignment->setChecked(settings.value("ActivateAlignment", true).toBool());

	connect(mUi->actionQuit, SIGNAL(triggered()), this, SLOT(close()));

	connect(mUi->actionShowSplash, SIGNAL(toggled(bool)), this, SLOT (toggleShowSplash(bool)));

	connect(mUi->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
	connect(mUi->actionSave, SIGNAL(triggered()), this, SLOT(saveAll()));
	connect(mUi->actionSave_as, SIGNAL(triggered()), this, SLOT(saveAs()));
	connect(mUi->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
	connect(mUi->actionMakeSvg, SIGNAL(triggered()), this, SLOT(makeSvg()));

	connect(mUi->actionDeleteFromDiagram, SIGNAL(triggered()), this, SLOT(deleteFromDiagram()));

	connect(mUi->tabs, SIGNAL(currentChanged(int)), this, SLOT(changeMiniMapSource(int)));
	connect(mUi->tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));

	connect(mUi->actionCheckout, SIGNAL(triggered()), this, SLOT(doCheckout()));
	connect(mUi->actionCommit, SIGNAL(triggered()), this, SLOT(doCommit()));
	connect(mUi->actionExport_to_XMI, SIGNAL(triggered()), this, SLOT(exportToXmi()));
	connect(mUi->actionGenerate_to_Java, SIGNAL(triggered()), this, SLOT(generateToJava()));
	connect(mUi->actionGenerate_to_Hascol, SIGNAL(triggered()), this, SLOT(generateToHascol()));
	connect(mUi->actionShape_Edit, SIGNAL(triggered()), this, SLOT(openShapeEditor()));
	connect(mUi->actionGenerate_Editor, SIGNAL(triggered()), this, SLOT(generateEditor()));
	connect(mUi->actionGenerate_Editor_qrmc, SIGNAL(triggered()), this, SLOT(generateEditorWithQRMC()));
	connect(mUi->actionParse_Editor_xml, SIGNAL(triggered()), this, SLOT(parseEditorXml()));
	connect(mUi->actionPreferences, SIGNAL(triggered()), this, SLOT(showPreferencesDialog()));

	connect(mUi->actionParse_Hascol_sources, SIGNAL(triggered()), this, SLOT(parseHascol()));
	connect(mUi->actionParse_Java_Libraries, SIGNAL(triggered()), this, SLOT(parseJavaLibraries()));

	connect(mUi->actionPlugins, SIGNAL(triggered()), this, SLOT(settingsPlugins()));
	connect(mUi->actionShow_grid, SIGNAL(toggled(bool)), this, SLOT(showGrid(bool)));
	connect(mUi->actionShow_alignment, SIGNAL(toggled(bool)), this, SLOT(showAlignment(bool)));
	connect(mUi->actionSwitch_on_grid, SIGNAL(toggled(bool)), this, SLOT(switchGrid(bool)));
	connect(mUi->actionSwitch_on_alignment, SIGNAL(toggled(bool)), this, SLOT(switchAlignment(bool)));

	connect(mUi->actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
	connect(mUi->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
	connect(mUi->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

	connect(mUi->actionShow, SIGNAL(triggered()), this, SLOT(showGestures()));

	connect(mUi->minimapZoomSlider, SIGNAL(valueChanged(int)), this, SLOT(adjustMinimapZoom(int)));

	connect(mUi->actionDebug, SIGNAL(triggered()), this, SLOT(debug()));
	connect(mUi->actionDebug_Single_step, SIGNAL(triggered()), this, SLOT(debugSingleStep()));

	connect(mUi->actionClear, SIGNAL(triggered()), this, SLOT(exterminate()));
	connect(mUi->save_metamodel, SIGNAL(triggered()), this, SLOT(saveMetaModel()));

	adjustMinimapZoom(mUi->minimapZoomSlider->value());
	initGridProperties();

	// Step 3: Ui connects are done.
	progress->setValue(40);

//.........这里部分代码省略.........
开发者ID:nfrey,项目名称:qreal,代码行数:101,代码来源:mainwindow.cpp


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