Re: [PyQt] QTableWidgetItem editingFinished
2009/7/6 Mario Daniel Carugno carug...@gmail.com: It works exactly like the QLineEdit, because the widget it calls IS a QLineEdit (really not always: if it is a number it calls a QSpinBox or a QDoubleSpinBox, if it is a date a QDateEdit or a QDateTimeEdit etc...). The widget is returned by the function QTableWidget.itemDelegate(). Thank you for help. Do that mean that i must create a model to handle that ? I think it's not necessary. For example, I write for a project of mine this ViewDelegate class: class ViewDelegate(QItemDelegate): def __init__(self, parent = None): super(ViewDelegate, self).__init__(parent) self.parent = parent def createEditor(self, parent, option, index): editor = QItemDelegate.createEditor(self, parent, option, index) if isinstance(editor, QLineEdit) and index.column() in (4, 5): self.connect(editor, SIGNAL(editingFinished()), self.commitAndCloseEditor) elif isinstance(editor, QLineEdit) and index.column() == 2: self.connect(editor, SIGNAL(editingFinished()), self.parent.setTip) return editor def commitAndCloseEditor(self): editor = self.sender() # this signal is emitted for saving the data into the model self.emit(SIGNAL(commitData(QWidget*)), editor) # this signal is emitted to close the editor widget self.emit(SIGNAL(closeEditor(QWidget*)), editor) #do some action In the init code of the window I have called: self.view.setItemDelegate(ViewDelegate(self)) where self.view is the QTableView and self is the parent (a QMainWindow class). I'm a newbie yet, it sounds very difficult to me. Anyway, I guess i need to learn more on that topic, thank you Simozack ! IMHO it's not so difficult once you have understood the logic behind the scene of QT. HTH, Simone ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Multiple QMainWindow
I'm new in python and pyQt. I try to launch a second MainWindow from a first MainWindow but it doesn't work. The widget just pops and disappears immediatly. The following code works but that's not what I want... /usr/bin/python #-*-coding: utf-8 -*- from PyQt4.QtGui import * from PyQt4.QtCore import * import os,sys #! /usr/bin/python #-*-coding: utf-8 -*- from PyQt4.QtGui import * class fenPrincipale(QMainWindow): def __init__(self): QMainWindow.__init__(self) if __name__==__main__: a=QApplication(sys.argv) f=fenPrincipale() f.show() f2=fenPrincipale() f2.show() sys.exit(a.exec_()) and this one doesn't work: #! /usr/bin/python #-*-coding: utf-8 -*- from PyQt4.QtGui import * from PyQt4.QtCore import * import os,sys #! /usr/bin/python #-*-coding: utf-8 -*- from PyQt4.QtGui import * class fenPrincipale(QMainWindow): def __init__(self): QMainWindow.__init__(self) f2=fenSecondaire() f2.show() class fenSecondaire(QMainWindow): def __init__(self): QMainWindow.__init__(self) if __name__==__main__: a=QApplication(sys.argv) f=fenPrincipale() f.show() sys.exit(a.exec_()) Could you help me ?? many thanks. -- View this message in context: http://www.nabble.com/Multiple-QMainWindow-tp24369800p24369800.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Opening a new QWidget window via a SLOT
In my code I have a menubar with an action titled 'Display settings'. This action has a 'triggered()' signal and I have a slot that I'd like to open a QWidget window where I can display information. Is this possible? I've googled for a couple of days now and found no examples of this (they are mostly associated with creating multiple main windows). I am fairly new to this so any help would be appreciated. Adriano -- View this message in context: http://www.nabble.com/Opening-a-new-QWidget-window-via-a-SLOT-tp24370587p24370587.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: question about resizing behavior
On Tue, Jul 7, 2009 at 2:50 AM, Ole Streicher ole-usenet-s...@gmx.netwrote: Hi Darren, Darren Dale dsdal...@gmail.com writes: Nice demonstration of the problem Ole. I notice that if, after resizing, I pause briefly before releasing the mouse button, the scroll bar is more likely to resize properly. The problem is much more apparent if I release the mouse button immediately after resizing or while still dragging the window edge. Unfortunately the user will not be aware of that :-( Do you count it as a bug in matplotlib, in PyQt, or in Qt? I don't know, that's why I posted here asking for help. So far we have only described what is the problem. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] setting tab order custom widget
Hi *, I've made a custom widget (a QCheckBox and a QToolButton side by side) based on QWidget (similar to David Boddie's GeolocationWidget from QQ26), and would like to set the tab order. Unfortunately, designer simply ignores my widgets in the tab order editing mode (again similar behavior to David's widget). Anybody with an idea, what designer needs to consider our widgets in tab order setting? I tried to duck type my widget as a QCheckBox with checkable, checked, text properties, but nothing takes an effect on this issue. Thanks for any clues, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
RE: [PyQt] Opening a new QWidget window via a SLOT
Ok, I've found the Multiple-Display Interface and it looks perfect for my needs. Thanks to the official book on PyQt (Rapid GUI Programming.. Etc.), which is extremely useful and appears to be well worth the money. === Adriano Gagliardi MEng PhD Project Scientist Computational Aerodynamics Aircraft Research Association Ltd. Manton Lane Bedford Tel: 01234 32 4644 E-mail: agaglia...@ara.co.uk Url: www.ara.co.uk -Original Message- From: pyqt-boun...@riverbankcomputing.com [mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of AdrianoG Sent: 07 July 2009 11:20 To: pyqt@riverbankcomputing.com Subject: [PyQt] Opening a new QWidget window via a SLOT In my code I have a menubar with an action titled 'Display settings'. This action has a 'triggered()' signal and I have a slot that I'd like to open a QWidget window where I can display information. Is this possible? I've googled for a couple of days now and found no examples of this (they are mostly associated with creating multiple main windows). I am fairly new to this so any help would be appreciated. Adriano -- View this message in context: http://www.nabble.com/Opening-a-new-QWidget-window-via-a-SLOT-tp24370587p243 70587.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt --- This email contains information that is private and confidential and is intended only for the addressee. If you are not the intended recipient please delete it and notify us immediately by e-mailing the sender. Note: All email sent to or from this address may be accessed by someone other than the recipient, for system management and security reasons. Aircraft Research Association Ltd. Registered in England, Registration No 503668 Registered Office: Manton Lane, Bedford MK41 7PF England VAT No GB 196351245 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] setting tab order custom widget
Am Dienstag, 7. Juli 2009 schrieb Hans-Peter Jansen: Hi *, I've made a custom widget (a QCheckBox and a QToolButton side by side) based on QWidget (similar to David Boddie's GeolocationWidget from QQ26), and would like to set the tab order. Unfortunately, designer simply ignores my widgets in the tab order editing mode (again similar behavior to David's widget). Anybody with an idea, what designer needs to consider our widgets in tab order setting? I tried to duck type my widget as a QCheckBox with checkable, checked, text properties, but nothing takes an effect on this issue. Got it, forgot about the focus policy! Time to get rid of my flu :-(.. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: question about resizing behavior
Hi Ole, On Tue, Jul 7, 2009 at 11:33 AM, Ole Streicher ole-usenet-s...@gmx.netwrote: Hi again, Darren Dale dsdal...@gmail.com writes: Nice demonstration of the problem Ole. I notice that if, after resizing, I pause briefly before releasing the mouse button, the scroll bar is more likely to resize properly. The problem is much more apparent if I release the mouse button immediately after resizing or while still dragging the window edge. I already created a Qt bug report for that (issue number #255433, not public for some reason). They asked me to compile a C++ only variant of the bug. However, I could not reproduce the problem in C++: the events occure here always in-order independent of the processing times in the (simulated) inner widget resize time. I could also not reproduce the bug in PyQt4 without matplotlib by replacing the FigureCanvasQTAgg with a QFrame and adding some random sleep to the resize function. But, with some stacktracing, I found the reason: in matplotlib.FigureCanvasQTAgg, the following piece of code is called on a resizeEvent: def draw( self ): # ... some internal code # Added following line to improve realtime pan/zoom on windows: QtGui.qApp.processEvents() This makes the problem clear: - if we resize the window quickly, several resizeEvents are created and are in the event queue of Qt - the first one gets processed by the QVBoxLayout which starts the processing in its first (matplotlib) widget. - the matplotlib widget does what it should and at some point calls matplotlib.FigureCanvasQTAgg.draw(self). - this starts the processing of the next event in the queue which is the next (2nd) resize event. BUT: we are still in the processing of the first event!!! - the 2nd event goes to the QVBoxLayout, from there to the matlotlib widget (eventually starting some recursive behaviour here) - if the 2nd event is finished, QVBoxLayout sends it to its other widget (the scrollbar). The scrollbar is resized according to the *2nd event*. - if the processing of the 2nd event was finished and no more events are in the queue, the matplotlib.FigureCanvasQTAgg.draw() finishes - at the end, this will finish the processing of the first resize event in the matplotlib widget and start the *first resize event* for the scrollbar This is exactly the behaviour that I described in my first posting. It is caused by the QtGui.qApp.processEvents() call in the draw() function. So, I think this is clearly a bug in matplotlib: QtGui.qApp.processEvents() should not be called while processing another event. Darren, I dont know your position with respect to matplotlib: are you a developer and thus aware of the bug or shall I post this again on the matplotlib mailing list? I am a developer, but I think it would be good to post your summary there at the matplotlib mailing list so we can continue this discussion there. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: question about resizing behavior
Hi guys, I'm also working with PyQt and matplotlib, and reported some weird resize behavior on the matplotlib mailing list a few days ago. I dug around a bit and thought that something was going on with QtGui.qApp.processEvents(), but it's nice to see that someone actually took the time to *really* understand what's going onnice work Ole! I'm on a Mac with OS X 10.5.7, and see some different behavior from you guys (I think) because the attached code worked fine for me. In any case, I'll follow this thread on the MPL list, and would be happy to help out get this fixed. BZ On Tue, Jul 7, 2009 at 9:48 AM, Darren Dale dsdal...@gmail.com wrote: Hi Ole, On Tue, Jul 7, 2009 at 11:33 AM, Ole Streicher ole-usenet-s...@gmx.netwrote: Hi again, So, I think this is clearly a bug in matplotlib: QtGui.qApp.processEvents() should not be called while processing another event. Darren, I dont know your position with respect to matplotlib: are you a developer and thus aware of the bug or shall I post this again on the matplotlib mailing list? I am a developer, but I think it would be good to post your summary there at the matplotlib mailing list so we can continue this discussion there. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Problem regarding setting text of QTextEdit in a separate thread
Hello friends,I am writing an application to read data from serial port and display it on the screen using a QTextEdit widget. Since I'll have to poll the serial port to check for arrival of data, I have created the widgets in the main thread of the program and created a separate thread for reading data. However when I try to update text of TextEdit using its setText() method in the new thread, I get the following error: QObject: Cannot create children for parent that is in different thread Searching on the net made me realize that setting the text in a separate thread is not supported in pyQT. Is there any work-around for this problem? I request you to suggest me any alternative method to find a solution for my problem. Thanks for your help. -- Regards, Shine Jose ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] setting tab order custom widget
Am Dienstag, 7. Juli 2009 schrieb David Boddie: On Tue Jul 7 15:20:02 BST 2009, Hans-Peter Jansen wrote: Am Dienstag, 7. Juli 2009 schrieb Hans-Peter Jansen: Anybody with an idea, what designer needs to consider our widgets in tab order setting? I tried to duck type my widget as a QCheckBox with checkable, checked, text properties, but nothing takes an effect on this issue. Got it, forgot about the focus policy! Time to get rid of my flu :-(.. Hmm. It would be good to update the article to mention that, or to update the example, at the very least. Possibly the best course of action would be to add something to the discussion page for the article on Qt Centre: http://wiki.qtcentre.org/index.php?title=Designing_Custom_Controls_with_P yQt Will do, when I figured, what's wrong with my account, which doesn't allow me to login to the wiki area... BTW, I succeeded with a combination of: self.setFocusProxy(self._firstEditable) self.setFocusPolicy(QtCore.Qt.TabFocus) Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] unsupported buffer type
Hi there, i have a little problem with my PyQt development. It uses MySQL. Under Linux, everything is fine. Under Windows... the first query it tries gives an error like this: # using unsupported buffer type: 253 I'm using the latest pyqt binary for windows with Python 2.6 and Mysql 5.0. Could be a mysql error ? Has someone faced it ? Thanks ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt