[問題] GUI的TextBrowser設計

看板C_and_CPP (C/C++)作者 (吉他手)時間13年前 (2012/11/09 17:05), 編輯推噓0(004)
留言4則, 3人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) GCC 問題(Question): 在GUI裡 有個 Button 跟 一個 TextBrowser button 的click()放了很多functions 然後TextBrowser要在每個function結束後秀出訊息 例如 void mainwindow::Button_click() { function1(); // 10 sec computaion time ui->textBrowser->append("function 1 is finished"); function2(); // 15 sec computaion time ui->textBrowser->append("function 2 is finished"); function3(); // 5 sec computaion time ui->textBrowser->append("function 3 is finished"); } 但這3行訊息秀在TextBrowser 是等3個function都跑完 30秒後才會一起出現 要怎麼設計才會一行一行照進度秀 類似 progress bar那樣可以分出進度 也就是 第10秒秀第一行 第25秒秀第二行 第30秒秀第3行 感謝~~~~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 161.130.178.168

11/09 19:14, , 1F
你可以開另外一個 thread 來執行這些 functions
11/09 19:14, 1F

11/09 19:16, , 2F
或是在 append 以後直接先 paint
11/09 19:16, 2F

11/10 03:57, , 3F
OK我來試試看 !!!
11/10 03:57, 3F

11/12 14:35, , 4F
插幾行QCoreApplication::processEvents();試試
11/12 14:35, 4F
文章代碼(AID): #1GdCS-pX (C_and_CPP)
文章代碼(AID): #1GdCS-pX (C_and_CPP)