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


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

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


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

示例1: 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

示例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: createProfile

void ProfileWizard::createProfile(int result)
{
  if (_profile_edit->isComplete() )
  {
    bts::profile_config conf;
    conf.firstname  = _profile_edit->ui.first_name->text().toUtf8().constData();
    conf.firstname  = fc::trim( conf.firstname );
    conf.middlename = _profile_edit->ui.middle_name->text().toUtf8().constData();
    conf.middlename = fc::trim( conf.middlename );
    conf.lastname   = _profile_edit->ui.last_name->text().toUtf8().constData();
    conf.lastname   = fc::trim( conf.lastname );
    conf.brainkey   = _profile_edit->ui.brainkey->text().toUtf8().constData();
    conf.brainkey   = fc::trim( conf.brainkey );

    std::string                      password = _profile_edit->ui.local_password1->text().toUtf8().constData();

    std::string profile_name         = conf.firstname + " " + conf.lastname;
    auto                             app = bts::application::instance();
    fc::thread* main_thread = &fc::thread::current();
    QProgressBar* progress = new QProgressBar();
    progress->setWindowTitle( "Creating Profile" );
    progress->setMaximum(1000);
    progress->resize( 640, 20 );
    progress->show();
    auto                             profile = app->create_profile(profile_name, conf, password, 
                                               [=]( double p )
                                               {
                                                  main_thread->async( [=](){ 
                                                                      progress->setValue( 1000*p );
                                                                      qApp->sendPostedEvents();
                                                                      qApp->processEvents();
                                                                      if( p >= 1.0 ) progress->deleteLater();
                                                                      } ).wait();
                                               }
                                               );
    assert(profile != nullptr);

    //store myself as contact
  /*
    std::string dac_id_string = _nym_page->_profile_nym_ui.keyhotee_id->text().toStdString();
    bts::addressbook::wallet_contact myself;
    myself.wallet_index = 0;
    myself.first_name = conf.firstname;
    myself.last_name = conf.lastname;
    myself.set_dac_id(dac_id_string);
    auto priv_key = profile->get_keychain().get_identity_key(myself.dac_id_string);
    myself.public_key = priv_key.get_public_key();
    profile->get_addressbook()->store_contact(myself);

    //store myself as identity
    bts::addressbook::wallet_identity new_identity;
    static_cast<bts::addressbook::contact&>(new_identity) = myself;
    profile->store_identity(new_identity);

    bts::application::instance()->add_receive_key(priv_key);
    */

    _mainApp.displayMainWindow();
  }
}
开发者ID:kewinwang,项目名称:keyhotee,代码行数:60,代码来源:ProfileWizard.cpp

示例4: 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

示例5: CreateRangeMeter

QProgressBar* USNavigation::CreateRangeMeter(int i)
{
  mitk::DataNode::Pointer zone = m_Zones.at(i);

  float zoneColor[3];
  bool success = m_Zones.at(i)->GetColor(zoneColor);
  QString zoneColorString = "#555555";
  if (success)
  {
    QString zoneColorString = QString("#%1%2%3").arg(static_cast<unsigned int>(zoneColor[0]*255), 2, 16, QChar('0'))
      .arg(static_cast<unsigned int>(zoneColor[1]*255), 2, 16, QChar('0')).arg(static_cast<unsigned int>(zoneColor[2]*255), 2, 16, QChar('0'));
  }

  QProgressBar* meter = new QProgressBar();
  meter->setMinimum(0);
  meter->setMaximum(100);
  meter->setValue(0);
  QString zoneName = zone->GetName().c_str();
  meter->setFormat(zoneName + ": No Data");
  QString style = m_RangeMeterStyle;
  style = style.replace("#StartColor#", zoneColorString);
  style = style.replace("#StopColor#", zoneColorString);
  meter->setStyleSheet(style);
  meter->setVisible(true);
  return meter;
}
开发者ID:Cdebus,项目名称:MITK,代码行数:26,代码来源:USNavigation.cpp

示例6: fillPartialArchiveItem

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

示例7: downloadTracksFromOSM

