generator: Unexplained Warnings and results
Dynamic Python binding for Qt Applications
Brought to you by:
florianlink,
marcusbarann
When using the latest version of PythonQt downloaded using SVN, I have encountered several strange or unexplained results.
It seems like a nice option would be to ignore functions that are deprecated if they are defined with QT_DEPRECATED (or any other valid way to declare deprecated functions) property. Although the 'rejection' tag can be used, it could be troublesome to have to specify each deprecated functions individutally.
Thanks for reporting, could you say which Qt version you are using?
I am not actively working on PythonQt right now, so maybe you can have a look by yourself.
I am using Qt version 5.7
Since I reported this, I have come across a few other anomalies.
Last edit: Allen C Kempe 2019-02-16
I continue to work on the problem of getting connect to work. I did discover one "oops' situation in that my generator script was passing an invalid path for an 'Export QTDIR= ... statement. After correcting the path and rerunning generator, I now see that the Warning messages about QObject being an invalid baseclass have disappeared. However I am still getting warning messages about Qt classes like QMainWindow and QMenu being invalid baseclasses. and the script from https://sourceforge.net/p/pythonqt/discussion/631393/thread/bbc98b8f/?limit=25#1a5c still produces the error 'module' object has no attribute 'QObject'
In generator source file main.h, there is a check to see whether the QTDIR environment variable exists and a message is output to qWarning. It should also be output to stdout. Also, there is no check to verify that the directory specified exists.
Further down, I found that "/QtWidgets" needs to be added to the list of includes in order to find QtClasses like QMainWindow. This eliminates the baseclass not found warnings. I'm wonderign whether the INCLUDES paths should also be verified that they exist?
I'm still working on getting connect to work. My problem I believe was because I was trying to use QSignalMapper which doesn't work.
This produces this output when one of the buttons is clicked.
['A', 'B', 'C', 'D']
TypeError: 'NoneType' object is not callable
a button was clicked
The Qt documentation says that QSignalMapper is obsolete but the only thing I can find is to use Lamda fucntions which I suppose don't ake sense to Python or the sender() function to get a pointer to the Pushbutton but sender apeears to be a method of QObject which PythonQt doesn't support. Anybody got an idea on how to get QSignalMapper working?
Here are some changes I am suggesting:
Hey Allen C Kempe,
I have the same troubles as you mentioned above. Does your last patch suggestion fix some of the above problems like
#endif without #if
or something like that?Greetings
Tonka
I don't believe that the "#endif without #if" problems are appearing because of a real poblem in the input header files but a bug in the PythonQT parser. It may be an indication of some classes not being processed properly. I sort of got sidetracked on other issues and haven't wlooked into any of these issues.
At the present time, the failure od QSignalMapper as I previously posted about is my biggest concern. My next item of interest is figuring out how to ignore methods marked QT_DEPRECATED.
Of the two fixes that I posted, one is merely cosmetic, eliminating the generation of an unnecessary ";" on a generated code. The other is to include QWidgets in the include path for QT classes.
I'e also identified some other things that should be checked, like whether supplied include paths are valid.
I also think that the endif warning is from an pythonqt parser bug. The strange thing is that i get it only when i add additional include directories. The parser sometimes does not see classes, but they are listed in the preprocess file.
yeah, there are some weird bugs which need some checks.
Do you use pythonqt only for qt stuff or do you use it for your own code as well (as i do)?
I only got involved with PythonQt because I wanted to add scripting capabilities to a QT program.
Me too. I already make a big part of our application scriptable, but the bugs that you mentioned produce a lot of trouble.
Maybe we can cooperate to fix he bugs.
In the next couple of days, I should be able to take a look at some of the problems. What if I setup a repository on github for my changes? That should make it easier to shae any changes we make.
repo on github would be nice. makes it much easier to cooperate.
I'm not having a lot of luck yet. I thought that I could add some code to check for QT_DEPRECATED on a function but it's not getting called. It seems that there is a pre-processor that is removing the QT_DEPRECATED token from the source. It looks like the prepocessor code is QT code that I can't see so I've been unable to see how it's doing this.
Look in the preprocessor code pr the master include, I guess one of them is
defining it... or you have to add a define that defines it to itself, so
that the preprocessor keeps it.
On Fri 5. Apr 2019 at 19:37, Allen C Kempe allenck@users.sourceforge.net
wrote:
Florian, glad to see you are keeping a watch on things. I tried adding this line to the pp-qt-configuration file but it doesn't seem to have any affect.
I would think that I should be able to set breakpoints in preprocessor.cpp but they never get called.