I´m trying to integrate googletest with my Qt Creator.
Basically I´ve got a googletest-listener, which evaluates my unit tests and prints the results to stdout. Now I´m trying to make that listener a build step, so it tells me when a test didn´t succeed. The results are now shown in the "Compile Output" tab.
What I want to do now is that the results are shown in the "Build Problems" tab as well. Just like normal build errors. Is this somehow possible without using a Creator-plugin?
EDIT:
In the meantime I´ve found the solution: It seems like Qt Creator takes all the "build problems" from stderr instead of stdout. So I just wrote my errors to stderr and now it works.
No, the build output is specifically made to catch compile and link errors, which Qt Creator links to the relevant parts of the source code when you click on the items in this list. Compile output is the full output of things like [n]make or msbuild build tools. Custom build steps only show here, with a plugin, you could of course do all kinds of magic (I have no experience here, but as everything in Qt Creator is a plugin, it should be very possible).
Related
My goal is to be able to reasonably debug any R-based code, even code from libraries (from install.packages, by placing breakpoints or debug statements (i.e., browser) at any line. I haven't been able to figure out how to reliably edit the source of any library function yet (assuming it is not compiled, e.g., editing a S3 method). However, I put a breakpoint in my main function and then used the debugger to step into the code for the library of interest. In RStudio, the file says "Debug location is approximate because the source is not available." That's fine, but I would like to be able to put additional breakpoints into this "virtual file" so that I don't have to step line by line until I get to the line of interest. Placing these breakpoints does not seem to be possible.
I also can't figure out how to edit the file (which would presumably then support breakpoints). Perhaps I need to install the source locally but it is not clear how to do that. Also, I don't know what the implications of using the source code is. Would I need to manually compile any parts of the library that are actually compiled? My preference would be to have an installation option that allows for editing anything that is interpreted but that doesn't force me to compile everything that the standard installation method typically compiles on its own.
Try:
trace(Fun_name, edit = T)
I am trying to show a progress in the taskbar of the plasma desktop using the KDE Frameworks. In short, it want to do the same thing as dolphin, when it copies files:
I'm kinda stuck, because I don't even know where to get started. The only thing I found that could be useful is KStatusBarJobTracker, but I don't know how to use it. I could not find any tutorials or examples how to do this.
So, after digging around, and thanks to the help of #leinir, I was able to find out the following:
Since Plasma 5.6 KDE supports the Unitiy DBus Launcher-API, which can be used, for example, to show progress
I found a post on AskUbuntu that explains how to use the API with Qt
The real problem is: This only works, if you have a valid desktop file in one of the standard locations! You need to pass the file as parameter of the DBus message to make it work.
Based on this information, I figured out how to use it and created a GitHub repository, that supports cross platform taskbar progress, and uses this API for the linux implementation.
However, here is how to do it anyways. It should work for KDE Plasma and the Unity desktop, maybe more (haven't tried any others):
Create a .desktop file for your application. For test purpose, this can be a "dummy" file, that could look like this:
[Desktop Entry]
Type=Application
Version=1.1
Name=MyApp
Exec=<path_to>/MyApp
Copy that file to ~/.local/share/applications/ (or wherever user specific desktop files go on your system)
In your code, all you need to do is execute the following code, to update the taskbar state:
auto message = QDBusMessage::createSignal(QStringLiteral("/com/example/MyApp"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"));
//you don't always have to specify all parameters, just the ones you want to update
QVariantMap properties;
properties.insert(QStringLiteral("progress-visible"), true);// enable the progress
properties.insert(QStringLiteral("progress"), 0.5);// set the progress value (from 0.0 to 1.0)
properties.insert(QStringLiteral("count-visible"), true);// display the "counter badge"
properties.insert(QStringLiteral("count"), 42);// set the counter value
message << QStringLiteral("application://myapp.desktop") //assuming you named the desktop file "myapp.desktop"
<< properties;
QDBusConnection::sessionBus().send(message);
Compile and run your application. You don't have to start it via the desktop file, at least I did not need to. If you want to be sure your application is "connected" to that desktop file, just set a custom icon for the file. Your application should show that icon in the taskbar.
And thats basically it. Note: The system remembers the last state when restarting the application. Thus, you should reset all those parameters once when starting the application.
Right, so as it turns out you are right, there is not currently a tutorial for this. This reviewboard request, however, shows how it was implemented in KDevelop, and it should be possible for you to work it out through that :) https://git.reviewboard.kde.org/r/127050/
ps: that there is no tutorial now might be a nice way for you to hop in and help out, by writing a small, self contained tutorial for it... something i'm sure would be very much welcomed :)
I use squish-4.2.2 for testing GUI of our tool and use purecov.i386_linux2.7.3 for covering them. Our tools are based on qt-4.7.4_qsci version of QT. After building our tools in Purecov mode, when we run our tests, they fail if tests contain operation with "popsup menu". Purecov cannot generate the result *.pcv file. Also I would like to note that our tools do not fail when they are run without Squish, however "Popsup Menu" opens not earlier than after 30-60 seconds (in normal mode it is done during 1-2 seconds).
So I have 2 issues:
1. when tests are run with Squish, they fail when tests contain operation with "Menu" item;
2. Purecov does not generate *.pcv file when tests fail.
I tried to find some interesting things on your site for resolving those problems, but I couldn't find anything related to my issues.
In my opinion, Squish failed because when I try to open "Menu" item, GUI runs faster than its logic part, and after opening "Menu" item, Squish considers that operation is done and kills my tool.
Could you please tell me what I can do with my tests or tools for resolving those problems?
Thanks.
I had a similar issue in the past, with clicking menus from my app.
I hope this helps you also!
Example:
I wanted to open a "File" menu, followed by a sub-menu (which is pop-up) "New". When I'm in record mode of Squish, Squish records the following code in python:
activateItem(waitForObjectItem(":MainWindowForm.m_poMainMenu_QMenuBar", "File"))
activateItem(waitForObjectItem(":MainWindowForm.menuFile_QMenu", "New..."))
Now, this didn't worked all the time, honestly I didn't managed to understand why :).
But, I found on their site, this a possible solution. So, I've replaced Symbolic names from the code above, and created a function that calls the objects after Real name properties:
def callMenu(menu_name, submenu_name):
activateItem(waitForObjectItem("{type='QMenuBar' visible='true'}", menu_name))
activateItem(waitForObjectItem("{type='QMenu' title='%s'}" % menu_name, submenu_name))
After I made this change, the tests run smooth, without anymore problems (at least from the menu side).
I just started using Eigen 3.2.0 on QTCreator 2.8.1.
All is well but code completion only seems to partially work – I get a bunch of options, but many are missing. Here’s a screenshot of an uber simple code snippet – as you’ll see, the list of available functions for m0 is limited (e.g. block() and col() are missing but cols() is there).
However, all of these functions seem to be usable – the code compiles and runs properly. This is a problem, given that Eigen has a lot of functionalities, and I’m nowhere close to remembering the name for all of them. I tried a bunch of random things, but am not quite sure what’s going on. Here’s the code from my .pro project file, in case
QT += core
QT -= gui
TARGET = LearnEigen
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += ..\..\Libs\Eigen
Would be forever thankful for any advice or pointers to other threads that may have addressed this.
thank you!
Long time since your question, but for anyone may want this problem to be solved, take a shot to the following option:
Go to Help-> About Plugins... -> enable ClangCodeModel
Restart Qt Creator. Check that it got activated; Tools -> C++ -> Code Model
problem solved!.
QtCreator has this nice feature to bring up the API-doc for a class/method when pressing F1. Unfortunately in my case it just brings up an empty window stating "No documentation available". Using google i could figure out that i need to register the right .qhc file (qt help file) in QtCreator to make this feature work. Where do i find the .qhc files for a given qt or qtmobility release? Do i have to generate them myself?
Thanks!
Cheers,
Frank
They're in the doc/qch subdirectory of the Qt distribution. If you want to (re-)generate them, run make docs.