本文整理汇总了C++中QProgressBar::setFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ QProgressBar::setFormat方法的具体用法?C++ QProgressBar::setFormat怎么用?C++ QProgressBar::setFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProgressBar
的用法示例。
在下文中一共展示了QProgressBar::setFormat方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: slotUpdateProgressAndStatus
void RenderWindow::slotUpdateProgressAndStatus(const QString &text, const QString &progressText,
double progress, cProgressText::enumProgressType progressType)
{
ui->statusbar->showMessage(text, 0);
QProgressBar *progressBar = NULL;
bool isQueue = this->sender() && this->sender()->objectName() == "Queue";
switch (progressType)
{
case cProgressText::progress_IMAGE:
if (isQueue) progressBar = gMainInterface->progressBarQueueImage;
else progressBar = gMainInterface->progressBar;
break;
case cProgressText::progress_ANIMATION:
if (isQueue) progressBar = gMainInterface->progressBarQueueAnimation;
else progressBar = gMainInterface->progressBarAnimation;
break;
case cProgressText::progress_QUEUE:
// nothing to be done, no progress bar for queue in GUI
break;
}
if (progressBar)
{
if (!progressBar->isVisible())
{
progressBar->setVisible(true);
}
progressBar->setValue(progress * 1000.0);
progressBar->setTextVisible(true);
progressBar->setFormat(progressText);
}
}
示例3: appendProgress
void MessageDisplayWidget::appendProgress(const QString &filename, FileTransferState* state, bool isOur)
{
connect(verticalScrollBar(), &QScrollBar::rangeChanged, this, &MessageDisplayWidget::moveScrollBarToBottom, Qt::UniqueConnection);
QProgressBar *row = new QProgressBar(this);
row->setRange(0, 100);
row->setFormat(QString("%1 - %p%").arg(QFileInfo(filename).baseName()));
connect(state, &FileTransferState::progressChanged, row, &QProgressBar::setValue);
mainlayout->addWidget(row);
}
示例4: formatedText
void tst_QProgressBar::formatedText()
{
QFETCH(int, minimum);
QFETCH(int, maximum);
QFETCH(int, value);
QFETCH(QString, format);
QFETCH(QString, text);
QProgressBar bar;
bar.setRange(minimum, maximum);
bar.setValue(value);
bar.setFormat(format);
QCOMPARE(bar.text(), text);
}
示例5: updateProgress
// The void* corresponds to Mantid::API::AlgorithmID, but Qt wasn't coping with
// the typedef
void MonitorDlg::updateProgress(void *alg, const double p, const QString &msg,
double /*estimatedTime*/,
int /*progressPrecision*/) {
m_algMonitor->lock();
const int index = m_algMonitor->algorithms().indexOf(alg);
m_algMonitor->unlock();
if (index == -1)
return;
QTreeWidgetItem *item = m_tree->topLevelItem(index);
if (!item)
return;
QProgressBar *algProgress =
static_cast<QProgressBar *>(m_tree->itemWidget(item, 1));
algProgress->setValue(int(p));
algProgress->setFormat(msg + " %p%");
}
示例6: setupIndicators
void Joysticks::setupIndicators (int row) {
/* Remove all joystick indicators in the widget */
foreach (QSpinBox * b, findChildren<QSpinBox*>()) delete b;
foreach (QPushButton * c, findChildren<QPushButton*>()) delete c;
foreach (QProgressBar * p, findChildren<QProgressBar*>()) delete p;
/* Clear joystick data */
m_axes.clear();
m_povs.clear();
m_buttons.clear();
/* Avoid crashing the application when there are no joysticks */
if (row < 0)
return;
/* Get joystick information */
int povCount = JOYSTICK_MANAGER()->getInputDevice (row).numPOVs;
int axisCount = JOYSTICK_MANAGER()->getInputDevice (row).numAxes;
int buttonCount = JOYSTICK_MANAGER()->getInputDevice (row).numButtons;
/* Make the indicator containers visible */
m_POVIndicators->setVisible (povCount > 0);
m_axisIndicators->setVisible (axisCount > 0);
m_buttonIndicators->setVisible (buttonCount > 0);
/* Create a progress bar for each axis */
for (int i = 0; i < axisCount; ++i) {
QProgressBar* bar = new QProgressBar (this);
bar->setFixedHeight (DPI_SCALE (19));
bar->setValue (0);
bar->setMaximum (100);
bar->setMinimum (-100);
bar->setFormat (tr ("Axis %1").arg (i));
m_axes.append (bar);
m_axesBox->addWidget (bar);
}
/* Create a button for each joystick button */
for (int i = 0; i < buttonCount; ++i) {
QPushButton* button = new QPushButton (this);
button->setEnabled (false);
button->setCheckable (true);
button->setFixedSize (DPI_SCALE (18), DPI_SCALE (12));
button->setToolTip (tr ("Button %1").arg (i));
/* Distribute the button items in a nice layout */
int row = (i <= 7) ? i : i - 8;
int column = (i <= 7) ? 0 : (i / 8);
m_buttons.append (button);
m_buttonsBox->addWidget (button, row, column);
}
/* Create a spinbox for each joystick hat */
for (int i = 0; i < povCount; ++i) {
QSpinBox* box = new QSpinBox (this);
box->setRange (0, 360);
box->setEnabled (false);
m_povs.append (box);
m_povsBox->addWidget (box);
}
}
示例7: main
//.........这里部分代码省略.........
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
epoca = 0;
示例8: 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);
}
}