Re: [PyQt] explanatory label in a not uniformly scaled QGraphicsView

2011-02-10 Thread TP
transformation will influence the item's children. -- TP ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] PyQt API 2: equivalent of Null QVariant?

2010-12-21 Thread TP
Hello, I currently use the API 1, and use the isNull() method of QVariant to detect a Null QVariant. This is necessary to detect a NULL value in a database. It seems there is no equivalent in API2 of PyQt. None is used to model an invalid QVariant. But how to model a Null QVariant?

Re: [PyQt] PyQt API 2: equivalent of Null QVariant?

2010-12-21 Thread TP
Phil Thompson wrote: The short answer is that you can't. However... QVariant::isNull() typically delegates to the enclosed data's isNull() method (eg. QString::isNull()). So your example for API v1 will also work for API v2. It gets a bit more complicated if you are also using the

Re: [PyQt] PyQt API 2: equivalent of Null QVariant?

2010-12-21 Thread TP
Phil Thompson wrote: API v1 will be supported until PyQt5 or Python v4. Is it contractual? Why Python v4? It seems to me that nobody knows when Python v4 will appear. Anyway, it seems to be a problem that API2 does not support NULL, even if it corresponds to side cases (as mine). Thanks,

Re: [PyQt] PyQt API 2: equivalent of Null QVariant?

2010-12-21 Thread TP
Erik Janssens wrote: you could just access sql through python instead of through qt, NULL would then correspond to None Thanks. Yes, it is possible to use for example the sqlite3 module, but there are facilities related to the GUI, available when using Qt: QSqlTableModel,

Re: [PyQt] MDI Windows Example

2010-11-24 Thread TP
On Wed, Nov 24, 2010 at 6:26 AM, Арсений Т sen...@gmail.com wrote: Hello.        Ctrl+F4 does not work in examples\mainwindows\mdi\mdi.pyw:    QAction::eventFilter: Ambiguous shortcut overload: Ctrl+F4    (Python 2.5, windows XP, latest PyQt4) ___

Re: [PyQt] QDataWidgetMapper and addMapping with a custom property name: setProperty never called

2010-11-10 Thread TP
If I am right, none of the properties of QTextEdit is virtual. So none can be reimplemented... It is not easy to change the default behavior in these conditions. Finally I have found a solution: using QPlainTextEdit instead of QTextEdit: the default property is plainText, not html as in

[PyQt] QDataWidgetMapper and addMapping with a custom property name: setProperty never called

2010-11-09 Thread TP
Hello, I currently use QDataWidgetMapper with a custom property name: self.mapper.addMapping( widget, index, propertyName ) Now let us look at the private method populate() of src/gui/itemviews/qdatawidgetmapper.cpp (Qt source code): // void QDataWidgetMapperPrivate::populate(WidgetMapper

Re: [PyQt] QDataWidgetMapper and addMapping with a custom property name: setProperty never called

2010-11-09 Thread TP
Phil Thompson wrote: setProperty() isn't virtual so you can't reimplement it in Python. Thanks a lot. And neither can I reimplement it in C++, if I am right. I am not very familiar to C++ programming, now I know what a virtual function is! Julien

Re: [PyQt] Advice requested on MDI Image Viewer with synchronized windows

2010-11-02 Thread TP
On Wed, Oct 27, 2010 at 2:39 PM, Hans-Peter Jansen h...@urpla.net wrote: On Tuesday 19 October 2010, 07:41:55 TP wrote: I'm trying to write my first PyQt program. I eventually plan on creating an open-source PyQt app that explores the use of various image processing operations (using

Re: [PyQt] ANN: PyQt v4.8 and SIP v4.11.2 Released

2010-10-23 Thread TP
On Fri, Oct 22, 2010 at 9:53 AM, Phil Thompson p...@riverbankcomputing.com wrote: PyQt v4.8 and SIP v4.11.2 have been released and are available from the usual places. The highlight of the release is full support for Qt v4.7. The Windows installers now contain a custom build of Qt using the

[PyQt] Advice requested on MDI Image Viewer with synchronized windows

2010-10-18 Thread TP
I'm trying to write my first PyQt program. I eventually plan on creating an open-source PyQt app that explores the use of various image processing operations (using the Leptonica C library http://www.leptonica.com as the underlying image processing engine). One of my initial goals is to be able

Re: [PyQt] Syntax for connecting to QGraphicsScene.changed signal?

2010-10-15 Thread TP
On Fri, Oct 15, 2010 at 1:12 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Thu, 14 Oct 2010 15:37:02 -0700, TP wing...@gmail.com wrote: QGraphicsScene's changed signal is documented as:    void changed (const QListQRectF) The Qt Utility classes and their Python equivalents section

[PyQt] Syntax for connecting to QGraphicsScene.changed signal?

