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


C++ QProgressBar类代码示例

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


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

示例1: QProgressBar

	QProgressBar* StatusBar::createProgressBar()
	{
		QProgressBar* pb = new QProgressBar(this);
		pb->setMaximumHeight(height());
		addPermanentWidget(pb);
		return pb;
	}
开发者ID:ashl1,项目名称:ktorrent-stream,代码行数:7,代码来源:statusbar.cpp

示例2: finTelechargement

void TelechargerFichier::finTelechargement()
{
	QNetworkReply *reponse;
		reponse = qobject_cast<QNetworkReply *>(sender());

	QPushButton *bouton = qobject_cast<QPushButton *>(listeTelechargements->cellWidget(reponses.indexOf(reponse), 0));
		bouton->setDisabled(true);

	QProgressBar *progression = progressionsTelechargements.value(reponses.indexOf(reponse));
		progression->setMaximum(100);
		progression->setValue(100);

	listeTelechargements->item(reponses.indexOf(reponse), 3)->setText("Transfert terminé");

	QString nomFichier = nomsFichiers.value(reponses.indexOf(reponse));

	QSettings emplacementDossier(Multiuso::appDirPath() + "/ini/config.ini", QSettings::IniFormat);

	QDir dir;
		dir.mkpath(emplacementDossier.value("telechargements/dossier").toString() + "/Multiuso - Téléchargements");

	QFile fichier(emplacementDossier.value("telechargements/dossier").toString() + "/Multiuso - Téléchargements/" + nomFichier);
		fichier.open(QIODevice::WriteOnly | QIODevice::Truncate);
		fichier.write(reponse->readAll());
		fichier.close();
}
开发者ID:qrichert,项目名称:Multiuso,代码行数:26,代码来源:TelechargerFichier.cpp

示例3: QTreeWidgetItem

void K3b::ImageWritingDialog::calculateMd5Sum( const QString& file )
{
    d->haveMd5Sum = false;

    if( !d->md5SumItem ) {
        d->md5SumItem = new QTreeWidgetItem( d->infoView );
    }

    d->md5SumItem->setText( 0, i18n("MD5 Sum:") );
    d->md5SumItem->setForeground( 0, d->infoTextColor );
    d->md5SumItem->setTextAlignment( 0, Qt::AlignRight );

    if( file != d->lastCheckedFile ) {

        QProgressBar* progress = new QProgressBar( d->infoView );
        progress->setMaximumHeight( fontMetrics().height() );
        progress->setRange( 0, 100 );
        progress->setValue( 0 );
        d->infoView->setItemWidget( d->md5SumItem, 1, progress );
        d->lastCheckedFile = file;
        d->md5Job->setFile( file );
        d->md5Job->start();
    }
    else
        slotMd5JobFinished( true );
}
开发者ID:franhaufer,项目名称:k3b,代码行数:26,代码来源:k3bimagewritingdialog.cpp

示例4: QTableWidgetItem

void MainWindow::addRow( int fileId, const QString &fileName, int progress )
{
    int rowId = ui->files->rowCount();

    ui->files->insertRow( rowId );
    QTableWidgetItem *id = new QTableWidgetItem( QString::number(fileId) );
    QTableWidgetItem *fn = new QTableWidgetItem( fileName );

    QWidget          *wt = new QWidget();
    QSpacerItem      *s1 = new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding );
    QSpacerItem      *s2 = new QSpacerItem(1, 7, QSizePolicy::Fixed, QSizePolicy::Expanding );
    QVBoxLayout      *lt = new QVBoxLayout( wt );
    QProgressBar     *pb = new QProgressBar( wt );
    pb->setObjectName( "PROGRESS_BAR" );
    pb->setParent( this );
    pb->setValue( progress );
    pb->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

    lt->addSpacerItem( s1 );
    lt->addWidget( pb );
    lt->addSpacerItem( s2 );

    lt->setMargin( 0 );
    wt->setLayout( lt );

    ui->files->setItem( rowId,       0, id );
    ui->files->setItem( rowId,       1, fn );
    ui->files->setCellWidget( rowId, 2, wt );
}
开发者ID:Jille,项目名称:FBP,代码行数:29,代码来源:mainwindow.cpp

示例5: qDebug

