2013-09-29 21 views
0

在我的項目中,我有一個函數在QProgressDialog顯示進度的同時運行。QProgressDialog在另一個進程啓動時「關閉」

QProgressDialog progress("Saving savegame.dat...", "Abort Save", 0, 3016, this); 
     progress.setWindowModality(Qt::WindowModal); 

//... some loops and other calculations run while I update the progress bar with: 
progress.setValue(1000); 

一切都很好,直到我開始另一個過程。 (打開一個命令行程序)

QProcess decomBR; 
QStringList filePathListBR; 
filePathListBR.append("-o"); 
filePathListBR.append("stuff\\compress.bms"); 
filePathListBR.append("stuff\\regions\\xbox_chunks\\br"); 
filePathListBR.append("stuff\\regions\\xbox_chunks\\br"); 
decomBR.start("stuff\\quickbms.exe", filePathListBR); 
decomBR.waitForFinished(); 

由於爲這樣的過程一旦啓動,不再顯示進度條對話框隱藏或東西和進步,但仍流程運行良好。

任何方式來防止這些進程「關閉」QProgressDialog?

編輯:顯然,對話框不關閉,它只是主窗口優先和「覆蓋」對話框......如果這是有道理的。有沒有辦法讓對話框保持顯示優先?

感謝您的時間:)

回答

0

我沒有試過,但setWindowFlags(Qt::WindowStaysOnTopHint);可能會有幫助。請注意,這是一個標誌,所以你會想要寫的東西,如:

progress.setWindowsFlags(progress.getWindowsFlags() | Qt::WindowStaysOnTopHint); 

考慮使用斷言,看它是否已經設置,如果是這樣,那麼你可以肯定地解僱我的答案,並加入到由否定人類的知識!

相關問題