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. Creating custom mime types
Forum Updated to NodeBB v4.3 + New Features

Creating custom mime types

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.0k Views 3 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.
  • A Offline
    A Offline
    ArshadM
    wrote on 2 Jan 2020, 11:43 last edited by
    #1

    Hi,

    I am trying to create some custom mime types that I will be using within my application. However, there doesn't seem to be an easy mechanism to add custom mime types to the QMimeDatabase in a portable way.

    Is there any reason why this class doesn't have a load function which takes as input an XML string with mime type definitions that can be added to the mime types that exist in the database?

    I don't need these mime types to be persistent, they need to exist only while my application is running.

    Regards,

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 2 Jan 2020, 11:58 last edited by
      #2

      Hi
      I think the reason is that runtime only MimeTypes are not that common.
      But this is a user forum so its purely a guess.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 2 Jan 2020, 16:39 last edited by
        #3

        Hi,

        Out of curiosity, how will you use these mime types ?

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

        A 1 Reply Last reply 2 Jan 2020, 21:58
        0
        • S SGaist
          2 Jan 2020, 16:39

          Hi,

          Out of curiosity, how will you use these mime types ?

          A Offline
          A Offline
          ArshadM
          wrote on 2 Jan 2020, 21:58 last edited by ArshadM 1 Feb 2020, 22:12
          #4

          @SGaist

          Hi, so basically my application is composed of a whole load of plugins and I expect eventually users will add their own.

          I have notions of document editor plugins, these support existing mime types such as (application/pdf) but also custom types of documents that are defined in my application (e.g. mind maps, org charts, etc). I want a generic way of asking a plugin what document types it supports, including vendor specific ones.

          I have reverted to using strings for the moment instead of mime types, because I can create them for my vendor specific mime types. And it's too much hassle to install them on the system.

          In my particular scenario it would be ideal if I could load the additional vendor specific mime types from an xml resource in the application. But if there was an API to add additional mime types in an easy way then that would be fine too.

          Regards,

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 5 Jan 2020, 08:19 last edited by
            #5

            AFAIK, mime types are defined as string. As for using QMimeDatabase, there's a description in the details of the class on how to support new mime types so you likely need to explore that part for the OSs you want to target.

            As for your question about having an API to dynamically add custom types, I don't know. I would say that it is likely because most of the time you either register a new "official" type with your OS or you handle that specific type yourself because it's really only of interest to your application internals.

            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

            1/5

            2 Jan 2020, 11:43

            • Login

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