void Progression::onRemoveLabel(QString name)
{
	qDebug() << "trying to remove label and progress bar for :" << name;
	for(int i = 0; i < vbl->count(); i++)
	{
		QLayoutItem* item = vbl->itemAt(i);
		QWidget* widget = item->widget();
		if (widget) {
			QLabel *label = qobject_cast<QLabel *>(widget);

			if(label and label->objectName() == name )
			{
				label->hide();
				vbl->removeItem(item);
				qDebug() << "Remove Label";
				i--;
			}

			QProgressBar * pb = qobject_cast<QProgressBar *>(widget);
			if(pb and pb->objectName() == name)
			{
				pb->hide();
				vbl->removeItem(item);
				qDebug() << "Remove Progbar";
				i--;
			}

		}
	}
	this->adjustSize();
}
开发者ID:ThomasAy,项目名称:Duplicateur,代码行数:31,代码来源:Progression.cpp

示例6: main

int main(int argc, char ** argv) {
    using Q = QObject;
    QApplication app{argc, argv};
    QWidget ui;
    QVBoxLayout layout{&ui};
    QTextBrowser log;
    QProgressBar bar;
    QPushButton scan{"Scan localhost"};
    layout.addWidget(&log);
    layout.addWidget(&bar);
    layout.addWidget(&scan);
    bar.setRange(1, 65535);
    ui.show();

    Scanner scanner;
    Q::connect(&scan, &QPushButton::clicked, &scanner, [&]{
        scan.setEnabled(false);
        scanner.start();
    });
    Q::connect(&scanner, &Scanner::hasResult, &log, [&](int port, bool isOpen){
        bar.setValue(port);
        if (!isOpen) return;
        auto color = isOpen ? QStringLiteral("green") : QStringLiteral("red");
        auto state = isOpen ? QStringLiteral("open") : QStringLiteral("closed");
        log.append(QStringLiteral("<font color=\"%1\">Port %2 is %3.</font><br/>").
                   arg(color).arg(port).arg(state));
    });
    Q::connect(&scanner, &Scanner::done, &scan, [&]{
        bar.reset();
        scan.setEnabled(true);
    });
    return app.exec();
}
开发者ID:KubaO,项目名称:stackoverflown,代码行数:33,代码来源:main.cpp

示例7: isWidgetVisible

void UIStateHelper::updateData(UIStateHelperData *data)
{
	QMap<QWidget*, UIStates>::iterator it;
	for (it = data->mWidgets.begin(); it != data->mWidgets.end(); ++it) {
		QWidget *widget = it.key();
		UIStates states = it.value();

		if (states & (UISTATE_LOADING_VISIBLE | UISTATE_LOADING_INVISIBLE | UISTATE_ACTIVE_VISIBLE | UISTATE_ACTIVE_INVISIBLE)) {
			bool visible = isWidgetVisible(widget);
			widget->setVisible(visible);

			if (!visible) {
				/* Reset progressbar */
				QProgressBar *progressBar = dynamic_cast<QProgressBar*>(widget);
				if (progressBar) {
					progressBar->setValue(0);
				}
			}
		}

		if (states & (UISTATE_LOADING_ENABLED | UISTATE_LOADING_DISABLED | UISTATE_ACTIVE_ENABLED | UISTATE_ACTIVE_DISABLED)) {
			widget->setEnabled(isWidgetEnabled(widget));
		}
	}
}
开发者ID:MrKID,项目名称:RetroShare,代码行数:25,代码来源:UIStateHelper.cpp

示例8: QLabel

void MangaW::LookingForDB(void)
{
	QWidget * loadingWidget = new QWidget;
	QVBoxLayout * loadingLayout = new QVBoxLayout; // Layout Vertical Box
	QLabel * loadingTexte = new QLabel("Restauration des sauvegardes"); // Label = Texte
	QProgressBar * loadingProgressBar = new QProgressBar; // Barre de progression
	
	loadingProgressBar->setRange(0, 0); // ProgressBar en "chargement indéfini"
	
	loadingLayout->addWidget(loadingTexte);
	loadingLayout->addWidget(loadingProgressBar);
	
	loadingWidget->setLayout(loadingLayout); // On ajoute le layout au Widget
	loadingWidget->show(); // On affiche le widget

	// On vérifie l'existance de la sauvegarde
	if ( T.DB_Existe() && T.DB_Charger() )
	{
		loadingWidget->close();
		this->ClassicStart();
	}
	else
	{
		loadingWidget->close();
		this->FirstStart();
	}
	// ---
}
开发者ID:Max13,项目名称:MangaMania,代码行数:28,代码来源:main_win.cpp

示例9: QProgressDialog

