Showing posts with label Qt Creator. Show all posts
Showing posts with label Qt Creator. Show all posts

2014-06-20

Qt Creator - Help is on the way

Visual Studio starting from version 2002 to 2008 had a poor help experience. Hitting F1 in Visual Studio resulted soon in me cursing while looking at the help window's progress bar. Unlike Visual Studio 6 which had a very responsive help system.

I remember looking with Process Explorer to see what's going under the hood and it was very surprising to see the C# compiler running...

To overcome this waiting I would open up a web browser and search online. This habit stuck. The web search engine become my best friend.

Visual Studio 2010 has fixed the help system (some local web server technology if I remember correctly), but I haven't spent much time with it so that I would go back at pressing F1 for help.

For the past three years I've been using Qt Creator and I was happy with my work flow: code editing, debugging with Qt Creator and online web search for help.

Therefore I found myself hacking a project using Qt and Qt Creator and searching online after QBrush, QPainter documentation.

If you search online after QBrush you will most probably (at this moment in time using google) get this: qt-project.org/doc/qt-4.8/qbrush.html I would then click on the link and change it to qt-project.org/doc/qt-5.3/qbrush.html. This became annoying after a while.

Now I know that Qt Creator already comes with the most up to date Qt documentation (depending of course if you have the most up to date Qt installed).

But I would have not realized this if my work colleague Miika Järvinen wouldn't have mentioned a small project of his.

His small project involved having the awesome cppreference.com offline C++ documentation available in Qt Creator. Now cppreference has a qch file compiled, but it only shows the main index page when using F1 or searching with "?". If you navigate to the help panel you get an annoying endless "waiting" cursor.

Miika noticed that the qch file was broken due to invalid paths and he compiled a fixed version, which you can get it from here. The endless "waiting" cursor is still present though.

Below you have an example how to use the awesome Qt Creator help system with the equally awesome offline documentation from cppreference.com:

Qt Creator 3.1 on Kubuntu 14.04
Now I could be "helped" by Qt Creator and not by the online web search!

Imagine the productivity kick you can get if you have the browser window closed, or code offline for that matter :)

2014-03-02

Debugging QNX applications using Qt Creator

According to Wikipedia QNX is: "QNX is a commercial Unix-like real-time operating system, aimed primarily at the embedded systems market".

One could get an evaluation copy of QNX 6.5.0SP1 and have a virtual machine running the x86 version of QNX 6.5.0SP1. QNX comes with an Eclipse based IDE, which is nice and all but I'm interested in QtCreator :)

Ed Langley has a very nice blog entry named - Setting up a QNX image for use with Qt Creator.

Qt Creator needs SSH communication with the QNX target, in my case a virtual machine. Ed Langley's blog entry has details on how to get this up and running.

I've created a "hello world" C++ project. In order to have Qt Creator deploy this hello world application one needs to add the following lines to the pro file:

target.path = /home/sam/qnx_test
INSTALLS += target 


Debugging the application using Qt Creator 3.0.1 looked like this:


Debugging works out of the box, unfortunately the STL types are not displayed very "pretty".

QNX 6.5.0SP1 comes with "GNU gdb 6.8 qnx-nto (rev. 506)" which is copyrighted "(C) 2008 Free Software Foundation, Inc.", which is a bit dated.

Fortunately QNX has an updated version of GDB "gdb-7.5-r791". Upgrading gdb was just a matter of unpacking gdb-prereq-linux.tgz and linux-gdb-7.5-r791.tar.gz. Now GDB version is "GNU gdb (GDB) 7.5 qnx (rev. 791)" which is copyrighted "(C) 2012 Free Software Foundation, Inc.".

Unfortunately Qt Creator 3.0.1 was not able to use the debugger. In Qt Creator's "Debugger Log" I was able to find out why:

&"    import binascii\n"
&"ImportError: No module named binascii\n"
&"Error while executing Python code.\n"


Python from the "gdb-prereq-linux.tgz" file, which ended up being installed here /opt/qnx650/host/linux/x86/usr/python27/, was incomplete. Binascii module should have been available, but was not.

