2017-01-24 20 views
1

저는 PyQt4 4.11.4 (Qt 4.8.7) 및 Python 2.7.12를 사용하여 앱을 작성하고 있습니다. RemoteApp (기본 제공 Windows 원격 데스크톱 서비스)를 사용하여 실행하면 최대화 상태로 창을 열 수 없습니다. 몇 개의 (단일?) 프레임에 대해 최대화 된 것으로 나타나며 즉시 복원 된 상태로 점프합니다. 코드 버그를 재현하기 :Qt4 over RDP (RemoteApp)를 사용하여 최대화 된 창을 열 수 없습니다.

from PyQt4.QtGui import QApplication, QDialog 
from PyQt4.QtCore import Qt 
import sys 


app = QApplication(sys.argv) 
w = QDialog() 
w.setWindowFlags(Qt.Window) 
w.showMaximized() 
w.show() 
sys.exit(app.exec_()) 

버그가 파이썬 2.6.4과 Qt는 4.5.3 (응용 프로그램은 pyInstaller 중에 함께 내장되어 내가 PyQt는 버전을 얻을 수있는 방법을 찾을 수 없습니다) 재현 할 수 없습니다.

내가 찾은 비슷한 버그 (유일한지 확실하지 않음)에 대한 유일한 언급은 here입니다.

이 버그에 대한 수정 프로그램이 있습니까? 이전 Qt 버전을 솔루션으로 사용하는 것을 고려하지 않았습니다.

UP1 : 위의 코드 단편은 C++로 다시 작성된 동일한 동작을 생성하므로 Qt 버그입니다.

UP2 : Qt는 4.5 그렇지 않은 동안 Qt는 4.8 윈도우, WS_POPUPWS_combine_POPUPWINDOW 스타일이 있습니다. this one을 수정하는 동안 버그가 도입되었을 가능성이 있습니다.

UP3 : 예, 문제는 WS_POPUP입니다. 수동으로 제거한 후 창을 최대화 상태로 유지 :

... 
HWND hWnd = w.winId(); 
long style = GetWindowLong(hWnd, GWL_STYLE); 
SetWindowLong(hWnd, GWL_STYLE, style & ~WS_POPUP); 
... 

그것을 제거하는 다른 방법을 검색하고 있습니다 ... Qt는을이 패치를 되돌리고 재 구축하여 해결

답변

0

문제 :

diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp 
index 39ed750..c358b9b 100644 
--- a/src/gui/kernel/qwidget_win.cpp 
+++ b/src/gui/kernel/qwidget_win.cpp 
@@ -329,18 +329,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO 
     if (topLevel) { 
      if ((type == Qt::Window || dialog || tool)) { 
       if (!(flags & Qt::FramelessWindowHint)) { 
-     if (!(flags & Qt::MSWindowsFixedSizeDialogHint)) { 
+     style |= WS_POPUP; 
+     if (!(flags & Qt::MSWindowsFixedSizeDialogHint)) 
         style |= WS_THICKFRAME; 
-      if(!(flags & 
-       (Qt::WindowSystemMenuHint 
-       | Qt::WindowTitleHint 
-       | Qt::WindowMinMaxButtonsHint 
-       | Qt::WindowCloseButtonHint 
-       | Qt::WindowContextHelpButtonHint))) 
-       style |= WS_POPUP; 
-     } else { 
-      style |= WS_POPUP | WS_DLGFRAME; 
-     } 
+     else 
+      style |= WS_DLGFRAME; 
       } 
       if (flags & Qt::WindowTitleHint) 
        style |= WS_CAPTION; 
@@ -424,6 +417,14 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO 
      if (!q->testAttribute(Qt::WA_Resized)) { 
       w = sw/2; 
       h = 4*sh/10; 
+    if (extra) { 
+     int dx = rect.right - rect.left; 
+     int dy = rect.bottom - rect.top; 
+     w = qMin(w, extra->maxw + dx); 
+     h = qMin(h, extra->maxh + dy); 
+     w = qMax(w, extra->minw + dx); 
+     h = qMax(h, extra->minh + dy); 
+    } 
      } 
      if (!wasMoved) { 
       x = sw/2 - w/2; 

here

발견을