QtCreator project Menubar & code portability - qt

As we know programe written in QT is able to port across platform.
At present i am developing programme using QTcreator, here i can directly edit the Menubar & enter item to it.
But the code for this is not atall visible in .cpp files.
like shown here :---
http://codeprogress.com/cpp/libraries/qt/QMenuBarAddMenu.php#.UXYeyaL-EfE
1> Where is the code for this Menubar ?
2> Also another question is that is the GUI program written in (QTcreator in windows) is able to run on Linux host ?
3> Does there QT creator for Linux also ?
Please suggest on this point.

1) In Qt Creator, click on QMenuBar and press "F1" or navigate to "Help > Context Help", while the cursor is on QMenuBar, or you can press "F2" or navigate to "Tools > C++ > Follow Symbol under Cursor", and it will take you to where QMenuBar is defined. The right click menu is very helpful, too.
2) Probably through wine. Though most people would recompile it for other OS's... so download Qt SDK for linux onto a linux distribution, and build it there.
http://qt-project.org/doc/qt-4.8/deployment.html
3) Yes.
http://qt-project.org/downloads
http://qt-project.org/downloads#qt-creator
But be sure to also get the SDK for linux, too.
http://qt-project.org/downloads#qt-lib
Hope that helps.

Related

Qt Creator -> Qt Quick Application (QML) -> Design Tab -> Missing "Window"

In Design tab the "Window" is missing.
When I click the Design tab -> pop up three windows. three windows
After I close one -> disappear all of them.window title
It doesn't work when I try to drag and drop basic component's...
I reinstall the Qt Creator but the same thing...
Have a look at the following bugreport https://bugreports.qt.io/browse/QTCREATORBUG-26486
Here are some key points from the comments.
Three things you shouldn't have done:
Enable the QmlDesigner plugin (isn't officially supported by Qt Creator anymore, you can use Qt Design Studio)
Open a non-.ui.qml file in QmlDesigner
Open a file with a QtQuick.Window root element, which is not fully endorsed in QmlDesigner.
Support for Qt 5.15 requires a "kit" with a qml2puppet for Qt 5.15.
This setup is only properly supported and tested in Qt Design Studio.
If you use Qt Creator the puppet will be always built with the same Qt
version as Qt Creator.
QtCreator states are kept in the following locations:
Windows: %APPDATA%\QtProject and %LOCALAPPDATA%\QtProject\QtCreator
Linux: $HOME/.config/QtProject
macOS: $HOME/.config/QtProject
Please review those locations and backup/rename/clean up.
You should find this restores your Qt Creator to 'factory' conditions.

How to permanently disable QML debugger in Qt?

Whenever I make a Qt project, the qmake command includes this parameter:
"CONFIG+=qml_debug"
I never use qml and dont want to manually click three times and ignore the warning every time I generate a new project.
It happened to me in a project. I just added this to the .pro file :
CONFIG -= qml_debug
It seems to work.
You can download Microsoft Visual Studio 2017 Community Edition, it's free to use. And it is not only a great IDE but also it has got Qt support. By downloading Qt plug in for Microsoft Visuals Studio you can create Qt projects and build and debug them...
Everything that you do with Qt Creator and it has got no such problem as yours.
Also if you want to stay with Qt creator, check Projects -> Build & Run -> Run Settings. There is Enable QML setting which mine is disabled. Maybe you can disable it from there.
If not I advice you to check Tools -> Options -> Build & Run and Tools -> Options -> Debuggers. If it can be solved within Qt Creator it must be solved from these places.

Restore Qt Creator default layout

I am totally new to Qt development. Infact today's my first day! I installed Qt 5.3.1 open source (LGPL license). I was looking around in the Qt Creator and accidentally closed several sub-windows and not able to view the actual code, other list of opened files, etc. But it does load the project and also executes when I click the green 'Run' button. How do I recover the default layout? There is no window layout/View option in the menu. Can't see anything online! Please help...
Qt Creator creates some files to save the settings. These files are in different location in different operating systems.
On Windows Vista and Windows 7 :
<drive>:\Users\<username>\AppData\Roaming\QtProject and <drive>:\Users\<username>\AppData\Local\QtProject
On Linux :
~/.config/QtProject and ~/.local/share/data/QtProject/qtcreator
Try to delete QtCreator.ini and many settings including the layout are reset to default when you reopen Qt Creator.
Alt+0 will show project tree. Use ctrl+k to open search window.
Regards

"Design" button grayed out in Qt Creator for QML Project

I'm on a Kubuntu 11 system and trying out my first Qt Quick project. As this is Kubuntu I'm just running with the Qt that came with it, which has worked fine so far.
I asked Qt Creator to create the sample "Hello World" project from Qt Quick. But the design button was grayed out, as were the run buttons.
At first when I went into the Projects menu under "Run Settings" it said Qt version: [Invalid Qt Version]. Pushing the "Manage Qt versions" button brings up a tree control that looks like this:
v -- Auto-detected
| |
| +---Qt in PATH /usr/bin/qmake-qt4
|
+--- Manual
At the bottom of the dialog it says "Found Qt version 4.7.2, using mkspec linux-g++ (Desktop)"
I found out that I could get the "Invalid Qt version" message to go away by manually choosing to install QmlViewer from the app repositories. You'd think it would say something more like "Qml Viewer not found, please install it" but...oh well. Now it says Qt Version: [Qt in PATH].
So that's fixed, and the Qml app runs. But the "Design" button is still grayed out. Qt Designer is installed as an application, and its plugin shows in the "About Plugins..." list. The design button is enabled in ordinary (non-Qt-Quick) projects when I click on a form file, just not for .qml files.
in the QtCreator, go to Help -> About plugins -> Select "QT Quick".
Restart QtCreator and then select the ui.qml files. It should work now
In my case it wasn't showing up because I had my cpp file open. When I double clicked on the .ui file, the design button became active.
Solved it while writing the question.
To make a long story short: this appears to be a known issue in general with installing Qt Creator through the ubuntu repositories as opposed to using the Qt SDK Installer from Nokia:
http://qt.nokia.com/downloads
(That installer seems to do the work of making sure the proper SDK elements are installed, while the linux package repositories lag in getting things right.)
Another option seems to be building Qt from sources. But uninstalling the Qt Creator I got through KPackageKit and instead using the installer from Nokia was less involved, and worked for me in this case.

Qt Creator cannot preview QString when debugging

List item
Qt-Creator 2.2.0
OSX Lion
"Use debugger helpers" is checked
"Built" and "re-built" all the helpers.
Still... break point on method with QString and the content of the QString cannot be previewed on the debugging pane unless I go to the memory window and search for it manually with the address. I have to use qDebug to dump strings out as if we're in 1983. This use to work and I have no idea what happened to it. Every other type works well.
On Windows 7, the debugger can preview QString objects.
Pastebin the debugger log (right pane of Windows->views->Debugger Log) somewhere and post the link here. And perhaps the log file of the debugger helper rebuilding that you tried?
I had the same problem but after some research I found the answer here:
http://silvermace.com/2010/09/qt-creator-debugger-not-displaying-qstring/
I had to chose the correct qmake path and then I had to build the GDB Helper.
As the original site is gone, here are the steps:
sudo rm /usr/local/Qt4.6/qtc-debugging-helper/libgdbmacros.dylib
Start Qt Creator
Qt Creator -> Preferences -> Select the “Qt” tab -> Select “Qt in PATH” under “Auto-detect”
There should be a red cross next to the label “Debugging Helper.” On the right of that there’s a rebuild button – hit it and wait.
The red cross should turn into a green tick.
Clean & Build your project.

Resources