WinPython with PyQt5 - qt

I'm trying to get PyQt5 working with WinPython. PyQt5 comes with a readme file for installation, and I have unsuccessfully tried a few combinations of what I thought the first part of the readme tells me to do.
I have:
Windows 7 Home Premium 64-bit
WinPython-64bit-2.7.9.1
Qt 5.4
PyQt-gpl-5.4
PyQt-gpl-5.4 is in the folder (only partially sure that this is where I should have put it)
C:\WinPython-64bit-2.7.9.1\python-2.7.9.amd64\Lib\site-packages\PyQt-gpl-5.4
My current attempt at getting everything working is: I'm trying to run the configure.py file in PyQt-gpl-5.4, but when I do so I consistently get the following error:
Error: PyQt5 requires Qt v5.0 or later. You seem to be using v4.8.6.
Make sure the correct version of qmake is on your PATH.
What I think is the required version of qmake being referred to is in the folder
C:\Qt\5.4\mingw491_32\bin
However, I have no idea how to fix the error by adding the qmake in this folder to PATH. My most recent attempt was to add the folder using Spyder's Tools->PYTHONPATH manager, but this made no difference. I also tried adding it using sys.path.append('C:\Qt\5.4\mingw491_32\bin'), but this didn't work either. I have since removed the folder name from both of these locations.
How do I get PyQt5 working with WinPython-64bit-2.7.9.1, or I think equivalently, how to I get the configure.py file in the PyQt-gpl-5.4 folder to run?
Thanks.

