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. Qt app in a shared library?
Forum Updated to NodeBB v4.3 + New Features

Qt app in a shared library?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 5.4k 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.
  • M Offline
    M Offline
    mistermost
    wrote on last edited by
    #1

    Apologies if this has been asked and answered before, but I sure as heck can't find it.

    I've got an app written in Qt that I'm trying to convert to a shared library that can be used in multiple host applications - some Qt, some not. The library must be able to pop up its own Qt windows and everything. I'm having a devil of a time getting even a simple test app to work. I can dynamically load functions from the .so and those work, but if I try and pop up a QWindow it immediately segfaults.

    Anybody done this? What do I have to do to make it work? Thanks!

    Here's the .pro, by the way:
    TEMPLATE = lib
    CONFIG += dll
    QMAKE_CXXFLAGS += -fPIC -std=c++0x
    HEADERS = ParamWindow.h
    SOURCES = ParamWindow.cpp
    QT += opengl

    1 Reply Last reply
    0
    • B Offline
      B Offline
      baysmith
      wrote on last edited by
      #2

      I haven't done exactly that, but I have experience with mixing Qt and other UI frameworks. Can you post a full small test which demonstrates what you are trying to do? I'm curious, but the devil is usually in the details.

      Nokia Certified Qt Specialist.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        If you want to show QtWidgets, you need an QApplication instance. If you use your library within a QtApp, you have it, if not, there is a problem.
        You can write some code inside your dll to check, whether a QApp instance iexists, but if you create it, make sure you also delete it in the end.

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Frank
          wrote on last edited by
          #4

          How did you integrate QApplication and its event loop in your test?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on last edited by
            #5

            If you use modal windows, you don't need the QApp event loop, if you use non modal windows, it could be a problem, yes...

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            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