Results 1 to 2 of 2

Thread: QApplication: modify Windows systray using QWinTaskbarButton

  1. #1
    Join Date
    Apr 2013
    Posts
    61
    Qt products
    Qt4
    Platforms
    Windows

    Default QApplication: modify Windows systray using QWinTaskbarButton

    Hi,

    I have a QT application (QT .9.1) and I need to modify the icon in the windows taskbar, when I have an error. I am trying with QWinTaskbarButton, it seems to be really simple but I failed.

    My application is a QtQuickControlsApplication (a QApplication), where I have a manager QObject class.

    In this class I create a QQmlApplicationEngine, which I use to load the main QML.

    From the documentation (http://doc.qt.io/qt-5/qwintaskbarbutton.html#details):

    Qt Code:
    1. QWinTaskbarButton *button = new QWinTaskbarButton(widget);
    2. button->setWindow(widget->windowHandle());
    3. button->setOverlayIcon(QIcon(":/loading.png"));
    To copy to clipboard, switch view to plain text mode 

    But i don't know what to set in 'widget' and 'widget->windowHandle()'

    I have tried to get a widget from the qApp but failed:
    Qt Code:
    1. qApp->activeWindow() is NULL
    2. qApp->topLevelWindows().at(0) is valid, but failed:
    3.  
    4. QWinTaskbarButton *button = new QWinTaskbarButton(qApp->topLevelWindows().at(0));
    5. button->setWindow(qApp->allWidgets().at(0)->windowHandle());
    6. button->setOverlayIcon(QIcon(":/images/icon.png"));
    To copy to clipboard, switch view to plain text mode 

    I would appreciate any help,

    Thanks in advance,
    Diego

  2. #2
    Join Date
    Apr 2013
    Posts
    61
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QApplication: modify Windows systray using QWinTaskbarButton

    I get the icon using the corresponding QML type of WinTaskbarButton. But I need to show a number over the icon, is it possible? Thanks

Similar Threads

  1. Replies: 16
    Last Post: 11th June 2014, 08:16
  2. Replies: 6
    Last Post: 3rd August 2012, 07:48
  3. Systray icon no displayed under windows seven
    By flamaros in forum Qt Programming
    Replies: 2
    Last Post: 12th February 2011, 15:10
  4. systray: icon does not display in windows server 2003
    By lovelypp in forum Qt Programming
    Replies: 0
    Last Post: 23rd September 2008, 11:47
  5. How can I get the Systray height ?
    By Nyphel in forum Qt Programming
    Replies: 3
    Last Post: 12th March 2007, 10:04

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.