So I decided to compile my own version of "Python 2.7.2". This was a bit tricky because Qt Creator needs a 32bit version of Python and my Linux installation was 64bit. I've set up a schroot environment for a 32bit version of my Linux distribution and done a ./configure, make, make install build of Python 2.7.2.

I've uploaded my Python 2.7.2 build here, "installation" should be done like:

# tar xJf python-2.7.2.tar.xz  -C /opt/qnx650

After upgrading GDB and Python Qt Creator 3.0.1 debugging looked like this:


As we can see it's not necessarily better. The STL types are not just not "pretty", this time are not accessible. One could say that's even worse.

Upgrading Qt Creator to the upcoming 3.1 release improved things a bit:


As you can see std::vector was displayed correctly. I don't know why "value" was presented as . The "Debugger Log" didn't show up any errors.

Digia announced on 25th of February 2014 the debut of "Qt 5 support for latest release of QNX operating system", which means that Qt Creator 3.1 and future versions would support QNX 6.6!

I hope you will give Qt Creator a try when developing QNX applications!

2012-08-18

Qt Creator Visual C++ keyboard shortcuts

Qt Creator comes with a "MS_Visual_C++.kms" keyboard shortcuts scheme. But this scheme is not based on Visual C++ Professional, but instead of Visual C++ Express.

The two versions Visual C++ Professional and Visual C++ Express do not have the same keyboard shortcuts scheme. You can download the default keyboard scheme for Visual Studio 2010 C++ here.

If you have used Visual C++ Professional with Visual Assist you will also notice that the Visual Assist shortcuts are also missing. Visual Assist default shortcuts can be viewed here.

Visual C++ allows multiple shortcuts for the same command. Unfortunately Qt Creator doesn't allow this and at times I had to choose from multiple shortcuts only one.

Below is a table with the updates to the "MS_Visual_C++.kms" keyboard shortcuts scheme:

Command Label Shortcut Old Shortcut
Toogle Toggle Bookmark Ctrl+F2 Ctrl+K, Ctrl+K
OutputPane.nextitem Next Item F4 F6
OutputPane.previtem Previous Item Shift+F4 Shift+F6
VisualizeWhitespace Visualize Whitespace Ctrl+Shift+8 Ctrl+E, Ctrl+V
LowercaseSelection Lowercase Selection Ctrl+U Alt+U
UppercaseSelection Uppercase Selection Ctrl+Shift+U Alt+Shift+U
Sidebar.Projects Activate Projects Pane Ctrl+Alt+L Alt+X
Sidebar.Class View Activate Class View Pane Ctrl+Shift+C
AddNewFile Add New... Ctrl+Shift+A
AddExistingFiles Add Existing Files... Alt+Shift+A
RunToLine Run to Line Ctrl+F10
AttachToLocalProcess Attach to Running Local Application... Ctrl+Alt+P
FindUsages Find Usages Alt+Shift+F Ctrl+Shift+U
RenameSymbolUnderCursor Rename Symbol Under Cursor Alt+Shift+R Ctrl+Shift+R
Methods Methods and Functions Alt+Shift+S
Methods in current Document Methods in Current Document Alt+M
JumpToDefinition Follow Symbol Under Cursor Alt+G Ctrl+F12
SwitchDeclarationDefintion Switch Between Method Declaration/Definition Ctrl+F12 Ctrl+Shift+F12
SwitchHeaderSource Switch Header/Source Alt+O F4
Files in current project Files in Current Project Alt+Shift+O
Files in current project Files in Current Project Alt+Shift+O
CancelBuild Cancel Build Ctrl+ᡀ�

Cancel Build should have been Ctrl+Break. I filed this behavior as Qt Creator Bug #4609.

The complete "MS_Visual_C++_Visual_Assist.kms" can be downloaded from here. With these keyboard shortcuts Qt Creator is a able to pose as a very good substitute to Visual C++ and Visual Assist!