How to respond to desktop startup notification with Qt - qt

I have a Qt application, running under Xfce and other Linux desktops, which works well, except that the circulating "startup notification" icon is not dismissed when the app starts up, so that it persists for some time after the app main window is showing and complete.
I would assume that either the QApplication would by default dismiss the notification when the main window event loop starts, or I would call some method to do so. I can't find anything relevant in the Qt API documentation, or with google searches on Qt startup notification.
How can one dismiss the startup notification, in a Qt application.

Doesn't adding of
StartupNotify=false
to the .desktop file of your app solve the problem?.In KDE,
X-KDE-StartupNotify=false
works; perhaps XFCE has a similar variable.

The startup notification is sent automatically inside Qt when the first window is first shown (see src/plugins/platforms/xcb/qxcbscreen.cpp), but obviously, due to a bug, it does not work if there are quotes or the escape character (\) in the .desktop file in the path to the program.
In addition, if Terminal=true is presented, the environment variable DESKTOP_STARTUP_ID is deleted by xterm and does not reach your application, so it is better not to enable both Terminal and StartupNotify flags at the same time.
Was tested on MATE.

Related

MRTK: How to fix SpectatorView from Android-device not pairing with HoloLens? (QR-code)

Problem summary
I'm attempting to establish a connection between HoloLens and an Android device, which worked sporadically in the beta-version of the MRTK.
However since moving to the MRTK RC1 (Also Refresh), I've encountered issues regarding the QR-scanning. When pressing connect, the two devices seemingly finds eachother, however when the wearer of the HoloLens1 looks directly into the QR-code, nothing happens. (the white dot and "Locating marker..." text is showing)
Background summary
1. The Setup:
Implemented working MRTK RC1 Refresh
Cloned Feature-SpectatorView separately, copying only the "MixedRealityToolkit.Extensions" folder to the MRTK project.
"Spectator View - HoloLens" prefab added to scene.
First pressing "HoloLens" in the PlatformSwitcher, building for HoloLens1, then switching to "Android" and exporting the project to Android Studio.
Building the .apk from Android Studio
(opencv binaries are downloaded and implemented since beta version, I haven't since changed them from when they worked the last time.)
2. The Proces:
On the HoloLens, I press the "Connect" button in which a white text appears saying "Locating Marker..."
The Android phone presses connect and it goes to "Waiting for User" then as soon as a HoloLens is connected, it switches immediately to a QR code that should be readible from said HoloLens.
Looking directly at the QR-code and nothing new happens, connection does not establish further.
I checked if something was not ticked in Player Settings/Capabilities, but I can't seem to find what the culprit would be. Did I forget something in this proces?
There are a few things that could be causing this issue.
If the Android device is showing a marker, this means the two devices have established a network connection and are communicating with one another. Typically, when I run spectator view I enable the following capabilities: "Internet (Client & Server), Internet (Client), Microphone, Pictures Library, Private Networks (Client & Server), Spatial Perception, Videos Library, Webcam" in the Package.appxmanifest in visual studio. Pressing "HoloLens" on spectator view's unity platform switcher should typically achieve enabling these capabilities, but sometimes the package.appxmanifest doesn't get updated correctly in the visual studio project with subsequent builds in Unity. You can fix this by deleting your visual studio directory and rebuilding the visual studio project in unity.
If these capabilities are checked in the package.appxmanifest, it may be that you rejected a capability request when first running the application. If you open Settings -> Privacy -> Camera on the HoloLens, you can check whether your deployed spectator view application has camera access granted. You should be able to enable the camera functionality here if it is disabled.
There have been changes to both MixedRealityToolkit and MixedRealityToolkit-Unity spectator view logic, so cloning these items at different points in time may cause functions to no longer resolve (We're hoping to consolidate this code into the same repo/commit history in the future to prevent this from continuing to happen). Typically, in the Unity logs there will be errors stating that a function was not found for SpectatorViewPlugin.dll if the dll functionality is not resolving correctly. It sounds like this is not the issue you are hitting if things worked previously. But if it does turn out the case, it may be that you need to rebuild the SpectatorViewPlugin.dll to match the feature/spectatorView code you are using.
If you recently copied the SpectatorViewPlugin.dll and its dependencies to a new unity project, it may be that they aren't getting registered as usable by the windows uwp unity player. Make sure these binaries are in a Plugins\WSA\x86 folder within your assets folder. Also check the *.dll.meta definitions in the unity inspector to ensure the dll's are declared as usable for the unity wsa player/x86 builds.

BlackBerry 10 Cascades. How do I make a long running headless app terminate itself?

I'm making a BB10 app with a headless component that's normally supposed to run nonstop, except when a certain field in its QSettings changes (to save battery power).
I tried looking everywhere for the documentation. But I still can't find out how to make a headless app terminate itself.
You can get notified every time your settings file change using QFileSystemWatcher and calling bb::Application::instance()->quit() when a certain QSettings value changes. Here's an example from BlackBerry that uses QFileSystemWatcher in headless to get notification whenever the QSettings file changes.
I prefer using invocation or my own headless communication mechanism though, you can see an exemple of how I usually deals with terminating the headless app here.

Turn on GPS when App starts in QT

So I was working on a positioning app which needs GPS to be turned on. So I wanted a way to automatically turn on GPS in the background, if even possible with high accuracy or atleast have a popup window come up so the user can turn on the GPS right away. But sadly I couldn't find a single way to do so in QT, if there is a solution it's always written in Java. Can I somehow do it in QT too or import Java code in it?
Would I also be able to keep my GPS updates running in the background? Because as soon as I press the home button the updates stop to come up in the console with qDebug... or is it just the qDebug function that can't run when the app is not open?
Will I be able to use GPS in my Qt app?
First, check if the target platform has GPS and/or capable of resolving geo-coordinates. Next check the manual out: Qt Location. Mind that they refer to this functionality as 'location' so it maybe partially available even without actual GPS unit on device if there is another provider type (I guess partially and not for all platforms). I could only find this list of platforms supported:
Qt Location Classes for accessing GPS and other location services and
for mapping and navigation. Split off from the Qt 4 Mobility module of
Qt Location. Supported on Android, BlackBerry, iOS, Linux (using
GeoClue), Windows and Sailfish OS.
As for starting the GPS (location services provider) there is such entry for QML for sure called start() of PositionSource. It also implies one can find the same functionality in C++ as well.
Would I also be able to keep my GPS updates running in the background? Because as soon as I press the home button the updates stop to come up in the console with qDebug... or is it just the qDebug function that can't run when the app is not open?
Home button: it implies Android? Unclear what you ask but the Android app lifecycle is a bit different matter than that. The GPS will be working independently of your app but will the app respond to messages is more determined by Android.

Beaglebone Black, Qt Application, and startup procedure

I have a BBB running Debian 3.18.13-bone70. I have made a Qt application that works great. I would like this application to run on startup.
Currently, I have made a script, placed it in /etc/init.d and made a symbolic link to it in /etc/rc5.d/S05application. This all functions correctly.
The issue that I'm having is when my system boots up, I see my application briefly (<1 second) before the CLI login screen appears and hides my application.
I've tried playing around with the startup script location (moving it to rc2.d, but the same issue persists.
I have a splash screen that times out after 10 seconds, and it moves on to the next screen. After moving to the next screen the application is never hidden again. I would like to see the splash screen the entire time and hide the CLI login screen entirely. How could I go about doing this?
EDIT:
#!/bin/bash
export QWS_MOUSE_PROTO=tslib:/dev/input/event1
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_TSDEVICE=/dev/input/event1
/home/root/./Scanscale -qws
This is the script that I use to start the application. The Qt window service is used when I start the program.
EDIT 2:
I'm running Debian 7 using the Debian 7 image from http://elinux.org/Beagleboard:BeagleBoneBlack_Debian from March 1, 2015. This is maintained by Robert Nelson, I'm not sure if it's a yocto build or something else.
Furthermore, it doesn't appear to be an X issue. I've stopped loading X, I no longer boot into the application and just sit on the command line waiting to log in. The system flickers at about the same point in time. Any thoughts?
I should probably also mention that I'm running it on a 4.3" LCD cape, not on the HDMI interface.
You weren't specific about your system and what else is running on it. For example, is it a yocto build and does it run the sato user interface, or is it more traditional X server with a display manager, window manager, etc? Either way, there is a session-specific file which directs what programs get launched when the Xserver starts up. Using matchbox, that file is .matchbox/session. With X, it's usually xinit, which is driven by .xinitrc or .xserverrc. Also, look at startx as another poster mentioned. The latter can either be in your home directory or /etc/X11. Depending on your system and configuration, likely one of those methods, customized, is what you're looking for. See man xinit for more info.

How to call an app that expects stdin input from QtGui?

I'm using Ubuntu and Qt Creator 4
I have a .cpp program in the executable form (say abc.out) that I wish to run when I press a button. It contains a number of cin and cout, so I want it to run on a "terminal" (on Ubuntu) so that I am able to input and output values to it. How can I do that?
I've tried system() and
also,
QProcess p1;
p1.start(./abc.out);
Using QProcess, my executable runs but stops at the first cout. It runs on the application output screen in Qt Creator and not on terminal.
For example:
I see on application output:
enter name:
When I type the value and press enter here, it doesn't accept the value, but moves to the next line and allows me to type further.
I want to run this abc.out file on the terminal. Any ideas would be really helpful.
Do you mean Qt Creator 2.4? In any case, on the Projects tab, you should find the Run settings section and from there you can find a "Run in terminal" checkbox. You could also use a Custom Executable option and type there: gnome-terminal --command ./abc.out The exact details can vary a bit as I'm using Qt Creator 2.5.
This should work when launching from Qt Creator, but when you use your app outside the IDE, you need to launch it from terminal and not by double clicking the executable. To fix this, I can think of two ways:
Launch a terminal window from QtGui (something like QProcess::execute("gnome-terminal --command ./abc.out"); ), though the problem is different systems have different terminal names.
Provide a Qt input/text box yourself as part of your GUI which then forwards the user input to the executable (something like myqprocess.write(input_asked_from_user_by_QtGui); ). Here you probably need to know what information to ask the user beforehand. If you want to display the cout output of the started process, you can use the read method and friends of the QProcess.
From your question I assume that you are writing an application that launches other applications using QProcess. Thats fine, but if your subprocess is waiting for data from the standard input it will wait forever since you did not provide any data. The stdin of your parent application cannot be automatically guided to the subprocess. Imagine you are starting two processes from your main app. To which child process should the input go?
If you want to communicate with child processes, you must use the QIODevice methods of QProcess and send/read data from/to that application.
The only sensible solution is to launch the target application in a terminal. Whether your own code provides the terminal window or you reuse an existing terminal application is up to you.

Resources