ubuntu 13.04, can't see source files of c++ project in QT creator - qt-creator

On ubuntu 12.10 I've been using Qt Creator for a while. After updating to ubuntu 13.04 I've encountered the problem, that I can no longer see my src-files in the project editor. I only see the .pro and .pri file.
I've checked that the build path is correct and re-installed QT 5. As well, I can compile and run the project as usual, but the src-files just won't appear in the editor. I used to run the project with QT4 (qmake-qt4 makefile.pro), might this interfere?

I found a workaround by adding the required source and header files manually via right-click on the project. But this is rather inconvenient as the source files are spread across several folders. I still couldn't figure out why QT creator does not add them automatically after I've upgraded to ubuntu 13.04 and QT 5 (downgrade to QT 2.7 was in vain, too).

Related

How to build opencv correctly in windows to get "opencv_createsamples.exe"

I want to learn and use haarcascade classifier using OpenCV for detection of object of my choice. I searched the internet and found that createsamples utility helps in creating dataset for positive and negative images. I know how to install OpenCV in python (pip install opencv-python works perfectly) but since I need to use that utility I need to build the OpenCV for my windows system.
My attempts to install OpenCV in windows
Attempt 1 : using MinGW and cmake
cloned latest OpenCV using git at "C:\OpenCV" from https://github.com/opencv/opencv
Installed cmake
created build using cmake at "C:\OpenCV\build" using MinGW(64 bit) build system with default options
ran mingw32-make
ran mingw32-make install
It created an install directory in "C:\OpenCV\build\install"
but to my surprise opencv_createsamples.exe was not present there
opencv_visualisation.exe, opencv_annotation.exe, opencv_version.exe etc. are present
screenshot of install files generated
screenshot of build options selected in cmake by default
It is clear BUILD_opencv_apps is true by default and other apps were created except this one
still in source folder : createsamples.cpp is present in "C:\OpenCV\apps\" along with opencv_visualisation.cpp and others
Attempt 2: visual studio 14_15 build from official site
Downloaded OpenCV latest 4.0.1 from https://github.com/opencv/opencv/releases/download/4.0.1/opencv-4.0.1-vc14_vc15.exe from https://github.com/opencv/opencv/releases webpage
extracted the opencv build at "C:\OpenCV401\"
still to my surprise at "C:\OpenCV401\build\x64\vc14\bin" no opencv_createsamples.exe
likewise other files are present
screenshot of files present in build
Attempt 3
This time I downloaded visual studio 10 build from this github page : https://github.com/abreheret/opencv3.2.0_build
here at <OpenCV_DIR>/x64/vc10/bin/ all the amazing files are present
screenshot of files present in this build
So, my question is :
Why that utility was not built from the source using MinGW and cmake in my first attempt
Why they have not included in the official build
How to build using MinGW and cmake to get that utility correctly (maybe some build configuration needed?)
Createsamples was disabled in latest OpenCV (4.0 and greater): here.

Custom QWidgets. How do I build/get the pyqt5 plugin for Qt Designer on Mac?

