本文整理汇总了C++中QProgressBar::minimum方法的典型用法代码示例。如果您正苦于以下问题:C++ QProgressBar::minimum方法的具体用法?C++ QProgressBar::minimum怎么用?C++ QProgressBar::minimum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProgressBar
的用法示例。
在下文中一共展示了QProgressBar::minimum方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setValue
/*!
Sets the current value to \a value.
\bold {Note:} Calling this slot by hand has no effect.
Connect this slot to QProgressBar::valueChange().
*/
void QxtProgressLabel::setValue(int value)
{
QProgressBar* bar = qobject_cast<QProgressBar*>(sender());
if (bar)
{
if (!qxt_d().start.isValid())
restart();
qxt_d().cachedMin = bar->minimum();
qxt_d().cachedMax = bar->maximum();
qxt_d().cachedVal = value;
refresh();
}
}
示例2: 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;
text += tr("Selected action requires sign certificate.") + "<br />" +
(flags & PinpadFlag ?
tr("For using sign certificate enter PIN2 with pinpad") :
tr("For using sign certificate enter PIN2") );
regexp.setPattern( "\\d{5,12}" );
}
else
{
_title = tr("Authendicating") + " - " + title;
text += tr("Selected action requires auth certificate.") + "<br />" +
(flags & PinpadFlag ?
tr("For using auth certificate enter PIN1 with pinpad") :
tr("For using auth certificate enter PIN1") );
regexp.setPattern( "\\d{4,12}" );
}
setWindowTitle( _title );
label->setText( text );
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
{
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 );
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() );
}
}
示例3: if
void
Progress::timerEvent(QTimerEvent * event)
{
if (event->timerId() != timer.timerId() || noAnimations())
return;
//Update the registered progressbars.
Items::iterator iter;
QProgressBar *pb;
bool mkProper = false;
animationUpdate = true;
for (iter = items.begin(); iter != items.end(); iter++)
{
QWidget *w = const_cast<QWidget*>(iter.key().data());
if (!w) // not a progressbar - shouldn't be in items, btw...
{ mkProper = true; continue; }
pb = qobject_cast<QProgressBar*>(w);
if (!pb)
continue; // not a progressbar - shouldn't be in items, btw...
if (pb->maximum() != 0 || pb->minimum() != 0 || pb->paintingActive() || !pb->isVisible())
{
pb->setAttribute(Qt::WA_OpaquePaintEvent, false);
continue; // no paint necessary
}
pb->setAttribute(Qt::WA_OpaquePaintEvent);
++iter.value();
// dump pb geometry
int x,y,l,t, *step = &iter.value()._step;
if ( pb->orientation() == Qt::Vertical ) // swapped values
pb->rect().getRect(&y,&x,&t,&l);
else
pb->rect().getRect(&x,&y,&l,&t);
if (*step > l/_speed)
*step = l/36-(int)(l/_speed);
else if (*step == -1)
*step = l/36-1;
int s = qMin(qMax(l / 10, 16), qMin(t, 20));
int ss = (3*s)/4;
int n = l/s;
if ( pb->orientation() == Qt::Vertical)
{ x = pb->rect().bottom(); x -= (l - n*s)/2 + ss; /*s = -s;*/ }
else
{ x += (l - n*s)/2; /*s = qAbs(s);*/ }
x += qMax((int)(_speed*qAbs(*step)*n*s/l) - s, 0);
if ( pb->orientation() == Qt::Vertical )
pb->repaint(y,x-s,s,3*s);
else
pb->repaint(x-s,y,3*s,s);
}
animationUpdate = false;
if (mkProper)
_release(NULL);
}