2010-10-14 Thread TP
QGraphicsScene's changed signal is documented as: void changed (const QListQRectF) The Qt Utility classes and their Python equivalents section of Chapter 10 Qt Class Hierarchy of GUI Programming with Python: QT Edition (from http://www.commandprompt.com/community/pyqt/x3738) says: You can

[PyQt] How to tell when QGraphicsView's transformation matrix has been changed?

2010-10-11 Thread TP
I am trying to implement an image processing application that will have multiple image viewers created with a subclass of QGraphicsView. I need to be able to optionally keep all the image viewers in sync with respect to zoom and position as the user clicks on the scrollbars, uses the scroll wheel

Re: [PyQt] How to tell when QGraphicsView's transformation matrix has been changed?

2010-10-11 Thread TP
On Mon, Oct 11, 2010 at 5:18 AM, TP wing...@gmail.com wrote: I am trying to implement an image processing application that will have multiple image viewers created with a subclass of QGraphicsView. I need to be able to optionally keep all the image viewers in sync with respect to zoom

Re: [PyQt] Best way to implement a modular framework?

2010-08-18 Thread TP
On Tue, Aug 17, 2010 at 12:00 PM, Bernard Van Der Stichele bernard_vanderstich...@otpp.com wrote: Hello all, I'm looking for some advice as to the best way of implementing an MDI - like application which is modular. i.e. I want to have a MainWindow host with a menu which dynamically loads a

[PyQt] Best way to implement an Image Viewer?

2010-03-09 Thread TP
I'm using Windows XP, Python 2.6.4, and PyQt 4.7.1. While trying out the example C:\Python26\Lib\site-packages\PyQt4\examples\widgets\imageviewer.pyw, I notice that the more I zoom into an 1553x2653 BW PNG image, the longer it takes to display. This becomes unacceptably long (on the order of a

[PyQt] Confusion about const non-const QImage constructors from raw data

2010-02-19 Thread TP
In http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg18113.html Phil Thompson was asking about the non-const QImage constructor: QImage(uchar *data, int width, int height, int bytesPerLine, Format format); and suggested implementing it using void * as the first argument. However, when

[PyQt] Re: problem with createEditor method of QItemDelegate

2009-08-13 Thread TP
Victor Noagbodji wrote: Hello Julien, to fix it you have to set the contents margins on the layout object. so your code should look like this: qh = QtGui.QHBoxLayout( self ) qh.setContentsMargins(0, 0, 0, 0) self.qlabel = QtGui.QLabel()

[PyQt] problem with createEditor method of QItemDelegate

2009-08-12 Thread TP
Hi, Try the example at the end of this message: it is a table with editable items. This is a modified version of the example spinboxdelegate.py of the PyQt examples (itemviews section). When the user double-clicks on an item, a LabelAndSpinBox instance is created as delegate. The problem is that

[PyQt] Re: setLayout for a QDockWidget

2009-06-29 Thread TP
Andreas Pakulat wrote: Thats not the way to use QDockWidget, please look at the dockwidgets example and the API documentation to find out how to use that properly. The dockwidgets example uses setWidget. Why has QDockWidget a setLayout class if we cannot use it? Qt documentation seems to say

[PyQt] Re: setLayout for a QDockWidget

2009-06-29 Thread TP
TP wrote: The dockwidgets example uses setWidget. Why has QDockWidget a setLayout class if we cannot use it? Excuse me: substitute a setLayout class by a setLayout method, obviously! Sorry -- python -c print ''.join([chr(154 - ord(c)) for c in '*9(9(18%.\ 91+,\'Z4(55l4(']) When

[PyQt] modifying a Qt Class: how to get the equivalent of macro Q_D in PyQt?

