Shared Library Dialog

  • I am new to Qt, ... so new I'm not sure this is the place to ask questions. :-)

    I am evaluating Qt to see if it will work for our next project. A major requirement is to create "modules" for our application. In Windows we did this with .dll's, some of which contained resources.

    I'm not sure how to do this in Qt, but assuming something similar I attempted to create a library and add a dialog. The code contains the following:

    #include <QDialog>

    But this generates the error: "C1083: Cannot open include file: 'QDialog': No such file or directory"

    I'm not seeing any examples on how to do this or if this is even a reasonable approach in Qt. I would be happy to create "modules" in any manner Qt does it. In the end the goal is to share dialogs, resources, code, data,... etc. at runtime.

    Does Qt have this feature and if so, is there an example or documentation on how to do this?


  • Qt Champions 2017


    A major requirement is to create "modules" for our application. In Windows we did this with .dll's, some of which contained resources.

    If you mean to load those "modules" at runtime you'd want to research the plugins.

    But this generates the error: "C1083: Cannot open include file: 'QDialog': No such file or directory"

    Probably you have forgotten to add the QT += widgets line in your project file.

    Kind regards.

  • Hi @kshegunov

    I did add QT+= widgets, but it didn't change the error.


    Project created by QtCreator 2016-03-03T10:18:32


    QT -= gui
    QT += widgets

    TARGET = SharedLibTest
    TEMPLATE = lib


    SOURCES += sharedlibtest.cpp

    HEADERS += sharedlibtest.h

    unix {
    target.path = /usr/lib
    INSTALLS += target

    FORMS +=

    I have not researched "plugins". I heard the term and assumed it referred to adding functionality to the IDE. I'll take a look at that.


  • @kshegunov, I read the link. Are you sure "plugins" is what I want?

    I simply want to start seeing if Qt has the ability to be modular by loading a dialog inside an application where the dialog is replaceable without recompiling the application. Much like a resource .dll is in Windows.

    Do you know if there is an example of using "plugins" to load a dialog?

  • Qt Champions 2017

    please try/read this small sample

    Plugins can BOTH be to extend the qt. but same method/functionality can also be used to extend any Qt app.
    So its like with DLLS just more modern using interfaces.
    So it can easy be a modul for sharing Dialogs or what ever needed.

  • @mrjj

    The example doesn't seem to show a dialog (or any other resource) inside a module. It appears to simply echo text back from a module without any resources to an application.

    Ideally I would like an example already done that demonstrates my goal. If there is none, the next choice would be a tutorial on how to do it.

    Failing all of that, documentation that will give me confidence this will work. I can work from there to create my own example.

    I would very much appreciate a full example.

  • Qt Champions 2017

    Ok. I know no samples that pops a dialog.
    The other examples are about expanding the host application.

    So im afraid u must keep looking.

  • Qt Champions 2017

    I was bored. so I modified echo sample to open dialog
    dialog lives in plugin.
    note the UI file is the resource.

  • @mrjj, I don't see a UI file. All I get is an error message. Also, there is only 1 project.

    I would expect an example to have 2 projects. One that creates the plugin with the dialog, the other an application that uses it. Are my expectations not correct?

  • Qt Champions 2017

    ok let me check zip. there should be 2 folders. did u unzip correctly?

  • Qt Champions 2017

    for me all is in zip ?

    including the UI file. in the plugin folder

    Make sure you unzip it all. do not click inside the zip file.
    extract all first.

  • @mrjj ,

    I must have used the wrong extraction procedure. I'm not up on Windows compression, my mistake.

    I'll take a look. This looks much better. Thanks.

  • Qt Champions 2017

    well windows native zip handling, does "help" one by sort of showing like a folder. :)
    Note. to add dialog to sample was very little.
    Just add Dialog via FIle->New and then add include to plugin and change
    interface function to show ( exec) dialog.

  • @mrjj

    This works, but I can't find the output file. I assume there is something like a .dll this produces. How do I find it and what would it be called?

  • Qt Champions 2017

    yes its a DLL
    for me its in

    The PRO file alters the destination.
    Its so the main program can find it.

    look for echoplugind.dll

    it might also copy to

  • Qt Champions 2017

    It seems @mrjj beat me to it. This thread, however, could also be useful for you.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.