<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
Roland Schulz schrieb:<br>
<blockquote type="cite" cite="mid1077204195.29997.21.camel@cip2">
<pre wrap="">On Do, 2004-02-19 at 11:55, Ulrich Berning wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Phil Thompson schrieb:
</pre>
<blockquote type="cite">
<pre wrap="">On Wednesday 18 February 2004 19:04, Eron Lloyd wrote:
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
<blockquote type="cite">
<pre wrap="">Nevertheless it makes sense to implement QMetaObject and
QMetaProperty, just in case someone plans to build a kind of dialog
editor with PyQt (in the future, we want to give our customers the
facility to create or modify dialogs or dialog components inside the
application).
</pre>
</blockquote>
<pre wrap=""><!---->
I have done a lib to insert PyQt Widget as Plugin in QtDesinger with
editable properties (if you interested in this search for qtdesinger or
qwidgetplugin in the mail archive or just ask me). Jim, David and Phil
helped me to see that there is no point in implementing QMetaObject in
PyQt but do a Proxy in C++. The main reason were:
There is little use for those MetaObjects functions from Python space.
Even if you write a dialog editor in PyQt you would use the Qt functions
and they would query the MetaObjects. So even in this case those queries
would come from C++ space.
>From C++ space it looks like every class is a object of one of the
wrapper class even if it only indirectly subclass of a wrapper class. So
from C++ space it seams that e.g. a python object of a QWidget class has
the same class as a object of a python class derived from QWidget. Since
most of the MetaObject stuff is done with statics this would complicate
it further.
Like I said, just ask or look at the archives for more information.
regards
Roland
</pre>
</blockquote>
<tt>I'm not talking about Designer plugins or about creating new widget
classes with PyQt, that can be used in a dialog editor. I'm talking
about querying the properties of the existing Qt widget classes.<br>
<br>
If I would build a dialog editor, creating widgets would be done in the
following way:<br>
1.) The user selects a Qt widget class from a toolbox.<br>
2.) The dialog editior creates an instance of that widget class and
places it into the dialog window.<br>
3.) The dialog editor sets up a property editor to modify the
properties of that widget instance.<br>
<br>
In C++, I can use QObject::metaObject() to get the QMetaObject of the
widget.<br>
Then I can do QMetaObject::numProperties() to get the number of
properties and in a loop QMetaObject::property() to get all
QMetaProperty instances.<br>
The QMetaProperty instances have all the necessary informations, needed
to set up a property editor.<br>
This will work for most of the Qt widget classes, only a few widget
classes may need special handling.<br>
In PyQt, I can't do this, because the above classes and methods are not
implemented. The only way to manage this in PyQt, is to write a huge
amount of code for every widget class, to set up a property editor for
that widget class. Another disadvantage of doing it this way is that
with every new Qt release, the property definitions of a widget class
may have changed, so the code does not work any longer.<br>
<br>
<br>
Ulli<br>
</tt><br>
<br>
<br>
<br>
<br>
</body>
</html>