KRPleaseWait::KRPleaseWait(QString msg, QWidget *parent, int count, bool cancel):
        QProgressDialog(cancel ? 0 : parent) , inc(true)
{
    setModal(!cancel);

    timer = new QTimer(this);
    setWindowTitle(i18n("Krusader::Wait"));

    setMinimumDuration(500);
    setAutoClose(false);
    setAutoReset(false);

    connect(timer, SIGNAL(timeout()), this, SLOT(cycleProgress()));

    QProgressBar* progress = new QProgressBar(this);
    progress->setMaximum(count);
    progress->setMinimum(0);
    setBar(progress);

    QLabel* label = new QLabel(this);
    setLabel(label);

    QPushButton* btn = new QPushButton(i18n("&Cancel"), this);
    setCancelButton(btn);

    btn->setEnabled(canClose = cancel);
    setLabelText(msg);

    show();
}
开发者ID:aremai,项目名称:krusader,代码行数:30,代码来源:krpleasewait.cpp

示例10: minMaxSameValue

void tst_QProgressBar::minMaxSameValue()
{
    QProgressBar bar;
    bar.setRange(10, 10);
    bar.setValue(10);
    bar.show();
}
开发者ID:Blizzard,项目名称:qt4,代码行数:7,代码来源:tst_qprogressbar.cpp

示例11: execMaj

int Patcher::execMaj()
{
    if (maj_avalible <= 0)
        return 0;

    QProgressBar progressBar;
    progressBar.setMaximumHeight(16);
    progressBar.setMaximumWidth(200);
    //progressBar->setTextVisible(false);
    progressBar.setRange(0,maj_avalible);
    this->statusBar()->addPermanentWidget(&progressBar, 0);
    this->statusBar()->showMessage(QString("Loading"));

    int nb = 0;
    int i = 1;
    for(patcher::Maj& maj : majs)
    {
        this->statusBar()->showMessage(QString("download "+QString::number(i)+"/"+QString::number(maj_avalible)));
        if(not maj.isDone())
            nb+= maj.apply();
        progressBar.setValue(++i);
    }

    this->statusBar()->clearMessage();
    this->statusBar()->removeWidget(&progressBar);

    return nb;
}
开发者ID:Krozark,项目名称:Patcher-client,代码行数:28,代码来源:Patcher.cpp

示例12: setupUi

    void setupUi(QDialog *Dialog)
    {
    Dialog->setObjectName(QString::fromUtf8("Dialog"));
    verticalLayout = new QWidget(Dialog);
    verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
    verticalLayout->setGeometry(QRect(9, 9, 215, 89));
    vboxLayout = new QVBoxLayout(verticalLayout);
    vboxLayout->setSpacing(6);
    vboxLayout->setMargin(0);
    vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
    labelTimeLeft = new QLabel(verticalLayout);
    labelTimeLeft->setObjectName(QString::fromUtf8("labelTimeLeft"));
    vboxLayout->addWidget(labelTimeLeft);
    
    labelImages = new QLabel(verticalLayout);
    labelImages->setObjectName(QString::fromUtf8("labelImages"));
    vboxLayout->addWidget(labelImages);

    progressBar = new QProgressBar(verticalLayout);
    progressBar->setObjectName(QString::fromUtf8("progressBar"));
    progressBar->setValue(0);
    progressBar->setOrientation(Qt::Horizontal);

    vboxLayout->addWidget(progressBar);


    retranslateUi(Dialog);

    QSize size(236, 111);
    size = size.expandedTo(Dialog->minimumSizeHint());
    Dialog->resize(size);


    QMetaObject::connectSlotsByName(Dialog);
    } // setupUi
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:35,代码来源:T_index_pg.cpp

示例13: out

void    Profile::setLabel()
{
    QLabel *item;
    QProgressBar *bar;

    bar = this->findChild<QProgressBar *>("LifeBar");
    bar->setValue(_hero->getLife());
    bar->setMaximum(_hero->getLifeMax());
    bar = this->findChild<QProgressBar *>("ManaBar");
    bar->setValue(_hero->getMana());
    bar->setMaximum(_hero->getManaMax());

    item = this->findChild<QLabel *>("Name");
    item->setText(QString::fromStdString(_hero->getName()));
    item = this->findChild<QLabel *>("RaceClass");
    item->setText(QString::fromStdString(SRace[static_cast<uint>(_hero->getRace())]) + " " +
                  QString::fromStdString(SClass[static_cast<uint>(_hero->getClass())]));

    item = this->findChild<QLabel *>("Lvl");
    item->setText("Lvl " + QString::number(_hero->getLvl()));
    item = this->findChild<QLabel *>("Agility");
    item->setText("Agility : " + QString::number(_hero->getAgility()));
    item = this->findChild<QLabel *>("Intellect");
    item->setText("Intellect : " + QString::number(_hero->getIntellect()));
    item = this->findChild<QLabel *>("Stamina");
    item->setText("Stamina : " + QString::number(_hero->getStamina()));
    item = this->findChild<QLabel *>("Strength");
    item->setText("Strength : " + QString::number(_hero->getStrength()));

    /*
    int fd = open("/Users/Arnaud/totoHero.txt", O_RDWR);
    int d = write(fd, reinterpret_cast<void *>(_hero), sizeof(KiwiHero));
    int size = sizeof(KiwiHero);

    KiwiHero *test = new KiwiHero();

    int n = read(fd, test, size);
    qDebug() << "Race is : " << QString::fromStdString(test->getName()) << d << n;
    delete test;
    ::close(fd);
    */

    /*
    QFile file;
    QDir::setCurrent("/Users/Arnaud");
    file.setFileName("totoHero.txt");
    if (!(file.open(QIODevice::ReadWrite | QIODevice::Truncate)))
        qDebug() << "open failed";
    else
        qDebug() << "open success";
    QDataStream out(&file);
    out.writeBytes(reinterpret_cast<const char *>(_hero), sizeof(KiwiHero));
    KiwiHero *test = new KiwiHero();
    QByteArray line = file.readLine();
    qDebug() << line;
    //qDebug() << "Race is : " << QString::toStdString(SRace[static_cast<uint>(test->getRace())]);
    delete test;
    */
}
开发者ID:Zaclos,项目名称:KiwiQuest,代码行数:59,代码来源:profile.cpp