I want to be able to create my own custom widgets in Qt Designer using the pyqt5 plugin on my Mac!
On my windows system this is easy. I have/install pyqt5-tools, this contains pyqt5.dll and I copy this into the Qt Designers plugin directory (these packages were all installed via winPython).
I set PYQTDESIGNERPATH=.
In my current directory I have ledplugin.py and ledwidget.py
I start Qt Designer and I have my custom widget to drag and drop
( this tutorial was taken from https://www.ics.com/blog/integrating-python-based-custom-widget-qt-designer )
On my Mac, I can't figure out what the equivalent .dylib of pyqt5.dll is? What is it? Where do I get it? How do I build it?
I try: brew install Qt Creator, that doesn't have the pyqt plugin. I try: brew install pyqt5, that creates: libpyqt5qmlplugin.dylib. I copy that into the Qt Designer plugin dir and the plugin loads, but it doesn't seem to do anything with my .py plugin/widget files.
How do I get this working on a Mac? What is the actual .dylib plugin I'm looking for? I can't find anything googling around.
Thanks for any help
As my comment explained: the Qt designer plugin can be built via the reference link (SIP/PyQt5 via RiverBank and Qt src via Qt).
Make sure your Qt versions match, although Qt docs do say plugins of lower versions should work with Designers on higher versions, but I'm sure there's a limit.
Build inside a python venv, as suggested.
You'll need xtool dev pkg for building.
Everything built really easy for me.
This will place your pyqt5.dylib plugin right in your Qt/clang_64/plugins/designer folder (it will also build it in pyqt5 make folder)
At this point I expected things to work. The plugin shows that it loads fine inside Designer.
Some extra notes:
running from command line can help with debugging: Qt/clang_64/bin/Designer.app > show package > /MacOS/Designer (drag this to a terminal to execute from command line)
set an env variable (>>export QT_DEBUG_PLUGINS=1) will give debug info and show lots of stuff including that pyqt5.dylib loads fine
widget plugins are two files: widget.py and the widgetplugin.py file that exposes the widget to designer. This plugin file MUST end with "plugin.py"
widgetplugin.py files can reside in a number of places:
in /[Designer App]/plugins/designer/python/
in ~/user dir/.designer/plugins/python/
in a directory of you choosing using env var PYQTDESIGNERPATH
However, at this point still nothing showed in Designer and I had no errors to go by. Since I just built pyqt5.dylib, I figured I'd simply put a bunch of print statements in it, re-make it and debug to figure out why the pyqt5 plugin loaded fine, but my custom widgets were nowhere to be found...
first issue was trouble loading a python environment:
for this issue, I simply copied my (I use brew) /usr/local/Cellar/python/3.7.2/Frameworks/Python.framework to Qt/clang_64/lib (I'm sure there's a proper PATH/PYTHONPATH you can set for this, I'll figure that out later)
after that came, missing PyQt5.sip module
for this, I installed (pip install) pyqt5-sip and then put in in my PYTHONPATH
After that, everything finally worked and I could see my custom plugins inside Qt Designer.

Compiling Qt5 project without QT Creator

We have built a large-ish program using QT Creator 5 on Fedora (easy install). We now have to compile for older distro's including RH5 and RH6.
I realize that QT Creator doesn't support the older versions of libstdc++ which ship with RH5 and RH6. However, can we still use make & qmake from the command line to compile our project under other distros?
Qt Creator gives you the commands.
Open Qt Creator and your project (on Fedora). Then go to the "Projects" tab (the one with a folder icon at the left of your window). The window should show you the compiling steps it uses for building your program (and the cleaning steps too). Most of the time. Copy those steps in a shell script, adapt it to your targeted plateform (RHEL in your case) and then compile the program by launching your script on the targeted plateform (i.e. RHEL). Otherwise you can using the traditional qmake && make on Red Hat.

Qt on Mac: where to find "configure"

I am very new to Mac.
I downloaded QT SDK Mac Open source (http://get.qt.nokia.com/qtsdk/qt-sdk-mac-opensource-2010.02.dmg) and installed the Package.
I can run qmake, build samples and run demos,
but I cannot run configure (in order to build the Qt libraries statically).
It says: -bash: No such file or directory.
Documentation says I should run this in the "Qt root folder", but what is this folder in Mac?
I looked for it in /usr/bin, /usr/local/Qt4.6, /Developer/Tools/Qt.
Anyway, what is "configure" on Mac. is it an executable or a script?
Thanks a lot
The SDK download is a pre-built binary library. You need to download the source code version of Qt to be able to configure it to build as static libraries.
The configure script only comes with the source code download version.
I think the SDK only provides the headers and libraries hence the reason you can build applications using Qt. To build Qt itself you will need the source package which is a different download.

qt configuration on windows

I'm having some trouble installing and configuring qt on my vista laptop.
I'm trying to setup a development environment on my laptop where I compile from the command line, because that's how the environment is setup on my university's linux machines, so I don't want to tie myself to some IDE .. (plus, real programmers use the command line!)
I haven't used the command line before for C++ development, it was all MSVC, so now I'm having a bit of trouble.
I'm still using MSVC, but from the command line. I practically have no idea what's going on, I just know that I have to run:
qmake
nmake
to compile my code!
I downloaded the opensource version of qt, and did the configuration, and tried a simple qt application (from a tutorial) and it worked, it compiled and executed pretty much as expected.
Now, when I decided to run another project that uses opengl, I got the following error:
fatal error C1083: Cannot open include file: 'qgl.h': No such file
or directory
I'm not sure where does the compiler look for header files, and I didn't copy any header files anywhere, I assume that configure.exe worked its magic somehow and added the include directory to one or more enviroment variables or to some registery location or whatever other peculier places that the MSVC compiler searches for to find include directories.
However, what I did was search my C:\qt\include\ folder to make sure that qgl.h exists, and sure enough there it was. so why can't nmake find it?
I think the actual solution to this is in your pro file:
QT += opengl
If you want to stay with the command line anyway (plus use it on a linux box later / parallel) I'd suggest at least trying out the MinGW version of Qt. I'm using it regularly, and besides of the non-existance of a GUI it works pretty well. Using MinGW also has the advantage that you can simply download and install the MinGW edition of Qt and don't need to reconfigure or recompile anything.
Also, trying out QtCreator might be interesting. It's still beta and requires the beta Qt 4.5 but it's a nice small IDE that integrates nicely with gcc.
Two potential solutions (they solved issues at my workplace)
Do you have qt include and bin folders in the PATH variable? I think the doc says only one of these is needed, but one of the students had Vista and putting the other in the PATH variable solved a "Cannot open include file" problem.
If you're using MSVC did you run configure and nmake from the Visual Studio command prompt? We had problems when using the bare windows Command Prompt because the VS one adds a lot of temporary environment variables to the configure process.
Good luck
Install the complete Qt SDK for Windows which includes Qt 4.6 SDK, Qt Creator 1.3, and MinGW.
It will also install "Qt Command Prompt" launcher that you can use to build Qt apps from the command line.
I'm sure you're more familiar with MSVC than MinGW, as I do too (I've been using MSVC 6.0 to MSVC# 2008 for developing .NET apps).
But try MinGW with Qt and I think it's better for long term. I do some C++ development on Linux too so getting familiar with MinGW will be beneficial for you in cross-platform C++/Qt development.
For more info, see Installation of Qt 4.6 SDK for Windows.
Qmake generates Makefile from *.pro file located in current directory. It has qt path compiled in. Type "qmake -v" to see it. You can't move qt's dir after compiling it. If You haven't moved it, first maybe try to install Qt following instruction from INSTALL file. Good luck.
The opensource version of Qt does not provide profiles (mkspecs in qt terms) so qmake can generate nmake (msvc) compatible makefiles.
You have to use mingw/gcc.

Resources