Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate PyQt designer in Eclipse?

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!

like image 967
sunny2016 Avatar asked Aug 12 '11 06:08

sunny2016


2 Answers

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.

like image 50
Macke Avatar answered Nov 10 '22 22:11

Macke


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.

like image 33
nomad Avatar answered Nov 10 '22 23:11

nomad