Home > Mobile >  On the arm board mass loading custom controls QScrollAre showed slow problem
On the arm board mass loading custom controls QScrollAre showed slow problem

Time:11-20

Load data:
QMap : : Iterator it;
QString STR="";
int i=0;
The QStringList list;
For (it=mapFile. The begin (); It!=mapFile. End (); It++) {
STR=it. The value ();
List=STR. Split (";" );
Emit the fileInfo (list, I);
i++;
}

Display:
Void slot {
Ui: : CKMMain_template_record_item item_ui;
QWidget * PWDG=new QWidget ();
Item_ui. SetupUi (PWDG);
Item_ui. Label_template_record_name - & gt; SetText (list) at (0));
Item_ui. Label_template_record_modify_time - & gt; SetText (list) at (1) + "" + QString: : number (index));
if(! The UI - & gt; ScrollArea - & gt; WidgetResizable ()) UI - & gt; ScrollArea - & gt; SetWidgetResizable (true);
PWDG - & gt; SetParent (UI - & gt; ScrollArea);
QLayout * layout=UI - & gt; ScrollArea - & gt; The widget () - & gt; Layout ();
if(! Layout) {
QGridLayout * gridLayout=new QGridLayout ();
GridLayout - & gt; SetVerticalSpacing (1);
GridLayout - & gt; SetContentsMargins (0, 0, 0, 0);
GridLayout - & gt; SetAlignment (Qt: : AlignTop | Qt: : AlignLeft);
The UI - & gt; ScrollArea - & gt; The widget () - & gt; SetLayout (gridLayout);
}

QGridLayout * gridLayout=qobject_cast & lt; QGridLayout * & gt; (UI - & gt; ScrollArea - & gt; The widget () - & gt; Layout ());
GridLayout - & gt; AddWidget (PWDG, index, 0,1,1);
}

The above code, after completion of loading the data, it will be a 20 seconds before interface displayed, too slow,
What a great god can give directions, how to make data timely displayed, BuKa interface
  •  Tags:  
  • Qt
  • Related