Is there a way to run Qt Creator from command line supplying a .pro file to open (or how do we deal with multiple Qt installations)? - qt

I have multiple installations of Qt4 on my Windows XP SP2 machine and have installed Qt Creator 2.1 today. However, running the project (.pro) files spawns the oldest version of Qt Designer installed (the one installed in 2009 together with the rest of the framework).
Since
I would not like to remove any previous installations of Qt
and for some obscure reason even if I explicitly ask Windows Explorer to always use the version I need it does not
I would like to give up a bit and just sript the needed behaviour in a .bat file like:
e:\path\to\qtcreator.exe %1
This opens Qt Creator, but something seems to prevent it from treating the .pro file properly (in short, the project does not "open" as it should).
Qt documents have a page on the matter at Qt Creator: Using Command Line Options, but it seems to ignore the topic in question.
Since Qt (being as excellent framework as it is) is also known to have its quirks (like that of qmake), I wonder, may be there is an undocumented way to solve my problem?
(Another way to fix the thing would of course be to make the correct version of Qt Designer run, but frankly I'd prefer the "hard-wired" solution since the mechanisms provided by Qt itself are still a bit unreliable.)

The libraries and tools used for a particular project (and a configuration in it) is set in the Projects panel in Qt Creator:
http://doc.qt.io/qtcreator/creator-build-settings.html
Selecting the Qt version to use with a project should force it to run the Designer that's part of the version. If it doesn't, then you should report it as a bug.

Related

How do I make QtCreator 4.2.2 include webkit related files

I've pretty much tried every proposal on solving this question that's on the entire internet but to no avail.
I'm using Qtcreator 4.2.2 on Windows 10, trying to make a program that must use a webview (of any kind) -- so far, I've tried using the QWebView and QWebKit stuff but it consistently refuses to recognise that I have the modules installed. I've verified that the dll, header and .pri files do exist in the system. I've tried using the MSVC and MinGw compilers, all with the same result; if I add web* to the QT variable in the project file, qmake claims the modules do not exist. None of the web stuff appears in the UI designer; neither for regular forms nor for qml.
How do I fix this? Is there some magic stuff that I have to do, that's not documented anywhere or am I just blind?
Edit: I've successfully created a program using QtCreator packaged in Fedora 26, that uses QWebView.
It has nothing to do with Qt Creator, it just depends on which Qt version you have.
First Qt WebKit is not distributed since Qt 5.6, it has been replaced by Qt WebEngine.
Qt WebEngine does not support MinGW, so you are required to use MSVC. (Looking at my Qt installation it seems it is also the case for WebView)
See: http://doc.qt.io/qt-5/qtwebengine-platform-notes.html#windows
Finally, Qt WebEngine is displayed as an optional module in the Qt Maintenance Tool, so you need to explicitly select it.

Re-built Qt5.0.2 with OpenGL, how to use with Qt Creator

I need to move my code from a C++/OpenGL and Config.txt situation to a UI friendly space. I was told here to try Qt and installed it in Windows.
The issue I ran into is that it did not support the OpenGL version I needed out of the box and I had to rebuild with the -opengl desktop parameter.
First time doing this, but was able to follow the instructions (and a ton of Google) and it "succesfully" was built. My issue now is I am unsure how to make the files I have work with Qt Creator.
I copied over all the folders from the qt5 folder created by git over to the Src folder in Qt5.0.1/5.0.1/Src but the hellogl example still wouldn't build.
I checked the options and it was pointing to a qmake in Qt5.0.1/5.0.1/msvc2010/bin so I copied over the qmake.exe from qtbase/qmake over to this folder (renaming the old one) and now Qt Creator builds the hellogl example on my Windows system.
My worry is, did I do this the right way? I fumbled around and got something, but is this the way I should have proceeded after I built the qt5 from git? If not what was the way I should have gone about making it all work with the Qt Creator?
The typical way to utilize the modern OpenGL the feature set (post fixed-function pipeline) in Qt is by utilizing a extension wrangler (GLEW) that finds all the OpenGL functions your graphics drivers support BEFORE Qt includes any OpenGL headers.
To accomplish this simply do the following:
If you already haven't, download GLEW (or another extension wrangler if you wish) and install it in your system path. I would recommend the 32 bit package as it will be easier to work with.
#include glew.h in your source code before any other Qt header includes that may use OpenGL headers. Just to be safe, make glew.h the first header included in your source code.
In your Qt project's .pro file add the line LIBS += -lGLEW (mac/linux) or LIBS += -lglew32 (windows).
Note: Beware of using Qt OpenGL wrappers when implementing an application that uses post fixed-function pipeline facilities. Qt 5's OpenGL wrappers all operate using the OpenGL ES 2.0 specification which may cause problems when interleaved with your OpenGL 3/4 code. Even QPainter can become troublesome when performing overpainting on a QGLWidget due to it's heavy use of the fixed-function transformation stack. I am currently developing a library called QGLX that provides alternative Qt wrappers designed for complying to the modern desktop OpenGL specification. The beta will hopefully be released by the end of this year for Qt 4 & Qt 5.

Does Qt creator by default statically or dynamically link it's libraries?

I'm developing a closed source application and to do so in accordance with the LGPL I have to dynamically link Qt's libraries to my application. Does Qt do this by default or do I have to take steps to do so? If that's the case how would I go about doing it?
Qt uses dynamic linking by default.
You'll notice this immediately during deployment to a non-developer machine, because your code will not run without the Qt libraries.
If your concern is the LGPL, just be careful when compiling Qt itself. Most LGPL violations with Qt are not because of static linking (since dynamic is the default), but for compiling Qt with non-default parameters.
LGPL is not just that the library must be provided along your binaries, but also that you specify how your users can build themselves the LGPL part. If you compile Qt yourself and do not use the pre-compiled binaries from the website, you must document that part of your build configuration in your release!
As soon as you get something running on your program, start preparing a release version for a non-developer environment without Qt installed. Your program should fail as soon as you delete the DLLs that you must copy along your program (or whatever format your OS uses).
It does it by default, statically linking seems to be quite involved judging by the many questions on the site regarding it.

Qt Include and QMake error

Qt was messing up on Windows so I deleted it and re installed it with the qt libraries and Qt Creator. Now, whenever I try to open my old project, I get the error that "Qmake is does not exist or is not executable", and none of the Qt headers can be located.
Assuming you're using a recent version of Qt, such as version 4.7.4, and a recent version of Qt Creator, such as the branch 2.3 .*.
Probably somewhere in this process, Qt Creator or the settings for this specific project lost the reference to Qt install.
We first need to find out if Qt Creator knows where Qt is installed. Go to Tools > Options.... Then click in Qt4. Here will show all installed and detected Qt versions.
As you can see, I have one Qt version installed (4.7.4), which was automatically detected.
If you do not have any installed version, you need to indicate a one manually. Simply click Add and point it to the right qmake.exe. Use the paths of the figure as reference. If you are developing a windows/mingw application, just need to add the qmake.exe associated with mingw (c:\qtsdk\desktop\qt\4.7.4\mingw\bin\qmake.exe on my computer) and remember the Version name, we'll need that in next step.
After that, open the project and click on Projects in the lateral bar. You need to Substitute the Qt version. Click on Manage next to it and select the correct version. This should resolve the problem.
Any trouble just comment. Sorry about the creepy english.

Is Qt Creator built with Qt Creator?

Questions:
Is Qt Creator built with Qt Creator?
Similarly, is Qt Designer built with Qt Designer?
BTW, why are there two Qt IDEs? Are they competitors? Which one should I use? I am using Creator.
What is Qt SDK? I am asking this because the Qt Designer & Creator 2.2.1 and Qtmake 4.7.4 that I installed thro ubuntu 11.10 s/w centre does not work. The build menu is all greyed out.
When I downloaded the latest QtSDK (2.3.1/4.7.4) into a separate installation into /opt/QtSDK, both the ubuntu sanctioned installation and the /opt/QtSDK would work as expected.
Why did my ubuntu sanctioned installation not work without the SDK? What does the SDK do?
This one is for Ubuntu enthusiasts - Qt IDE requires the SDK to work, and yet ubuntu released both Creator/Designer without checking if they work first? There is no QtSDK installation item in s/w centre. Is that intentional, or a procedural bug?
After I build my desktop app (I am building a tabbed file explorer) on Linux, what steps do I need to make to have it running on Windows 7/Vista? Will I rebuild on a windows version of Qt Creator?
I also notice that Qt Creator code generation is not perfect. It would forget to include some Qt library files in the auto-generated code, and I had to correct that manually.
Is Qt Creator built with Qt Creator?
I believe so.
That doesn't mean that everyone who works on Qt has to use it - just that I believe that lots of people do.
I don't work for any of the companies that have produced Qt, but my reasoning is:
A Google search for "dogfooding qt creator" brings up plenty of hits, including this comment from November 2010:
We’re also “dogfooding” by releasing complex apps like Qt Creator and the Ovi Suite on the desktop ports of Qt
They've put a massive amount of effort into Qt Creator over the last few years. It's hard to imagine that being worthwhile, unless they used it themselves
At recent Qt Developer Days, Qt Developers have spoken really enthusiastically about Qt Creator
Similarly, is Qt Designer built with Qt Designer?
Yes. A look at the Qt Designer source code shows plenty of .ui (Designer) files.
Why are there two Qt IDEs? Are they competitors? Which one should I use? I am using Creator.
When you edit .ui files insiide Qt Creator, you are still running Qt Designer: it's simply showing the Designer window inside Creator, for convenience.
What is Qt SDK? ... What does the SDK do?
Qt SDK is just a convenient way to download all the Qt tools in one go. You don't have to use it.
This one is for Ubuntu enthusiasts ... Is that intentional, or a procedural bug?
Sorry - no idea. It's hard to imagine it being intentional though.
After I build my desktop app (I am building a tabbed file explorer) on Linux, what steps do I need to make to have it running on Windows 7/Vista? Will I rebuild on a windows version of Qt Creator?
You will need to install Qt on a Windows PC, and then build your source code in it.
You can either do that by using Qt Creator and the Windows compiler it includes (mingw) or you can use another compiler, if you have one, e.g. Visual Studio.
I also notice that Qt Creator code generation is not perfect. It would forget to include some Qt library files in the auto-generated code, and I had to correct that manually.
If you've used any non-Qt classes in arguments to signals and slots, then this answer may help you there.

Resources