You definitely don't want the source code (i.e. PyQt-gpl-5.4) in the site-packages folder, because that's where the compiled modules will end up. Instead, it should just go in a temporary folder whilst you compile it.
When you run configure.py, you must take care to use the executable for the specific python that you are targeting. I do not know anything about WinPython, but for a normal python installation this means doing something like this:
C:\Python34\python configure.py
As a first step, before attempting to actually compile anything, it would be advisable to take at look at all the configuration options that are available, like this:
C:\Python34\python configure.py --help
(There's also the Installing PyQt5 section in the PyQt Docs).
This will tell you, for instance, that the simplest way to specify the Qt installation you are targeting would be something like this:
C:\Python34\python configure.py --qmake C:\Qt\5.4\mingw491_32\bin\qmake
EDIT:
Sorry, that last part is wrong: the --qmake option isn't available on Windows, so you have to add the directory containing the qmake executable to your PATH. This can be done with the following command:
set PATH=%PATH%;C:\Qt\5.4\mingw491_32\bin

Related

GHC can't import the standard library as long as a package environment file exists

When I install things with cabal-install, it automatically creates a ~/.ghc/x86_64-freebsd-8.8.3/environments/default with a bunch of stuff in it; this allows me to import my installed packages, but takes away my ability to import the standard library, even the Prelude:
gtk.hs:1:1: error:
Could not load module ‘Prelude’
It is a member of the hidden package ‘base-4.13.0.0’.
You can run ‘:set -package base’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
1 |
| ^
(It used to give me this error pointing to the first character of line 1 when line 1 was an unrelated import, so I put a blank line at the start of the file to see if it would still point the error there if there was nothing there. It does.)
If I delete the ~/.ghc/x86_64-freebsd-8.8.3/environments/default, I can import base again but not the installed packages. I need to give it the Cabal database with -package-db on the command line.
While that apparently works, I think there must be a way to configure that environment file to do this automatically. But as long as ~/.ghc/x86_64-freebsd-8.8.3/environments/default even exists, the entire standard library, including Prelude, is rendered hidden, and I can't compile anything at all (even an empty file fails with the above error). Including global-package-db in the environment file also didn't affect it.
Other info: I am not using Cabal to build because a .cabal file and a Setup.hs are added complexity I shouldn't need to compile a one-file throwaway program. I also tried installing the packages with --global passed to cabal install, but it still didn't install them globally.
OS: FreeBSD 12.1
GHC: 8.8.3
cabal-intsall: 3.0.2.0

Development on KDE platform

I'm interested in learning about kde environment. So I read the contribution page on wiki, git cloned the kompare repo and built it. But an attempt to execute the binary gave me an error saying Could not load our KompareNavigationPart. The console showed the following error about kservice:
> ./kompare
kf5.kxmlgui: cannot find .rc file "kompareui.rc" for component "kompare"
kf5.kservice.services: KMimeTypeTrader: couldn't find service type "Kompare/ViewPart"
Please ensure that the .desktop file for it is installed; then run kbuildsycoca5.
kf5.kxmlgui: cannot find .rc file "kompareui.rc" for component "kompare"
Aborting aboutToFinish handling.
I couldn't find anything about it in the readme or the project wiki. I've installed the kde-development-meta package on arch linux. Can anyone help me get started with development on kde platform?
Short answer: Use "cmake -DCMAKE_INSTALL_PREFIX=/usr" and "make install".
Long answer: It looks like you tried to run from the build directory, but the KDE plugin loader does not look there by default. You could adjust the various path variables to additionally point to your build directory. The variables are mentioned at https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source#Set_up_the_runtime_environment
You can also use "make install" to install to a run-time directory. If you did not change the defaults of cmake via -D option, this will be "/usr/local/", and in this case you also have to adjust the various path variables to include that directory, unless your distribution already configured this for you.

How to use add-on "QtFtp"?

I want to use FTP in my current project, but since Qt5 ftp isn't available (only as add-on).
I downloaded the sources from here: https://github.com/qt/qtftp
In Qt's forum, I found a instruction how to use it:
Open Console in the qtftp-folder
Generate the headers: cd qtftp, <QTDIR>/bin/syncqt.pl -version 5.2.0
Run qmake
Run make (mingw32-make)
Run make install (mingw32-make install)
Add QT += ftp in my .pro-file
Run qmake on my project
compile my project.
(https://forum.qt.io/topic/23904/qtftp-and-qthttp-compatibility-add-ons-for-qhttp-and-qftp-classes-in-qt-5)
So, I wanted to try these steps, but it fails on the first step, because the syncqt.pl cant be found, but I looked in the Qt-directory, and the file is there.
Anybody has an idea, how to fix/solve this? I am using Qt5.9.1
If you have downloaded the portable version of strawberry-perl like me, just extract .zip somewhere on your disk. After that, open the portableshell.bat (it should open a command prompt window)
After that, you can type in the code of step 2, and don't forget to add the -version argument.
Then you can continue with step 3, and everything should work without any problems.

Building Brackets Shell (After running the grunt build command)

On windows after running the grunt build command for creating brackets shell it gives done without errors but i dont see any .exe file generated..
What might be the problem???
Here are some possible solutions:
Are you following the full brackets-shell build instructions, including all prerequisites?
Make sure Brackets isn't running at the same time. The build will fail silently if the .exe file is currently in use (see bug).
Try with a fresh git clone of the repo. If your brackets-shell local copy has been around for a while, sometimes the build & deps folders can get in a bad state. (I'm assuming you haven't modified the source at all. If you have, try with an unmodified copy of the source first to make sure it builds correctly without any of your changes).
Check that python --version shows 2.7.x
Verbose build output would also be helpful in diagnosing issues like this, but unfortunately there's not yet an easy way to get that...
If you follow the instructions on bracket-shell's wiki page, the Windows executable should be created in the Release directory.

Setup of Qt Creator to debug into Qt classes

I want to setup Qt Creator (3.0) in a way, that I can debug into the Qt classes. So I download the corresponding src code (http://gitorious.org/qt/qt5) and install it in a directory (e.g. c:\Qt5\src).
Then I have my own project. Where do I need to set the source code path of Qt (c:\Qt5\src), so I can debug my code, but also into a Qt class where necessary.
-- Edit:Pavel's comment --
Pavel has given a good hint: But I am using a precompiled version of Qt/Qt Creator. So I am basically looking for a solution which does not require me to compile from source. Nevertheless a useful hint. Thanks.
If you are using a prebuilded version just remap the source code location as described in http://doc.qt.io/qtcreator/creator-debugger-engines.html
Mapping Source Paths
To enable the debugger to step into the code and display the source
code when using a copy of the source tree at a location different from
the one at which the libraries where built, map the source paths to
target paths:
Select Tools > Options > Debugger > General > Add.
In the Source path field, specify the source path in the debug information of the executable as reported by the debugger.
In the Target path field, specify the actual location of the source tree on the local machine.
To get "the source path in the debug information of the executable as reported by the debugger", you can activate the "Use Tooltips in Stack-View when Debugging" option by right-clicking in the Stack View and move the mouse over a specific function call.
If you look into the tooltips, you will see references to /Users/qt/work, the Mac deployed debug symbols are pointing there. Of course, this is not documented, as these folks want you to buy enterprise.
If you create the /Users/qt/work directory (as root), then make a soft link to your source directory named qt, everything will work. No need to build anything from source (under Mac that would result in tens of gigs wasted). Same considerations about plugins
Example:
sudo -s
mkdir /Users/qt
cd /Users/qt
mkdir work
cd work
ln -s /Users/your_user_name/Qt/your_qt_release/Src qt
Everything will work. Any source mapping failed here, so leave those alone.
Hope this helps
With Xcode, before you step into the Qt library the first time, enter the following command in the LLDB window:
settings set target.source-map /Users/qt/work/qt /path/to/Qt/5.10.1/Src
(Obviously you'll want to change the version number, as relevant).
But suppose Trolltech changes its build directory, what to do then? (Or, how did the community wiki that gave the /Users/qt/work/qt path find it?) You can guess what the path needs to be by editing /path/to/Qt/5.10.1/clang_64/lib/QtCore.framework.dSYM/Contents/Resources/DWARF/QtCore_debug (or any other Qt library) and searching for some paths. "/Users" seems like a good guess. About 2% into the library you'll start seeing sections with a lot of paths like:
../../include/QtCore/../../src/corelib/kernel^#../../include/QtCore
/../../src/corelib/tools^#global^#/Users/qt/work/qt/qtbase/src/corelib
/../../include/QtCore/../../src/corelib/arch^#/Applications/Xcode.app
/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/<etc>
Look for an absolute path that looks like it could be writable. (/Applications/... would not be a likely build path, for example)
In recent Qt creator (v 4.11) press button "Add Qt Sources"
in Tools > Options > Debugger > General
and select Qt sources file.
Qt5 should be installed by online installer with checked "Qt Debug Information files".
Follow the instructions from Qt here:
"In the run configuration, select Use debug version of frameworks."

Resources