2009-06-25 Thread TP
Hi everybody, I have subclassed QComboBox. For example I have changed paintEvent to get a customized look. It works perfectly. But I have also to change the behavior of the mouse wheel on the combo box. For this, I would like to subclass the function wheelEvent of QComboBox (see below its C++

[PyQt] setLayout for a QDockWidget

2009-06-25 Thread TP
Hi, Try the small script below. I cannot manage to do setLayout for a QDockWidget: QDockWidget.setWidget() works correctly, but not QDockwidget.setLayout(), I obtain the following message: QWidget::setLayout: Attempting to set QLayout on QDockWidget , which already has a layout So, with some

[PyQt] disconnect everything connected to an object's signals

2009-06-18 Thread TP
Hi everybody, Qt Assistant says that: Disconnect everything connected to an object's signals: disconnect(myObject, 0, 0, 0) 0 may be used as a wildcard, meaning any signal, any receiving object, or any slot in the receiving object, respectively. But if I do: disconnect(

[PyQt] make an icon disabled while keeping it checked

2009-06-17 Thread TP
Hi everybody, It seems that it is impossible to keep an icon checked and make it disabled with the styles other than the Windows one. Try the following example which uses the Plastique style. Check the blue icon, and then check on the modif button. The blue icon becomes unchecked on my machine,

[PyQt] QSpinBox: behavior on Linux

2009-06-04 Thread TP
Hi everybody, I have detected a strange behavior on Linux with QSpinBox (try the code example below): when the valueChanged( int ) signal is connected to a function that takes some time to execute, sometimes the up and down clickable buttons of the QSpinBox increment and decrement its value by 2

[PyQt] Re: QSpinBox: behavior on Linux

2009-06-04 Thread TP
Mads Ipsen wrote: Yes, this is correct, and I posted a similar question regarding this behavior observed under Linux. The most peculiar thing, is that it works correctly if you select the QLineEdit of the QSpinBox and press the up and down arrows on the keyboard. The problem is, however,

[PyQt] model/view/delegate: data() method called too many times? Performance problem

2009-05-14 Thread TP
Hi everybody, I use model/view/delegate architecture of Qt. I have a problem of slowness in a small example given below. Run the script from a terminal to see all standard output. Try to play with the tree: expand items, click on cells, etc. You will find that the function data is called all the

[PyQt] Re: Re: segfault when using a proxy and SIGNAL( clicked(QModelIndex) )

2009-04-14 Thread TP
Andreas Pakulat wrote: The reason you get a segfault when using a proxy is quite simply that you're trying to access something which doesn't exist. The index you get in cellClicked is not an index of your custom model, its an index of the proxy model, which doesn't have an internal pointer

[PyQt] Re: segfault when using a proxy and SIGNAL( clicked(QModelIndex) )

2009-04-13 Thread TP
Andreas Pakulat a écrit : The reason you get a segfault when using a proxy is quite simply that you're trying to access something which doesn't exist. The index you get in cellClicked is not an index of your custom model, its an index of the proxy model, which doesn't have an internal pointer

[PyQt] Re: segfault when using a proxy and SIGNAL( clicked(QModelIndex) )

2009-04-11 Thread TP
TP a écrit : Could this be a bug in PyQt? Has someone tried my script to check if the segfault is reproducible? Julien ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Re: segfault when using a proxy and SIGNAL( clicked(QModelIndex) )

2009-04-10 Thread TP
TP wrote: The problem seems to be related to qmodelindex, the segfault appears when taking internalPointer method. I have to add that without the proxy (by using directly the model without the proxy), it does not yield any segfault. Could this be a bug in PyQt? Thanks -- python -c print

[PyQt] segfault when using a proxy and SIGNAL( clicked(QModelIndex) )

2009-04-09 Thread TP
Hi everybody, Here you will find a small (170 lines) self-contained Python script. http://paratribulations.free.fr/help/python/simpleproxy.py I use a model, and a proxy (that does nothing, but in a more complicated version, not given here, it works perfectly). The view is a QTreeView. The

[PyQt] coloring a QDialog

2009-04-08 Thread TP
Hi everybody, To color a QDialog (for example), I can do: from PyQt4.QtCore import * from PyQt4.QtGui import * import sys app = QApplication( sys.argv ) dialog = QDialog( ) dialog.palette().background().setColor(Qt.blue) # @ dialog.show() app.exec_() But if I replace the line @ by:

[PyQt] Re: QComboBox: display an item different from the chosen one in the QListView

2009-03-28 Thread TP
TP wrote: So I have tried to play with a lot of methods provided by QComboBox, without success (for example, currentText, setItemText, etc.). For those that are interested, or Qt beginners like me: by examining Qt C++ source code, I have finally found a solution: I have specialized paintEvent

[PyQt] Re: model/view/delegate: keep the index of the item during edition with a QSpinBox

2009-03-18 Thread TP
TP wrote: http://paratribulations.free.fr/help/python/integerdelegate_question.py Has someone tried my example? Julien -- python -c print ''.join([chr(154 - ord(c)) for c in '*9(9(18%.\ 91+,\'Z4(55l4(']) When a distinguished but elderly scientist states that something is possible, he

[PyQt] QComboBox: display an item different from the chosen one in the QListView

2009-03-18 Thread TP
Hi everybody, I want to specialize a QComboBox. I take a dummy example: if there are the following choices in the QListView provided by the QComboBox: toto titi tutu I want that if the user chooses toto, to display toto has been chosen in the QComboBox. If the user chooses titi, then I want to

[PyQt] model/view/delegate: keep the index of the item during edition with a QSpinBox

2009-03-16 Thread TP
Hi everybody, I have adapted the tree example using model/view/delegate proposed in the book of Summerfield (p.492-504): I obtain a custom tree widget. In my custom tree widget, I want to be able to add children by setting the number of children of a parent; this is done with a delegate using a