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. XDG Desktop portal in Qt
Forum Updated to NodeBB v4.3 + New Features

XDG Desktop portal in Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
xdgflatpak
2 Posts 2 Posters 1.1k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    chronix
    wrote on last edited by
    #1

    I'm trying to open file in a Qt app via org.freedesktop.portal.FileChooser. So far it works the thing I'm stuck with is the filters.

    The doc say to use the format filters a(sa(us))

    QDBusMessage message = QDBusMessage::createMethodCall(
        QLatin1String("org.freedesktop.portal.Desktop"),
        QLatin1String("/org/freedesktop/portal/desktop"),
        QLatin1String("org.freedesktop.portal.FileChooser"),
        QLatin1String("OpenFile"));
    
    message << QLatin1String("x11:") << QLatin1String("Open PDF File") <<
    QVariantMap {
            {QLatin1String("handle_token"), getRequestToken()},
            {QLatin1String("multiple"), false},
             {QLatin1String("filters"), QVariantMap {
             {QLatin1String ("PDF File"), QVariantList {
                     {}
                }}
            }}
    };
    

    Can some help me how to write a filter for PDF file.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Not a direct answer but why not use QDesktopService::openUrl ?

      Or are you trying to make your app open that file type ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

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