QT widget for on WindowsXP - qt

I need to create a widget which shows battery status(in percentage) inside my qt application. Can anybody suggest me how to get the winXP api to know the battery status. Then as the api will return the percentage I will display on my widget....

I think this is the function you want.
http://msdn.microsoft.com/en-us/library/aa372693%28v=VS.85%29.aspx

Related

Java FX system tray message

I'm developping an application that needs to run silently in the system tray.
That's why i used this SOLUTION first to hide my application in the System Tray, which is working really nicely.
However at some point my users will need to be notified about things. Like on Skype or Msn, when you get a message you are being notified of it with a popup in the right bottom zone of your display.
I'm looking for a way to reproduce this, i couldn't find anything in the java.awt.SystemTray doc. Is there any native class doing this or should i try to reproduce it by generating a window myself ?
First there is the answer from JavaFX: what is the best way to display a simple message?. This uses a custom popup as javafx from java 8 could not be used by the implementor.
If you can use javafx2 (the one with java 8) you can look at the Controlsfx library found here: Notifications with Controlsfx

Triggering Windows Store background task from Band tile opened events

Is there a good way to trigger a Windows Store background task when a band tile is opened? And are there any examples for working with the band from a background task with the latest SDK? I have seen mentions of the ability to do so but can't find any code examples of this.
I have a scenario where the tile's content is only valid for a short time (~30 seconds) and would like to wake up a background service on the phone while the band's tile is open to update the content as needed.
I was hoping to find an IBackgroundTrigger in the SDK that would do the trick but no luck there. The best I can think of to fill this need would be to have a task that uses a system trigger and hooks up listeners for the tile opened/closed events. This seems like a lot of unnecessary work for the task though and could end up with unnecessary battery usage on the phone.
Thanks,
Tony
I'm afraid that is not possible. As far as I can see from the SDK, the app on the phone has to be running to allow a tile on the band to send an event back to the phone.
An alternative would be to open your app from the Band using a voice command. Would that solve your problem?

libvlc_media_player_set_hwnd doesn't work with QWidget Handle

I am using Qt4.8 Windows version to develope an application to stream video using libvlc 2.2.1. When I use libvlc_media_player_set_hwnd() to render the video on my QWidget, its rather creating a separate window to display the video.
libvlc_media_player_set_hwnd(m_player, (void*)videoWidget->winId());
I have tried all versions of libvlc and all the examples related to libvlc with Qt. Also followed the steps given in https://wiki.videolan.org/LibVLC_SampleCode_Qt/
But I am not sure if I m missing anything.
It looks like as if libvlc_media_player_set_hwnd() is not able to take the QWidget WinId and creating its own window. However the value of (void*)videoWidget->winId() seems to be a valid one. (I got the value as 0x65).
Please let me know if I am missing anything.
You need to make sure you are configuring your VLC instance correctly first, so that it uses the dummy interface, for example:
/* Load the VLC engine */
std::vector<const char*> options;
options.push_back("--intf=dummy");
return libvlc_new(int(options.size()), options.data());
Also, are you sure you are passing the handle to the correct widget to render on? Also, make sure to set some size on the parent widget, otherwise you may not see anything render at all. Finally, check what media options you are setting to your media player instance, you may be inadvertently telling it to render to generated window.
I've been able to get VLC to work in my own Qt application using the following example as a starting point, even though it is for VLC 1.X:
LibVLC SampleCode Qt - VideoLAN Wiki

How can I find the screen/desktop size in Qt, so I can display a desktop notification?

I want to code a notification window at the bottom right corner of the desktop, so it works like Skype notifications when someone comes online. Can someone help me get the screen size of the desktop, so I can place my notification window at the bottom right corner using my Qt Application?
You can use the QDesktopWidget
auto const rec = QApplication::desktop()->screenGeometry();
auto const height = rec.height();
auto const width = rec.width();
QScreen class (since Qt 5.0) provide information about size of screen (logical and physical), orientation and signals for changes.
QScreen *screen = QGuiApplication::primaryScreen();
QRect screenGeometry = screen->geometry();
int height = screenGeometry.height();
int width = screenGeometry.width();
upd:
for multiscreen configuration please use QList <QScreen*> screens = QGuiApplication::screens();
for orientation (including multiscreen) please use screen->orientation() and (since Qt 5.2)screen->nativeOrientation()
You haven't stated which platform you're developing for, but some platforms have API for showing notifications. It's best to use those, when available, because the bottom right if the screen may not be appropriate. You can fall back on krammer's answer.
In GNOME, for example, the user can make notifications appear on a particular screen, or elect to not show them at all, until they click on a system tray icon. The libnotify API gives the developer access to this feature.
Speaking of system trays, you may want to consider using a QSystemTrayIcon instead. It would make UI a bit different, but has a platform-independent Qt API, which works for GNOME, KDE, MacOS, Windows and probably other platforms. It also has a showMessage method for showing messages in a manner native for the platform, such as in a balloon with a cute popping sound for some versions of Windows.

Inner Active add Api with QML

I am trying to get the inner active add Api to work with QML. I have found this Nokia example: http://projects.developer.nokia.com/fifteenpuzzle on how to do it. I plan to just use the add widget they use in my own app but when I compile the app it gives this error: "'KErrNone' was not declared in this scope" on anything excpet Symbian and once it runs on Symbian the add area is just black and after a while I get this error: "AdBannerWidget::onNetworkError = "Error downloading http://cdn1.inner-active.mobi/mnt/InnerActive/Resources/USAGC/eng_pic.gif - server replied: Not Found"".
Please help I have no idea what could be causing this, it's probably something stupid but I really need help.
I also get a error while trying to design the qml because of it not being able to "import Analytics 1.0"
I do have a inner active account and I have tried it using my own tag they generated for me but it still doesn't work.
My name is Nirit and I'm a support manager at inneractive.
we just released our new Beta QML open-sourced project, it is now available on your Dashboard (the SDKs tab).
Please download the .zip file and take the time to read through our clear and concise documentation.
If you have any questions or comments, please don't hesitate to contact me.
Nirit (nirit#inner-active.com).
For the black widget and network error, I bet you have to register first with inneractive to get an actual account.
"KErrNone" seems indeed symbian only. Might be that the project is just no meant to compiled on desktop as such. You maybe would have to #ifdef Q_OS_SYMBIAN some parts of it.

Resources