bool downloadTracksFromOSM(QWidget* Main, const QString& aWeb, const QString& aUser, const QString& aPassword, const CoordBox& aBox , Document* theDocument)
{
    Downloader theDownloader(aUser, aPassword);
    QList<TrackLayer*> theTracklayers;
    //TrackMapLayer* trackLayer = new TrackMapLayer(QApplication::translate("Downloader","Downloaded tracks"));
    //theDocument->add(trackLayer);

    IProgressWindow* aProgressWindow = dynamic_cast<IProgressWindow*>(Main);
    if (!aProgressWindow)
        return false;

    QProgressDialog* dlg = aProgressWindow->getProgressDialog();
    dlg->setWindowTitle(QApplication::translate("Downloader","Parsing..."));

    QProgressBar* Bar = aProgressWindow->getProgressBar();
    Bar->setTextVisible(false);
    Bar->setMaximum(11);

    QLabel* Lbl = aProgressWindow->getProgressLabel();
    Lbl->setText(QApplication::translate("Downloader","Parsing XML"));

    if (dlg)
        dlg->show();

    theDownloader.setAnimator(dlg,Lbl,Bar,true);
    for (int Page=0; ;++Page)
    {
        Lbl->setText(QApplication::translate("Downloader","Downloading trackpoints %1-%2").arg(Page*5000+1).arg(Page*5000+5000));
        QString URL = theDownloader.getURLToTrackPoints();
        URL = URL.arg(aBox.bottomLeft().x()).
                arg(aBox.bottomLeft().y()).
                arg(aBox.topRight().x()).
                arg(aBox.topRight().y()).
                arg(Page);
        QUrl theUrl(aWeb+URL);
        if (!theDownloader.go(theUrl))
            return false;
        if (theDownloader.resultCode() != 200)
            return false;
        int Before = theTracklayers.size();
        QByteArray Ar(theDownloader.content());
        bool OK = importGPX(Main, Ar, theDocument, theTracklayers, true);
        if (!OK)
            return false;
        if (Before == theTracklayers.size())
            break;
        theTracklayers[theTracklayers.size()-1]->setName(QApplication::translate("Downloader", "Downloaded track - nodes %1-%2").arg(Page*5000+1).arg(Page*5000+5000));
    }
    return true;
}
开发者ID:ryfx,项目名称:merkaartor,代码行数:50,代码来源:DownloadOSM.cpp

示例8: addCopy

void Progression::addCopy(QString src, QString){
	QLabel * label = new QLabel(src, this);
	label->setObjectName(src);
	label->setMaximumSize(780, 30);
	label->setGeometry(label->x(), label->y(), 780, label->height());
	QProgressBar * prog = new QProgressBar(this);
	prog->setObjectName(src);
	prog->setMaximum(QFile(src).size());
	vbl->addWidget(label);
	vbl->addWidget(prog);
	ProgressBars[label->text()] = prog;
	qDebug() << label->text();
	this->adjustSize();
}
开发者ID:ThomasAy,项目名称:Duplicateur,代码行数:14,代码来源:Progression.cpp

示例9: setMax

void ProgressBarDuo::setMax(int max, int n)
{
	QProgressBar *p = 0;
	switch(n)
	{
	case 0: p = ui->Bar0;
	break;
	case 1: p = ui->Bar1;
	break;
	default: break;
	}
	if(p)
		p->setMaximum(max);
}
开发者ID:gonboy,项目名称:fontmatrix,代码行数:14,代码来源:progressbarduo.cpp

示例10: buildProgressBar

QProgressBar* medDoubleParameterPresenter::buildProgressBar()
{
    QProgressBar *progressBar = new QProgressBar;
    progressBar->setValue(_percentFromValue(d->parameter->value()));
    connect(this, &medDoubleParameterPresenter::valueChanged,progressBar, &QProgressBar::setValue);

    progressBar->setToolTip(d->parameter->description());
    this->_connectWidget(progressBar);

    progressBar->setMinimum(0);
    progressBar->setMaximum(100);

    return progressBar;
}
开发者ID:medInria,项目名称:medInria-public,代码行数:14,代码来源:medDoubleParameterPresenter.cpp

示例11: progressDialog

