Results 1 to 4 of 4

Thread: About Progress bar

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default About Progress bar

    I have a class that contains ProgressBar. On another interface when I pressed the button, it will perform the reading of data and pour on the board. I will call it class ProgressBarbar to display the time it made it finished I will close the progress bar behind you. I do not know why sometimes the progress bar was run forever made without closing it. It appears with a low rate. Expect people to explain me, maybe because I use the progress bar wrong.

    code this:

    Qt Code:
    1. void TopMenu::onbtLoadData_clicked()
    2. {
    3.  
    4. if(mDialog==NULL)
    5. {
    6. mDialog= new ThanhDialogTable(NULL);
    7. mDialog->exec();
    8. delete mDialog;
    9. mDialog = NULL;
    10. }
    11. }
    To copy to clipboard, switch view to plain text mode 

    class ThanhDialogTable:
    Qt Code:
    1. ThanhDialogTable::ThanhDialogTable(QWidget *parent):
    2. QDialog(parent),
    3. ui(new Ui::ThanhDialogTable)
    4. {
    5. ui->setupUi(this);
    6. QFuture<void> *m_future = new QFuture<void>;
    7. m_SimpleProgress = new SimpleProgressBar();
    8. m_SimpleProgress->SetContent("Load Data......");
    9. *m_future = QtConcurrent::run(ThanhDialogTable::loadData, m_SimpleProgress);
    10. m_SimpleProgress->exec();
    11. }
    To copy to clipboard, switch view to plain text mode 


    and loadData of ThanhDialogTable
    Qt Code:
    1. bool ThanhDialogTable::loadData(FiSK_SimpleProgressBar *pProgress)
    2. {
    3. /* Here I call to read data to get one list data from the database and then
    4.   I put that data into the table and display */
    5. QString select("No, Name1, Name2");
    6. QStringList labels = select.split(", ");
    7. ui->m_table->setColumnCount(labels.count());
    8. ui->m_table->setHorizontalHeaderLabels(labels);
    9. QList<int> columnWidths;
    10. columnWidths << 49 << 129 << 99;
    11. ui->m_table->setColumnWidth(ColumnType::No, columnWidths[ColumnType::No]);
    12. ui->m_table->setColumnWidth(ColumnType::Name1, columnWidths[ColumnType::Name1]);
    13. ui->m_table->setColumnWidth(ColumnType::Name2, columnWidths[ColumnType::Name2]);
    14. QTableWidgetItem *item_name1;
    15. QTableWidgetItem *item_name2 ;
    16. QTableWidgetItem *item_No;
    17. int count = m_ListData.size();
    18. ui->m_table->setRowCount(count);
    19.  
    20. for (int i = 0; i < count; i++)
    21. {
    22. item_name1 = new QTableWidgetItem ();
    23. item_name2 = new QTableWidgetItem ( );
    24. item_No = new QTableWidgetItem ( );
    25. item_No ->setText(QString::number(i+1));
    26. item_name1->setText(m_ListData.at(i).mName1);
    27. item_name2->setText(m_ListData.at(i).mName2);
    28. ui->m_table->setItem(i,0,item_No);
    29. ui->m_table->setItem(i,1,item_name1);
    30. ui->m_table->setItem(i,2,item_name2);
    31. }
    32.  
    33. //Close progress bar
    34. pProgress->hide();
    35. pProgress->close();
    36. }
    To copy to clipboard, switch view to plain text mode 

    Please help me and sympathetic English in the level.
    Last edited by anda_skoa; 13th September 2015 at 08:36. Reason: changed [quote] to [code]

Similar Threads

  1. progress bar in QThreads
    By jackajack01 in forum Qt Programming
    Replies: 2
    Last Post: 25th August 2012, 00:43
  2. How to use progress bar
    By bijay in forum Newbie
    Replies: 1
    Last Post: 28th March 2012, 10:44
  3. How to use progress bar
    By Ashwani in forum Newbie
    Replies: 6
    Last Post: 10th September 2010, 15:19
  4. Replies: 4
    Last Post: 11th March 2008, 11:44
  5. Reg - Progress bar
    By suresh in forum Qt Programming
    Replies: 1
    Last Post: 12th December 2006, 15:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.