示例14: onLoadStarted

void BrowserView::onLoadStarted()
{
    QProgressBar* bar = Gui::Sequencer::instance()->getProgressBar();
    bar->setRange(0, 100);
    bar->show();
    Gui::getMainWindow()->showMessage(tr("Loading %1...").arg(view->url().toString()));
    isLoading = true;
}
开发者ID:lainegates,项目名称:FreeCAD,代码行数:8,代码来源:BrowserView.cpp

示例15: QTreeWidgetItem

void ArchiveList::fillPartialArchiveItem(PartialArchive *a, QTreeWidgetItem *item)
{
    QTreeWidgetItem *subItem = new QTreeWidgetItem(item);

    QPushButton *pauseButton = new QPushButton();
    pauseButton->setText(a->isDownloading() ? tr("Pause") : tr("Continue"));
    connect(pauseButton, SIGNAL(clicked()), a, SLOT(togglePauseDownload()));
    downloadPausedMapper->setMapping(a, pauseButton);
    downloadStartedMapper->setMapping(a, pauseButton);
    connect(a, SIGNAL(downloadStarted()), downloadStartedMapper, SLOT(map()));
    connect(a, SIGNAL(downloadPaused()), downloadPausedMapper, SLOT(map()));

    int pbarColumn;

    if (compactLayout) {
        pbarColumn = 1;

        subItem->setSizeHint(1, pauseButton->sizeHint());
        setItemWidget(subItem, 1, pauseButton);

        QPushButton *detailsButton = new QPushButton(tr("Details"));
        showDetailsMapper->setMapping(detailsButton, a);
        connect(detailsButton, SIGNAL(clicked()), showDetailsMapper, SLOT(map()));
        subItem->setSizeHint(0, detailsButton->sizeHint());
        setItemWidget(subItem, 0, detailsButton);
    } else {
        pbarColumn = 2;

        item->setSizeHint(3, pauseButton->sizeHint());
        setItemWidget(item, 3, pauseButton);

        item->setText(1, a->getSizeMB());

        QLabel *peerInfo = new QLabel();
        subItem->setSizeHint(1, peerInfo->sizeHint());
        setItemWidget(subItem, 1, peerInfo);
        connect(a, SIGNAL(peerInfoUpdated(QString)), peerInfo, SLOT(setText(QString)));

        QLabel *speedText = new QLabel();
        subItem->setSizeHint(2, speedText->sizeHint());
        setItemWidget(subItem, 2, speedText);
        connect(a, SIGNAL(speedTextUpdated(QString)), speedText, SLOT(setText(QString)));

        QLabel *statusText = new QLabel();
        subItem->setSizeHint(3, statusText->sizeHint());
        setItemWidget(subItem, 3, statusText);
        connect(a, SIGNAL(statusTextUpdated(QString)), statusText, SLOT(setText(QString)));
    }

    QProgressBar *pbar = new QProgressBar();
    pbar->setMinimum(0);
    pbar->setMaximum(100);
    item->setSizeHint(pbarColumn, pbar->sizeHint());
    setItemWidget(item, pbarColumn, pbar);
    connect(a, SIGNAL(progressUpdated(int)), pbar, SLOT(setValue(int)));

    a->emitStatusEvents();
}
开发者ID:Iktwo,项目名称:evopedia,代码行数:58,代码来源:archivelist.cpp


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