void ImageViewer::progressDialog() {
    QDialog *dialog = new QDialog(this);
    dialog->setModal(false);
    dialog->setFixedSize(QSize(700, 400));
    QGridLayout *dialogLayout = new QGridLayout(dialog);
    dialogLayout->setAlignment(Qt::AlignCenter);
    dialogLayout->addWidget(new QLabel("Generating Thumbnail", dialog));
    QProgressBar *progress = new QProgressBar(dialog);
    progress->setMaximum(100);
    progress->setValue(0);
    connect(this, SIGNAL(setProgress(int)), progress, SLOT(setValue(int)));
    dialogLayout->addWidget(progress);
    dialog->setLayout(dialogLayout);
    dialog->show();
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例12: telechargementContinue

void TelechargerFichier::telechargementContinue(qint64 recu, qint64 total)
{
	QNetworkReply *reponse;
		reponse = qobject_cast<QNetworkReply *>(sender());

	QProgressBar *progression = progressionsTelechargements.value(reponses.indexOf(reponse));

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

	if (total != -1)
	{
		progression->setMaximum(total);
		progression->setValue(recu);
	}
}
开发者ID:qrichert,项目名称:Multiuso,代码行数:15,代码来源:TelechargerFichier.cpp

示例13: slot_showUpdatesTable

void UUpdateWidget::slot_showUpdatesTable(UUpdatesModel *model)
{
    if (model->rowCount() == 0) {
        qDebug() << "there is no updates";

        QMessageBox::information(this, tr("Nanomite updater"),
                                        tr("There is no updates"));

        m_stackedWidget->setCurrentIndex(0);
        m_toolBarActions.at(eINSTALL_UPDATES_ACTION)->setEnabled(false);
        m_toolBarActions.at(eCHECK_UPDATES_ACTION)->setEnabled(true);

        return;
    }

    // create folder for updates
    QDir currDir(QDir::currentPath());
    QString createdFolder = currDir.currentPath() + "/updates";
    currDir.mkdir(createdFolder);
    currDir.setCurrent(createdFolder);
    // end of creating folder for updates

    m_updatesTableView->setModel(model);
    m_progressBarList.clear();

    QProgressBar *progressBar;
    for (int i = 0; i < model->rowCount(); i++) {
        progressBar = new QProgressBar(m_updatesTableView);

        progressBar->setTextVisible(false);
        progressBar->setMinimum(0);
        progressBar->setMaximum(0);        

        m_progressBarList.append(progressBar);

        m_updatesTableView->setIndexWidget(model->index(i, UUpdatesModel::eSTATUS), m_progressBarList.last());
    }

    m_updatesTableView->resizeColumnsToContents();

    m_stackedWidget->setCurrentIndex(2);
    m_toolBarActions.at(eINSTALL_UPDATES_ACTION)->setEnabled(true);
    m_toolBarActions.at(eCHECK_UPDATES_ACTION)->setEnabled(false);
}
开发者ID:en0mis,项目名称:Nanomite-Updater,代码行数:44,代码来源:uupdatewidget.cpp

示例14: QProgressBar

void ProgressTree2::fillItem(QTreeWidgetItem* item,
        Job* job)
{
    item->setText(0, job->getTitle().isEmpty() ?
            "-" : job->getTitle());

    QProgressBar* pb = new QProgressBar(this);
    pb->setMaximum(10000);
    setItemWidget(item, 3, pb);

    CancelPushButton* cancel = new CancelPushButton(this);
    cancel->setText(QObject::tr("Cancel"));
    cancel->item = item;
    connect(cancel, SIGNAL(clicked()), this,
            SLOT(cancelClicked()));
    setItemWidget(item, 4, cancel);

    item->setData(0, Qt::UserRole, qVariantFromValue((void*) job));
}
开发者ID:benpope82,项目名称:npackd-cpp,代码行数:19,代码来源:progresstree2.cpp

示例15: QDialog

QgsBusyIndicatorDialog::QgsBusyIndicatorDialog( const QString &message, QWidget *parent, Qt::WindowFlags fl )
  : QDialog( parent, fl )
  , mMessage( QString( message ) )

{
  setWindowTitle( tr( "QGIS" ) );
  setLayout( new QVBoxLayout() );
  setWindowModality( Qt::WindowModal );
  setMinimumWidth( 250 );
  mMsgLabel = new QLabel( mMessage );
  layout()->addWidget( mMsgLabel );

  QProgressBar *pb = new QProgressBar();
  pb->setMaximum( 0 ); // show as busy indicator
  layout()->addWidget( pb );

  if ( mMessage.isEmpty() )
  {
    mMsgLabel->hide();
  }
}
开发者ID:AlisterH,项目名称:Quantum-GIS,代码行数:21,代码来源:qgsbusyindicatordialog.cpp


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