How to integrate PyQt designer in Eclipse?
Asked Answered
D

2

8

I'm trying to integrate the pydev, pyqt, python and eclipse. Now the code can be runing without error. And I know to make the GUI in Qt Designer. and then modified it in Eclipse.

Now I want to integrate the Qt Designer of PyQt to Eclipse. Just like the Qt Eclipse Integration for C++. Use PyQt Designer in Eclipse. Can anybody teach me how to do it? Thanks very much!

BTW, I'm try to set the preference of qt project in Eclipse.

But when I add new qt version.I didn't know how to borrow the bin path. Because there is no bin path in PyQt.And also didn't have qmake,uic,rcc etc. the version name that I typed is PyQt-Py2.7-x64-gpl-4.8.5-1.exe. I borrow the include path like C:\python27\Lib\site-packages\PyQt4\Sib\PyQt4.

my OS is win7. Thanks for your answers! God bless you!

Demythologize answered 12/8, 2011 at 6:32 Comment(0)
O
3

The only way is to install the Qt Eclipse Integration, that way you can open ui files directly in eclipse.

But this does not work well with plugins and custom widgets, since that requires the exact same Qt version for the Eclipse integration and PyQt (and the same compiler flags..), and that may not be the case.

You could of course build the Qt Eclipse Integration yourself, if it works with the Qt version you're using with PyQt. (it's pre-built for 4.6.1, so it may or may not work with later Qt versions.)

What we've done is to tell Eclipse to open .ui files in Qt Designer outside of Eclipse. Not as nice, but it works with custom widget plugins, so it's a definite win for us.

Observe answered 12/8, 2011 at 6:44 Comment(2)
Yeah, and the eclipse integration is not being worked on any longer. We've stopped using it and just run the designer app outside Eclipse instead, since version matching is a bother.Observe
I hear you :) I found a useful script to automagically do the *.ui to *.py conversion inside eclipse, here: libtronics.com/2011/08/eclipse-setup-for-pyqt-ii. That way I can still write Python code in eclipse, even if without PyQt.Vantage
U
1

An easy way to open .ui files generated by Designer is to convert them to python code using "pyuic4" which comes with pyqt. On Windows and Linux (I haven't tested on Mac), open a shell and navigate to the directory containing your .ui file then run the command/flag/args... See example below:

pyuic4 -o newOutputFile.py theOriginalPyQtFile.ui

In the example my input file is called "theOriginalPyQtFile.ui" and the ouput file that will be generated is named "newOutputFile.py" and saved in the same directory as "theOriginalPyQtFile.ui".

After that just open "newOutputFile.py" in Eclipse or any IDE.

Unbind answered 21/4, 2012 at 17:19 Comment(1)
This works fine on the command line, but for integration into Eclipse you need a small script to automate the -o bit. It's not the only way, but @woohoo's script is a nice approach.Concertina

© 2022 - 2024 — McMap. All rights reserved.