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. Registering a custom QTextCodec from a staticlib
Forum Updated to NodeBB v4.3 + New Features

Registering a custom QTextCodec from a staticlib

Scheduled Pinned Locked Moved General and Desktop
3 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.
  • K Offline
    K Offline
    Kivin
    wrote on last edited by
    #1

    The title pretty much says it all. I want to be able to instantiate a QTextCodec from my static lib (globally, I guess) such that when I call QTextCodec::codecForName or QTextCodec::codecForMib from the application, the codec has already been registered - without the application knowing or needing to do it itself.

    I tried adding a global to the static lib. Either: QMyCodec g_mycodec; or QMyCodec * g_mycodec = new QMyCodec; but it doesn't actually get constructed unless my application references it some how; and at that point, I might as well have just constructed one outright from my _main() function.

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      Well AFAIK QTextCodec has no Qt-Plugin support (e.g. like the imageformats are). So they are not automatically loaded for you by Qt if they are needed.
      You have to register them manually.

      --- 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
      • K Offline
        K Offline
        Kivin
        wrote on last edited by
        #3

        I'm not talking about Qt-Plugins. My question could apply to any class instance which needs to be initialized in the global scope of a static lib.

        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