Home > Mobile >  Why my progress bar 100 haven't full
Why my progress bar 100 haven't full

Time:11-25

As shown, why my progress bar are 100 why still unhappy?

 # include "progressdlg. H" 

ProgressDlg: : ProgressDlg (QWidget * parent)
: QDialog (parent)
{
QFont font (" ZYSong18030 ", 12);
The setFont (font);
SetWindowTitle (tr (" Progress "));
FileNum=new QLabel;
FileNum - & gt; SetText (tr (" file number: "));
FileNumLineEdit=new QLineEdit;
FileNumLineEdit - & gt; SetText (tr (" 10000 "));
ProgressType=new QLabel;
ProgressType - & gt; SetText (tr (" display type "));
ComboBox=new QComboBox;

ComboBox - & gt; AddItem (tr (" ProgressDlg "));
ComboBox - & gt; AddItem (tr (" ProgressBar "));
ProgressBar=new QProgressBar;
StarBtn=new QPushButton;
StarBtn - & gt; SetText (tr (" start "));
MainLayout=new QGridLayout (this);
MainLayout - & gt; AddWidget (FileNum, 0, 0);
MainLayout - & gt; AddWidget (FileNumLineEdit, 0, 1);
MainLayout - & gt; AddWidget (ProgressType, 1, 0);
MainLayout - & gt; AddWidget (comboBox, 1, 1);
MainLayout - & gt; AddWidget (progressBar, 2, 2);
MainLayout - & gt; AddWidget (starBtn, 3, 1);
//mainLayout - & gt; SetMargin (15);
//mainLayout - & gt; SetSpacing (10);
The connect (starBtn, SIGNAL (clicked ()), and this, SLOT (startProgress ()));



}

Void ProgressDlg: : startProgress ()
{
Bool ok;
Int num=FileNumLineEdit - & gt; The text (). ToInt (& amp; "Ok");

ProgressBar - & gt; SetRange (0, num);
For (int I=1; I & lt; Num + 1; I++) {
ProgressBar - & gt; SetValue (num);
}

}
ProgressDlg: : ~ ProgressDlg ()
{

}

CodePudding user response:

With the style of?

CodePudding user response:

I use your program test, there is no problem!

CodePudding user response:

Void ProgressDlg: : startProgress ()
{
Bool ok;
Int num=FileNumLineEdit - & gt; The text (). ToInt (& amp; "Ok");

ProgressBar - & gt; SetRange (0, num);
QCoreApplication: : processEvents ();
for (int i=0; I & lt; Num + 1; I++) {
ProgressBar - & gt; SetValue (I);
QCoreApplication: : processEvents ();
}

}

CodePudding user response:

The method I tried 3 buildings, or not

CodePudding user response:

Beer, I want to make this effect, you can't get

CodePudding user response:

QProgressBar setting value is 100, you should fill, are not full, should be set up a stylesheet, you can try to get rid of, or look at the layout, try to separate layout
  •  Tags:  
  • Qt
  • Related