本文整理汇总了C++中QProgressBar::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QProgressBar::setValue方法的具体用法?C++ QProgressBar::setValue怎么用?C++ QProgressBar::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProgressBar
的用法示例。
在下文中一共展示了QProgressBar::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
int p = 0;
toConfigurationNew::setQSettingsEnv();
QApplication app(argc, argv);
qRegisterMetaType<toQColumnDescriptionList>("toQColumnDescriptionList&");
qRegisterMetaType<ValuesList>("ValuesList&");
qRegisterMetaType<toConnection::exception>("toConnection::exception");
try
{
toSplash splash(NULL);
splash.show();
QList<QString> plugins;
// List of all connection provider finders
std::vector<std::string> finders = ConnectionProviderFinderFactory::Instance().keys();
// Resulting list of all the providers found
toProvidersList &allProviders = toProvidersListSing::Instance();
QProgressBar *progress = splash.progress();
QLabel *label = splash.label();
progress->setRange(1, plugins.size() + finders.size()*2);
qApp->processEvents();
Q_FOREACH(QString path, plugins)
{
label->setText(qApp->translate("main", "Loading plugin %1").arg(path));
qApp->processEvents();
bool success = false;
try
{
QLibrary library(path);
success = library.load();
}
TOCATCH;
if (success)
{
label->setText(qApp->translate("main", "Loaded plugin %1").arg(path));
TLOG(5, toDecoratorNC, __HERE__) << "Loaded plugin " << path << std::endl;
}
else
{
label->setText(qApp->translate("main", "Failed loading plugin %1").arg(path));
TLOG(5, toDecoratorNC, __HERE__) << "Failed loading plugin " << path << std::endl;
}
progress->setValue(progress->value()+1);
qApp->processEvents();
}
// Loop over all finders and call their "find" method, each of them can return several locations
for (std::vector<std::string>::const_iterator i = finders.begin(); i != finders.end(); ++i)
{
QString finderName(i->c_str());
label->setText(qApp->translate("main", "Looking for %1").arg(finderName));
qApp->processEvents();
TLOG(5, toDecoratorNC, __HERE__) << "Looking for client: " << *i << std::endl;
try
{
std::auto_ptr<toConnectionProviderFinder> finder = ConnectionProviderFinderFactory::Instance().create(*i, 0);
QList<toConnectionProviderFinder::ConnectionProvirerParams> l = finder->find();
allProviders.append(l);
finderName = finder->name();
}
TOCATCH;
progress->setValue(progress->value()+1);
qApp->processEvents();
}
// Loop over all providers found and try to load desired Oracle client
// 1st try to load requested Oracle client(if set) then load thick(TNS) Oracle client
QDir oHome = toConfigurationNewSingle::Instance().option(ToConfiguration::Global::OracleHomeDirectory).toString();
Q_FOREACH(toConnectionProviderFinder::ConnectionProvirerParams const& params, allProviders)
{
QString providerName = params.value("PROVIDER").toString();
if ( params.value("PROVIDER").toString() != ORACLE_PROVIDER)
continue;
QDir pHome(params.value("ORACLE_HOME").toString());
if (oHome != pHome)
continue;
try
{
label->setText(qApp->translate("main", "Loading provider %1").arg(providerName));
qApp->processEvents();
TLOG(5, toDecoratorNC, __HERE__) << "Loading: " << params.value("PATH").toString() << std::endl;
toConnectionProviderRegistrySing::Instance().load(params);
progress->setValue(progress->value()+1);
qApp->processEvents();
break;
}
TOCATCH;
}
示例2: updateProgress
void FtpSessionDialog::updateProgress(int id, qint64 done, qint64 total)
{
QProgressBar *progress = progressBars->value(id);
progress->setMaximum(total);
progress->setValue(done);
}
示例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);
//.........这里部分代码省略.........
示例4: onLoadProgress
void BrowserView::onLoadProgress(int step)
{
QProgressBar* bar = Gui::Sequencer::instance()->getProgressBar();
bar->setValue(step);
}
示例5: getfileTotal
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->textBrowser->setFont(QFont("Monospace",11));
ui->textBrowser->setLineWrapMode(QTextEdit::NoWrap);
updater->moveToThread(pthread);
fileTotal->moveToThread(fthread);
//User selects directory, or action
connect(this,SIGNAL(userSelect(QString)),updater,SLOT(action(QString)));
connect(this,SIGNAL(selectDir(QString)),updater,SLOT(selectDir(QString)));
connect(this,SIGNAL(selectDir(QString)),fileTotal,SLOT(selectDir(QString)));
//Returning from Worker Thread
connect(updater,SIGNAL(Finished(QString)),this,SLOT(action(QString)));
//Clean up threads
connect(updater,SIGNAL(close()),pthread,SLOT(quit()));
connect(pthread, SIGNAL(finished()), updater, SLOT(deleteLater()));
connect(fileTotal,SIGNAL(close()),fthread,SLOT(quit()));
connect(fthread,SIGNAL(finished()),fileTotal,SLOT(deleteLater()));
//Start Thread(s)
pthread->start();
fthread->start();
//Get number of files in directory for progress bar
//connect(this,SIGNAL(getfileTotal()),updater,SLOT(getfileTotal()));
connect(this,SIGNAL(getfileTotal(QString)),fileTotal,SLOT(getfileTotal(QString))); //request from main thread
connect(fileTotal,SIGNAL(finished(int)),updater,SLOT(getfileTotal(int))); //transfer total from getfiletotal object to worker object
connect(updater,SIGNAL(getfileTotal(QString)),fileTotal,SLOT(getfileTotal(QString))); //request from updater
connect(updater,SIGNAL(displayFileTotal(int)),this,SLOT(displayFileTotal(int)));
connect(fileTotal,SIGNAL(finished(int)),this,SLOT(enableButton()));
//Create ProgressBar
QProgressBar *bar = new QProgressBar(ui->statusBar);
ui->statusBar->addWidget(bar);
bar->setRange(0,100);
bar->setValue(0);
bar->hide();
connect(updater,SIGNAL(percentChanged(int)),bar,SLOT(setValue(int)));
connect(updater,SIGNAL(percentChanged(int)),bar,SLOT(show()));
connect(this,SIGNAL(hidebar()),bar,SLOT(hide()));
//fileTotal->getfileTotal();
emit getfileTotal(dirSelect);
ui->pushButton->setEnabled(false);
//TABLE FUNZ
QShortcut *shortcut = new QShortcut(QKeySequence("Ctrl+C"), this);
connect(shortcut,SIGNAL(activated()),this,SLOT(on_actionCopy_triggered()));
// ui->tableWidget->setColumnCount(3);
// ui->tableWidget->setRowCount(100);
// ui->tableWidget->setHorizontalHeaderLabels(QStringList() << "File" << "Hash" << "Check");
// ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
// ui->tableWidget->horizontalHeader()->setSectionResizeMode(1,QHeaderView::Stretch);
}
示例6: createWidget
//.........这里部分代码省略.........
QMenu* parentMenu = new QMenu;
parentMenu->setObjectName("Menu");
parentMenu->addMenu("Menu1");
QMenu* menu1 = parentMenu->addMenu("Menu2");
menu1->addMenu("Menu1");
menu1->addMenu("Menu2");
parentMenu->addSeparator();
parentMenu->addMenu("Menu3");
return setLayoutWidget({ parentMenu }, { 160, 110 });
}
else if(name == "MenuBar")
{
QMenuBar* bar = new QMenuBar;
bar->setObjectName("QMenuBar");
QMenu* menu1 = bar->addMenu("MenuBar1");
menu1->addMenu("Menu1");
menu1->addSeparator();
menu1->addMenu("Menu2");
QMenu* menu2 = bar->addMenu("MenuBar2");
menu2->addMenu("Menu1");
menu2->addSeparator();
menu2->addMenu("Menu2");
QMenu* menu3 = bar->addMenu("MenuBar3");
menu3->addMenu("Menu1");
menu3->addSeparator();
menu3->addMenu("Menu2");
return setLayoutWidget({ bar }, { 280, 60 });
}
else if(name == "ProgressBar")
{
QProgressBar* bar = new QProgressBar;
bar->setObjectName("ProgressBar");
bar->setRange(0, 100);
bar->setValue(0);
QTimer* timer = new QTimer(bar);
this->connect(timer, &QTimer::timeout, this, [bar]()
{
if(bar->value() == 100)
bar->setValue(0);
else
bar->setValue(bar->value() + 1);
});
timer->start(100);
return setLayoutWidget({ bar }, { 110, 30 });
}
else if(name == "PushButton")
{
QPushButton* button = new QPushButton("PushButton");
button->setObjectName("PushButton");
return setLayoutWidget({ button }, { 125, 30 });
}
else if(name == "RadioButton")
{
QRadioButton* button = new QRadioButton("RadioButton");
button->setObjectName("RadioButton");
return setLayoutWidget({ button }, { 125, 30 });
}
else if(name == "ScrollBar")
{
QScrollBar* barH = new QScrollBar(Qt::Horizontal);
QScrollBar* barV = new QScrollBar(Qt::Vertical);
barH->setObjectName("ScrollBarH");
barV->setObjectName("ScrollBarV");
return setLayoutWidget({ barH, barV }, { 200, 100 });
}
示例7: fillMainWindow
void MainWindow::fillMainWindow()
{
ui->listUV->clear();
ui->m_tree->clear();
for(int rows = 0; rows != ui->m_gridcursus->rowCount();rows++){
ui->m_gridcursus->removeItem(ui->m_gridcursus->itemAtPosition(rows,0));
ui->m_gridcursus->removeItem(ui->m_gridcursus->itemAtPosition(rows,1));
ui->m_gridcursus->removeItem(ui->m_gridcursus->itemAtPosition(rows,2));
}
/* ONGLET DOSSIER */
ui->m_tree->setColumnCount(5);
QTreeWidgetItem* headerItem = new QTreeWidgetItem();
headerItem->setText(0,QString("Nom"));
headerItem->setText(1,QString("Titre"));
headerItem->setText(2,QString("Crédits"));
headerItem->setText(3,QString("Catégories"));
headerItem->setText(4,QString("Résultat"));
ui->m_tree->setHeaderItem(headerItem);
ui->m_tree->header()->resizeSection(0, 150);
ui->m_tree->header()->resizeSection(1, 300);
ui->m_tree->header()->resizeSection(2, 70);
ui->m_tree->header()->resizeSection(3, 70);
ui->m_tree->header()->resizeSection(4, 40);
ui->m_tree->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->m_tree->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->m_tree->setSelectionMode(QAbstractItemView::SingleSelection);
QList <Dossier *> myDossiers = fac->getDossierDAO()->findAllByEtudiant(currentEtudiant->ID());
QMap<QString, Cursus*> cursusToCompute;
for (QList<Dossier *>::const_iterator d = myDossiers.begin(); d != myDossiers.end(); ++d) {
QTreeWidgetItem *folderWidget = new QTreeWidgetItem(ui->m_tree,QStringList( (*d)->getTitre() ));
QList<Semestre *> mySemestres = fac->getInscriptionDAO()->findSemestresByDossier( (*d)->ID() );
for(QList<Semestre *>::const_iterator s = mySemestres.begin(); s != mySemestres.end(); ++s){
QStringList columns;
columns << (*s)->getTitre()
<< (*s)->getComputedCode()
<< QString::number( fac->getSemestreDAO()->calculEcts( (*s)->ID() ) );
if((*s)->getCursus()){
columns << (*s)->getCursus()->getFull();
}
if((*d)->isCurrent()){
cursusToCompute.insert( (*s)->getCursus()->getCode(), (*s)->getCursus() );
}
QTreeWidgetItem *semWidget = new QTreeWidgetItem(folderWidget, columns );
QList<UV *> myUVs = fac->getInscriptionDAO()->findUvsBySemestre( (*s)->ID() );
qDebug()<<myUVs;
for(QList<UV *>::const_iterator u = myUVs.begin(); u != myUVs.end(); ++u){
QStringList columns;
columns << (*u)->getCode()
<< (*u)->getTitre()
<< (*u)->getCreditsString()
<< (*u)->getCursusString()
<< fac->getInscriptionDAO()->getResultat((*d)->ID(),(*s)->ID(),(*u)->ID());
QTreeWidgetItem *uvWidget = new QTreeWidgetItem(semWidget, columns);
}
}
}
/* ONGLET CURSUS */
int row = 0;
for(QMap<QString, Cursus*>::const_iterator i = cursusToCompute.begin(); i != cursusToCompute.end(); ++i){
QProgressBar* pb = new QProgressBar();
QLabel *lab = new QLabel(i.value()->getCode());
pb->setMaximum(i.value()->getEcts());
ui->m_gridcursus->addWidget(lab,row,0);
ui->m_gridcursus->addWidget(pb,row,1,1,2);
row++;
int somme =0;
QMap<QString, int> detail = fac->getCursusDAO()->computePercent(i.value()->ID());
for(QMap<QString, int>::const_iterator j = detail.begin(); j != detail.end(); ++j){
QProgressBar* pb = new QProgressBar();
int max = i.value()->getCredits().find(j.key()).value();
int val = j.value();
somme += val;
pb->setMaximum( max );
pb->setValue(val);
ui->m_gridcursus->addWidget(new QLabel(j.key() + "("+QString::number( val )+"/"+QString::number( max )+")"),row,1 );
//.........这里部分代码省略.........
示例8: QWidget
//.........这里部分代码省略.........
QHBoxLayout *judgingPerceptionLayout = new QHBoxLayout;
mainLayout->addLayout(judgingPerceptionLayout);
QLabel *judging = new QLabel(tr("Jugement"));
judging->setAlignment(Qt::AlignRight);
judging->setMinimumWidth(100);
judgingPerceptionLayout->addWidget(judging);
QProgressBar *judgingProgressBar = new QProgressBar;
judgingProgressBar->setInvertedAppearance(true);
judgingProgressBar->setMaximum(20);
judgingPerceptionLayout->addWidget(judgingProgressBar);
QProgressBar *perceptionProgressBar = new QProgressBar;
perceptionProgressBar->setMaximum(20);
judgingPerceptionLayout->addWidget(perceptionProgressBar);
QLabel *perception = new QLabel(tr("Perception"));
perception->setMinimumWidth(100);
judgingPerceptionLayout->addWidget(perception);
QLabel *result = new QLabel(tr("Resultat"));
result->setAlignment(Qt::AlignCenter);
mainLayout->addWidget(result);
QHBoxLayout *resultLayout = new QHBoxLayout;
mainLayout->addLayout(resultLayout);
//search result, if there is equal result, we have to
//set several button.
QList<QString> firstLetters;
if (answerCount["extraversion"] < answerCount["introversion"]) {
firstLetters.append("I");
} else if (answerCount["extraversion"] > answerCount["introversion"]) {
firstLetters.append("E");
} else {
firstLetters.append("I");
firstLetters.append("E");
}
QList<QString> secondLetters;
if (answerCount["sensing"] < answerCount["intuition"]) {
secondLetters.append("N");
} else if (answerCount["sensing"] > answerCount["intuition"]) {
secondLetters.append("S");
} else {
secondLetters.append("N");
secondLetters.append("S");
}
QList<QString> thirdLetters;
if (answerCount["thinking"] < answerCount["feeling"]) {
thirdLetters.append("F");
} else if (answerCount["thinking"] > answerCount["feeling"]) {
thirdLetters.append("T");
} else {
thirdLetters.append("F");
thirdLetters.append("T");
}
QList<QString> fourthLetters;
if (answerCount["judging"] < answerCount["perception"]) {
fourthLetters.append("P");
} else if (answerCount["judging"] > answerCount["perception"]) {
fourthLetters.append("J");
} else {
fourthLetters.append("P");
fourthLetters.append("J");
}
signalMapper = new QSignalMapper(this);
//release the cartesian product of letters, and create a button
//for each case
for (int i = 0; i < firstLetters.size(); i++) {
for (int j = 0; j < secondLetters.size(); j++) {
for (int k = 0; k < thirdLetters.size(); k++) {
for (int l = 0; l < fourthLetters.size(); l++) {
QString type = firstLetters[i] + secondLetters[j] + thirdLetters[k] + fourthLetters[l];
QPushButton *resultButton = new QPushButton(type);
resultLayout->addWidget(resultButton);
connect(resultButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
signalMapper->setMapping(resultButton, type);
}
}
}
}
connect(signalMapper, SIGNAL(mapped(QString)), this, SLOT(openTypeDescription(QString)));
extraversionProgressBar->setValue(answerCount["extraversion"]);
introversionProgressBar->setValue(answerCount["introversion"]);
sensingProgressBar->setValue(answerCount["sensing"]);
intuitionProgressBar->setValue(answerCount["intuition"]);
thinkingProgressBar->setValue(answerCount["thinking"]);
feelingProgressBar->setValue(answerCount["feeling"]);
judgingProgressBar->setValue(answerCount["judging"]);
perceptionProgressBar->setValue(answerCount["perception"]);
QPushButton *openTypeDescriptionsButton = new QPushButton(tr("Tableau des types"));
mainLayout->addWidget(openTypeDescriptionsButton);
connect(openTypeDescriptionsButton, SIGNAL(clicked()), this, SLOT(openTypeDescriptions()));
}
示例9: setProgress
void HistoryProgressBar::setProgress(unsigned n)
{
m_bar->setValue(n);
}
示例10: save
void Archive::save(Basket *basket, bool withSubBaskets, const QString &destination)
{
QDir dir;
KProgressDialog dialog(0, i18n("Save as Basket Archive"), i18n("Saving as basket archive. Please wait..."), /*Not modal, for password dialogs!*/false);
dialog.showCancelButton(false);
dialog.setAutoClose(true);
dialog.show();
QProgressBar *progress = dialog.progressBar();
progress->setRange(0,/*Preparation:*/1 + /*Finishing:*/1 + /*Basket:*/1 + /*SubBaskets:*/(withSubBaskets ? Global::bnpView->basketCount(Global::bnpView->listViewItemForBasket(basket)) : 0));
progress->setValue(0);
// Create the temporary folder:
QString tempFolder = Global::savesFolder() + "temp-archive/";
dir.mkdir(tempFolder);
// Create the temporary archive file:
QString tempDestination = tempFolder + "temp-archive.tar.gz";
KTar tar(tempDestination, "application/x-gzip");
tar.open(QIODevice::WriteOnly);
tar.writeDir("baskets", "", "");
progress->setValue(progress->value()+1); // Preparation finished
kDebug() << "Preparation finished out of " << progress->maximum();
// Copy the baskets data into the archive:
QStringList backgrounds;
Archive::saveBasketToArchive(basket, withSubBaskets, &tar, backgrounds, tempFolder, progress);
// Create a Small baskets.xml Document:
QDomDocument document("basketTree");
QDomElement root = document.createElement("basketTree");
document.appendChild(root);
Global::bnpView->saveSubHierarchy(Global::bnpView->listViewItemForBasket(basket), document, root, withSubBaskets);
Basket::safelySaveToFile(tempFolder + "baskets.xml", "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + document.toString());
tar.addLocalFile(tempFolder + "baskets.xml", "baskets/baskets.xml");
dir.remove(tempFolder + "baskets.xml");
// Save a Small tags.xml Document:
QList<Tag*> tags;
listUsedTags(basket, withSubBaskets, tags);
Tag::saveTagsTo(tags, tempFolder + "tags.xml");
tar.addLocalFile(tempFolder + "tags.xml", "tags.xml");
dir.remove(tempFolder + "tags.xml");
// Save Tag Emblems (in case they are loaded on a computer that do not have those icons):
QString tempIconFile = tempFolder + "icon.png";
for (Tag::List::iterator it = tags.begin(); it != tags.end(); ++it) {
State::List states = (*it)->states();
for (State::List::iterator it2 = states.begin(); it2 != states.end(); ++it2) {
State *state = (*it2);
QPixmap icon = KIconLoader::global()->loadIcon(
state->emblem(), KIconLoader::Small, 16, KIconLoader::DefaultState,
QStringList(), 0L, true
);
if (!icon.isNull()) {
icon.save(tempIconFile, "PNG");
QString iconFileName = state->emblem().replace('/', '_');
tar.addLocalFile(tempIconFile, "tag-emblems/" + iconFileName);
}
}
}
dir.remove(tempIconFile);
// Finish Tar.Gz Exportation:
tar.close();
// Computing the File Preview:
Basket *previewBasket = basket; // FIXME: Use the first non-empty basket!
QPixmap previewPixmap(previewBasket->visibleWidth(), previewBasket->visibleHeight());
QPainter painter(&previewPixmap);
// Save old state, and make the look clean ("smile, you are filmed!"):
NoteSelection *selection = previewBasket->selectedNotes();
previewBasket->unselectAll();
Note *focusedNote = previewBasket->focusedNote();
previewBasket->setFocusedNote(0);
previewBasket->doHoverEffects(0, Note::None);
// Take the screenshot:
previewBasket->drawContents(&painter, 0, 0, previewPixmap.width(), previewPixmap.height());
// Go back to the old look:
previewBasket->selectSelection(selection);
previewBasket->setFocusedNote(focusedNote);
previewBasket->doHoverEffects();
// End and save our splandid painting:
painter.end();
QImage previewImage = previewPixmap.toImage();
const int PREVIEW_SIZE = 256;
previewImage = previewImage.scaled(PREVIEW_SIZE, PREVIEW_SIZE, Qt::KeepAspectRatio);
previewImage.save(tempFolder + "preview.png", "PNG");
// Finaly Save to the Real Destination file:
QFile file(destination);
if (file.open(QIODevice::WriteOnly)) {
ulong previewSize = QFile(tempFolder + "preview.png").size();
ulong archiveSize = QFile(tempDestination).size();
QTextStream stream(&file);
stream.setCodec("ISO-8859-1");
stream << "BasKetNP:archive\n"
<< "version:0.6.1\n"
//.........这里部分代码省略.........
示例11: main
//.........这里部分代码省略.........
GraficadorMdi *graf2 = new GraficadorMdi( mdiArea );
mdiArea->addSubWindow( graf2 );
graf2->showMaximized();
graf2->setearTitulo( "Datos originales" );
//graf2->setearEjesEnGrafico();
graf2->setearTituloEjeX( "Longitud" );
graf2->setearTituloEjeY( "Ancho" );
graf2->agregarPuntosClasificados( entradas1, salidas1, stringAQVector( parametros.value( "codificacion_salida" ).toString() ) );
GraficadorMdi *graf3 = new GraficadorMdi( mdiArea );
mdiArea->addSubWindow( graf3 );
graf3->showMaximized();
graf3->setearTitulo( "Datos originales" );
graf3->setearTituloEjeX( "Petalos" );
graf3->setearTituloEjeY( "Sepalos" );
graf3->agregarPuntosClasificados( entradas2, salidas2, stringAQVector( parametros.value( "codificacion_salida" ).toString() ) );
mdiArea->tileSubWindows();
}
QDockWidget *dockBarra1 = new QDockWidget( "Progreso de Particiones" );
main.addDockWidget( Qt::BottomDockWidgetArea, dockBarra1 );
QProgressBar *PBParticiones = new QProgressBar( dockBarra1 );
dockBarra1->setWidget( PBParticiones );
QDockWidget *dockBarra2 = new QDockWidget( "Progreso de Epocas" );
main.addDockWidget( Qt::BottomDockWidgetArea, dockBarra2 );
QProgressBar *PBEpocas = new QProgressBar( dockBarra2 );
dockBarra2->setWidget( PBEpocas );
QVector<double> errores_particiones;
PBParticiones->setRange( 0, particiones.cantidadDeParticiones() );
PBParticiones->setValue( 0 );
PBParticiones->setFormat( "Particion %v de %m - %p%" );
PBEpocas->setRange( 0, max_epocas );
PBEpocas->setFormat( "Epoca %v de %m - %p%" );
// Mido el tiempo
QElapsedTimer medidor_tiempo;
medidor_tiempo.start();
// Busco los centroides
red.setearDatosOriginales( entradas, &salidas );
red.buscarCentroides();
// Grafico la agrupacion que hizo
GraficadorMdi *graf = new GraficadorMdi( mdiArea );
mdiArea->addSubWindow( graf );
graf->setearTitulo( QString( "Agrupamientos según RB" ) );
graf->setearEjesEnGrafico();
graf->setearTituloEjeX( " X " );
graf->setearTituloEjeY( " Y " );
red.graficarClusters( graf );
mdiArea->tileSubWindows();
//return a.exec();
for( int p=0; p<particiones.cantidadDeParticiones(); p++ ) {
Particionador::particion part_local = particiones.getParticion( p );
qDebug() << endl << "Utilizando Particion: " << p ;
//pongo nuevamente en los valores iniciales las variables de corte para que entre en todas las particiones
示例12: updateItemWidgets
void ProgressListDelegate::updateItemWidgets(const QList<QWidget*> widgets,
const QStyleOptionViewItem &option,
const QPersistentModelIndex &index) const
{
if (!index.isValid()) {
return;
}
QPushButton *pauseResumeButton = static_cast<QPushButton*>(widgets[0]);
QPushButton *cancelButton = static_cast<QPushButton*>(widgets[1]);
cancelButton->setToolTip(i18n("Cancel"));
QProgressBar *progressBar = static_cast<QProgressBar*>(widgets[2]);
QPushButton *clearButton = static_cast<QPushButton*>(widgets[3]);
int percent = d->getPercent(index);
cancelButton->setVisible(percent < 100);
pauseResumeButton->setVisible(percent < 100);
clearButton->setVisible(percent > 99);
KJob::Capabilities capabilities = (KJob::Capabilities) index.model()->data(index, JobView::Capabilities).toInt();
cancelButton->setEnabled(capabilities & KJob::Killable);
pauseResumeButton->setEnabled(capabilities & KJob::Suspendable);
JobView::JobState state = (JobView::JobState) index.model()->data(index, JobView::State).toInt();
switch (state) {
case JobView::Running:
pauseResumeButton->setToolTip(i18n("Pause"));
pauseResumeButton->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-pause")));
break;
case JobView::Suspended:
pauseResumeButton->setToolTip(i18n("Resume"));
pauseResumeButton->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
break;
default:
Q_ASSERT(0);
break;
}
QSize progressBarButtonSizeHint;
if (percent < 100) {
QSize cancelButtonSizeHint = cancelButton->sizeHint();
cancelButton->move(option.rect.width() - d->separatorPixels - cancelButtonSizeHint.width(),
option.rect.height() - d->separatorPixels - cancelButtonSizeHint.height());
QSize pauseResumeButtonSizeHint = pauseResumeButton->sizeHint();
pauseResumeButton->move(option.rect.width() - d->separatorPixels * 2 - pauseResumeButtonSizeHint.width() - cancelButtonSizeHint.width(),
option.rect.height() - d->separatorPixels - pauseResumeButtonSizeHint.height());
progressBarButtonSizeHint = pauseResumeButtonSizeHint;
} else {
progressBarButtonSizeHint = clearButton->sizeHint();
clearButton->resize(progressBarButtonSizeHint);
clearButton->move(option.rect.width() - d->separatorPixels - progressBarButtonSizeHint.width(),
option.rect.height() - d->separatorPixels - progressBarButtonSizeHint.height());
}
progressBar->setValue(percent);
QFontMetrics fm(QApplication::font());
QSize progressBarSizeHint = progressBar->sizeHint();
progressBar->resize(QSize(option.rect.width() - d->getCurrentLeftMargin(fm.height()) - d->rightMargin, progressBarSizeHint.height()));
progressBar->move(d->getCurrentLeftMargin(fm.height()),
option.rect.height() - d->separatorPixels * 2 - progressBarButtonSizeHint.height() - progressBarSizeHint.height());
}
示例13: UpdateMeters
void USNavigation::UpdateMeters()
{
// Get NeedlePosition
mitk::NavigationData::Pointer needle = this->m_Tracker->GetOutput(0);
if (! needle->IsDataValid()) return;
mitk::Point3D needlePosition = needle->GetPosition();
// Update each meter
for (int i = 0; i < m_Zones.size(); i++)
{
mitk::Point3D zoneOrigin = m_Zones.at(i)->GetData()->GetGeometry()->GetOrigin();
// calculate absolute distance
mitk::ScalarType distance = sqrt( pow(zoneOrigin[0] - needlePosition[0], 2) + pow(zoneOrigin[1] - needlePosition[1], 2) + pow(zoneOrigin[2] - needlePosition[2], 2) );
// Subtract zone size
float zoneSize;
m_Zones.at(i)->GetFloatProperty("zone.size", zoneSize);
distance = distance - zoneSize;
// Prepare new Style
float zoneColor[3];
m_Zones.at(i)->GetColor(zoneColor);
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'));
QString style = m_RangeMeterStyle;
QString text = m_Zones.at(i)->GetName().c_str();
int value = 0;
// There Are now four possible Outcomes
// 1) Needle is inside zone (bad news)
if (distance < 0)
{
style = style.replace("#StartColor#", "red");
style = style.replace("#StopColor#", "red");
text = text + ": VIOLATED";
value = 100;
} // 2) Needle is close to Zone
else if (distance < WARNRANGE)
{
style = style.replace("#StartColor#", zoneColorString);
style = style.replace("#StopColor#", "red");
text = text + ": " + QString::number(distance) + " mm";
value = 100 - 100 * ((float) distance / (float )MAXRANGE);
} // 3) Needle is away from zone
else if (distance < MAXRANGE)
{
style = style.replace("#StartColor#", zoneColorString);
style = style.replace("#StopColor#", zoneColorString);
text = text + ": " + QString::number(distance) + " mm";
value = 100 - 100 * ((float) distance / (float )MAXRANGE);
} // 4) Needle is far away from zone
else
{
style = style.replace("#StartColor#", zoneColorString);
style = style.replace("#StopColor#", zoneColorString);
text = text + ": " + QString::number(distance) + " mm";
value = 0;
}
QProgressBar * meter = this->m_RangeMeters.at(i);
meter->setStyleSheet(style);
meter->setFormat(text);
meter->setValue(value);
}
}
示例14: 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();
int x=(qApp->desktop()->width() - progress->width())/2;
int y=(qApp->desktop()->height() - progress->height())/2;
progress->move(x,y);
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();
}
}
示例15: init
void PinDialog::init( PinFlags flags, const QString &title, TokenData::TokenFlags token )
{
setMinimumWidth( 350 );
setWindowModality( Qt::ApplicationModal );
QLabel *label = new QLabel( this );
QVBoxLayout *l = new QVBoxLayout( this );
l->addWidget( label );
QString _title = title;
QString text;
if( token & TokenData::PinFinalTry )
text += "<font color='red'><b>" + tr("PIN will be locked next failed attempt") + "</b></font><br />";
else if( token & TokenData::PinCountLow )
text += "<font color='red'><b>" + tr("PIN has been entered incorrectly one time") + "</b></font><br />";
text += QString( "<b>%1</b><br />" ).arg( title );
if( flags & Pin2Type )
{
_title = tr("Signing") + " - " + title;
QString t = flags & PinpadFlag ?
tr("For using sign certificate enter PIN2 at the reader") :
tr("For using sign certificate enter PIN2");
text += tr("Selected action requires sign certificate.") + "<br />" + t;
regexp.setPattern( "\\d{5,12}" );
}
else
{
_title = tr("Authentication") + " - " + title;
QString t = flags & PinpadFlag ?
tr("For using authentication certificate enter PIN1 at the reader") :
tr("For using authentication certificate enter PIN1");
text += tr("Selected action requires authentication certificate.") + "<br />" + t;
regexp.setPattern( "\\d{4,12}" );
}
setWindowTitle( _title );
label->setText( text );
Common::setAccessibleName( label );
if( flags & PinpadFlag )
{
setWindowFlags( (windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowCloseButtonHint );
QProgressBar *progress = new QProgressBar( this );
progress->setRange( 0, 30 );
progress->setValue( progress->maximum() );
progress->setTextVisible( false );
l->addWidget( progress );
QTimeLine *statusTimer = new QTimeLine( progress->maximum() * 1000, this );
statusTimer->setCurveShape( QTimeLine::LinearCurve );
statusTimer->setFrameRange( progress->maximum(), progress->minimum() );
connect( statusTimer, SIGNAL(frameChanged(int)), progress, SLOT(setValue(int)) );
connect( this, SIGNAL(startTimer()), statusTimer, SLOT(start()) );
}
else if( !(flags & PinpadNoProgressFlag) )
{
m_text = new QLineEdit( this );
m_text->setEchoMode( QLineEdit::Password );
m_text->setFocus();
m_text->setValidator( new QRegExpValidator( regexp, m_text ) );
connect( m_text, SIGNAL(textEdited(QString)), SLOT(textEdited(QString)) );
l->addWidget( m_text );
label->setBuddy( m_text );
QDialogButtonBox *buttons = new QDialogButtonBox(
QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal, this );
ok = buttons->button( QDialogButtonBox::Ok );
ok->setAutoDefault( true );
connect( buttons, SIGNAL(accepted()), SLOT(accept()) );
connect( buttons, SIGNAL(rejected()), SLOT(reject()) );
l->addWidget( buttons );
textEdited( QString() );
}
}