2016-09-20 49 views

回答

0

我發現遍歷所有QWindow s,並檢查多個與isExposed() == true處理我所做的一切,除了本地Mac對話框(另存爲,打印和打開文件)。所以這似乎足以滿足我的需求:

bool found_exposed_window = false; 
    foreach (QWindow *window, qApp->allWindows()) { 
    if (window->isExposed()) { 
     if (found_exposed_window) { 
     // This is the second exposed window, meaning the user has something 
     // open in addition to the main form. 
     // So, don't try to load a file. 
     return; 
     } 

     found_exposed_window = true; 
    } 
    } 
相關問題