Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use QWinJumpList to show QWidget on Jumplist item click. Windows 10
QtWS25 Last Chance

How to use QWinJumpList to show QWidget on Jumplist item click. Windows 10

Scheduled Pinned Locked Moved General and Desktop
qtwinextrasqwinjumplistwindows 10
6 Posts 3 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JGruber
    wrote on 14 Jul 2016, 07:15 last edited by
    #1

    Hi. QtWinExtras is a great module but it appears to missing some functionality that is critical to my application design. My application does not have a main window, instead I am using dialog windows. I would like to be able to show dialog windows when items in the jump list are clicked but I don't see support for this in QWinJumplist. There appears to be no signal I can connect to for when a jumplist item is clicked either.

    How can I achieve the desired behavior? Even a hack solution would do fine for my purpose. Cheers.

    alt text

    #include "jumplistview.h"
    
    #include <QDialog>
    
    JumpListView::JumpListView() // inherits QWinJumpList no parent
    {
        m_launcherCategory = new QWinJumpListCategory("Launcher");
        this->addCategory(m_launcherCategory);
    
        // For demonstration purposes
        m_myDialog = new QDialog();
        m_myDialog->setWindowTitle("My Dialog");
        this->addDialogLink(m_myDialog);
    
        m_launcherCategory->setVisible(true);
    }
    
    void JumpListView::addDialogLink(QDialog *dialog)
    {
        QWinJumpListItem *jumpListItem = new QWinJumpListItem(QWinJumpListItem::Link);
    
        jumpListItem->setTitle(dialog->windowTitle());
    
        // ??? "connect" jumplist item click to dialog show slot
    
        m_launcherCategory->addItem(jumpListItem);
    }
    
    
    1 Reply Last reply
    0
    • V Offline
      V Offline
      VRonin
      wrote on 14 Jul 2016, 07:57 last edited by VRonin
      #2

      The problem is due to the fact that QWinJumpListItem is not a QObject.
      The workaround I'd use is to create a separate executable that based on the argument it is started with sends different messages using QLocalSocket, the main application should receive this messages and react opening the dialogs. This way you can use QWinJumpListCategory::addLink to call the utility from the jump list.

      Schematically:
      click the jumplist item -> starts the utility application with an argument -> the utility application connects to the main one using QLocalSocket and notifies the main app of what argument it was provided -> the main app opens the dialog corresponding to that argument

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JGruber
        wrote on 14 Jul 2016, 08:06 last edited by
        #3

        Thanks. I will give that a go. So in that case I will have an additional utility console application that simply relays QLocalSocket messages that my application receives and then shows the window. I'll just use the QDialog object name as the string. I've never used QLocalSocket so it's going to take me a while to implement. Will let you know how it goes.

        R 1 Reply Last reply 14 Jul 2016, 10:33
        0
        • J JGruber
          14 Jul 2016, 08:06

          Thanks. I will give that a go. So in that case I will have an additional utility console application that simply relays QLocalSocket messages that my application receives and then shows the window. I'll just use the QDialog object name as the string. I've never used QLocalSocket so it's going to take me a while to implement. Will let you know how it goes.

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 14 Jul 2016, 10:33 last edited by
          #4

          @JGruber
          maybe then it's easier for you to call your application's exe again and integrate QtSingleApplication? If it also meets your requirement that only 1 instance at the time of your application should be open.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          J 1 Reply Last reply 14 Jul 2016, 11:15
          2
          • R raven-worx
            14 Jul 2016, 10:33

            @JGruber
            maybe then it's easier for you to call your application's exe again and integrate QtSingleApplication? If it also meets your requirement that only 1 instance at the time of your application should be open.

            J Offline
            J Offline
            JGruber
            wrote on 14 Jul 2016, 11:15 last edited by
            #5

            @raven-worx
            Could you please explain that in another way? We're building a commercial product so there is some reluctance to integrate 3rd-party libraries for support reasons.

            R 1 Reply Last reply 14 Jul 2016, 11:27
            0
            • J JGruber
              14 Jul 2016, 11:15

              @raven-worx
              Could you please explain that in another way? We're building a commercial product so there is some reluctance to integrate 3rd-party libraries for support reasons.

              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 14 Jul 2016, 11:27 last edited by raven-worx
              #6

              @JGruber
              QtSingleApplication is an more or less official (former Qt Solutions) "extension".
              It ensures in a cross platform way that only 1 instance of the application is running. If a second instance is started it signals a message to the already running application.
              It comes in BSD license and it's enough to copy the few files to your source tree.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0

              4/6

              14 Jul 2016, 10:33

              • Login

              • Login or register to search.
              4 out of 6
              • First post
                4/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved