PDA

View Full Version : Application Lockup poping up dialog



Tommytrojan
28th April 2006, 18:10
I ran into a problem with poping up a dialog window (a simple message box will do) while the application is moved (by the user using the mouse and dragging the application).
I narrowed it down to a few lines of code (attached, I'm using PyQt but I'm sure this will be the same for the C++ interface).

Basically I pop up a simple dialog in a timer event. If the application is just sitting there everything is fine and the dialog pops up and the user can acknowledge it just fine. However, if the user holds down the mouse button on the application caption (starting of a drag operation) while the timer expires and the dialog pops up the entire application is frozen. Not only the application but all applications on the desktop are frozen. It seems like the mouse is captured and not released properly. I can close the dialog by pushing the ESC button. This will also allow to interact with all other applications.

I'm using Windows XP, Qt 3.3.1. I tested with Qt 2.3.0 and this does not occur, mostly due to the fact that the timer stops while dragging the window and therefore the dialog never pops up while the mouse is held down on the application.

Any solutions would be highly appreciated.

Thanks,
Tommy






import sys
import qt

class TMainWindow(qt.QMainWindow):
def __init__(self, *args):
qt.QMainWindow.__init__(self, *args)

self.label = qt.QLabel(self)
self.c=0

self.oTimer = qt.QTimer(self)
self.connect(self.oTimer, qt.SIGNAL('timeout()'), self.fOnTimer)
self.oTimer.start(100)

def closeEvent(self, e):
oApp.quit()

def fOnTimer(self):
self.c +=1
self.label.setText('%d' % self.c)

if self.c == 50:
qt.QMessageBox.critical(self, 'caption', 'lockup...')

oApp = qt.QApplication(sys.argv)
oMainWindow = TMainWindow(None, 'Main Window')
oMainWindow.show()
oApp.exec_loop()

jacek
28th April 2006, 19:17
I have Qt 3.3.6 and PyQt 3.15.1 and everything is fine.

Tommytrojan
28th April 2006, 19:32
Are you holding down the mouse on the title bar of the app while the dialog is popping up?

Thomas

jacek
28th April 2006, 19:46
Are you holding down the mouse on the title bar of the app while the dialog is popping up?
Yes and everything is fine --- message box pops up, counter still counts and I can move both windows.

Tommytrojan
28th April 2006, 19:54
Thanks. I will upgrade to the version you said you are running.

Tommy

kishor_ys
30th July 2007, 05:35
I am getting error in 2nd line

import qt

Getting error like below:
unresolved symbol qt

What could be the problem?

Error Description is:

Traceback (most recent call last):
File "D:\users\PyQtWorkspace\test\src\testpkg\TestQt.py", line 2, in <module>
import qt
ImportError: No module named qt

jacek
30th July 2007, 20:44
What could be the problem?
Do you have PyQt installed?