QWT plugin not found/loaded [SOLVED]



  • Hi,

    I'm very new to QT and just started using linux/QT last week. I'm just interested to experiment a little with communicating with external home-made datalogging devices over ethernet and RS233. In order to get some meaningful data on screen I would like to use QWT which seams to be exactly what I need.

    So far I have been able to perform this:

    • Get a laptop running with ubuntu 15.04
    • Install QT 5.5.0 as normal user (not using sudo) in /home/petervg/Qt5.5.0 by downloading the offline installer "qt-opensource-linux-x64-5.5.0-2"
    • make sure the correct version of qmake is used (QMake version 3.0, Using Qt version 5.5.0 in /home/petervg/Qt5.5.0/5.5/gcc_64/lib). I noticed that on ubuntu QT4 is installed by default, so I modified the qtchooser 'default' profile to use the correct version of qmake.
    • compile the QWT 6.2.1 sourcecode and install it in "/usr/local/qwt-6.1.2"
    • Get some basic code I found on the net compiled and executing properly (http://www.codeprogress.com/cpp/libraries/qt/showQtCustomExample.php?index=602&Filename=QWTPlotCurveSetData). I just added "#include <qwt_point_data.h>" to main.cpp to get this to work. The code compiles without errors/warnings and the plot is displayed as expected.

    So all in all so far this all seams to work properly. Now for the problem:
    I would like to use the QWT plugin to be able to graphically add the widgets to a form, but the widgets are not available in the list and looking at "about qt designer plugings" it appears the QWT plugin is not loaded. <- this is the main issue I cannot get solved.

    I've looked on the net to try and solve this (seems to be a rather frequent issue) but none of the information I found helped me to get the last bit solved. I

    The QWT plugin is located in "/usr/local/qwt-6.1.2/plugins/designer" whereas the other (working) plugins like QDeclarativeview, QQuickWidget and QWebView are located in "/home/petervg/Qt5.5.0/5.5/gcc_64/plugins/designer".

    I have already added these lines to .bashrc:
    QMAKEFEATURES=/usr/local/qwt-6.1.2/features
    QT_PLUGIN_PATH="/usr/local/qwt-6.1.2/plugins:/home/petervg/Qt5.5.0/5.5/gcc_64/plugins"
    QTDIR=/home/petervg/Qt5.5.0
    export QTDIR
    export QT_PLUGIN_PATH
    export QMAKEFEATURES

    I found some code on the net that displays the paths used by QT to look for plugins:

    QCoreApplication a(argc, argv);
    QStringList paths = QCoreApplication::libraryPaths();
    for (QStringList::iterator it = paths.begin(); it!=paths.end(); it++)
    {
        std::cout << "Looking for plugins at path: " << it->toStdString() << std::endl;
    }
    

    The code works and displays this when I run the compiled code in a terminal:
    Looking for plugins at path: /home/petervg/Qt5.5.0/5.5/gcc_64/plugins
    Looking for plugins at path: /home/petervg/Documents/QT Projects/GetUsedPluginDirs/build-PluginDirs-Desktop_Qt_5_5_0_GCC_64bit-Debug
    Looking for plugins at path: /usr/local/qwt-6.1.2/plugins

    When I run the code from within Qt (press ctrl-r) I get this:
    Looking for plugins at path: /home/petervg/Qt5.5.0/5.5/gcc_64/plugins
    Looking for plugins at path: /home/petervg/Documents/QT Projects/GetUsedPluginDirs/build-PluginDirs-Desktop_Qt_5_5_0_GCC_64bit-Debug
    -> The folder "/usr/local/qwt-6.1.2/plugins" is not displayed here?

    Because of this, the next I tried to copy the QWT plugin (/usr/local/qwt-6.1.2/plugins/designer/libqwt_designer_plugin.so) to /home/petervg/Qt5.5.0/5.5/gcc_64/plugins/designer, but still the QWT plugin didn't load.


    Next test I did was a tip I found on http://canvoki.net/Codders/qtpluginnotloading.html where they say to move around the working plugins to see what folders are actually used to find the plugins. Copying all plugins from "/home/petervg/Qt5.5.0/5.5/gcc_64/plugins/designer" to "/usr/local/qwt-6.1.2/plugins/designer" -> all existing plugings except QWT pluging are found.

    And this is now where it just got too weird for me:
    I deleted all the plugins from both "/home/petervg/Qt5.5.0/5.5/gcc_64/plugins/designer" and "/usr/local/qwt-6.1.2/plugins/designer" to make sure they are indeed not found anywhere else , but after deleting them they still appear in "about qt designer plugings" (and yes I pressed 'refresh' and restarted qt).

    So...

    • I suspect neither "/home/petervg/Qt5.5.0/5.5/gcc_64/plugins/designer" nor "/usr/local/qwt-6.1.2/plugins/designer" is the correct folder where the plugin should be placed. But then where do I have to place them?
    • Why is the console application that reports the plugin folder search path producing 2 different outputs?
    • Why doesn't adding the QT_PLUGIN_PATH var to my .bashrc file help QT to locate the QWT plugin?

    If anybody could shed some light on this, I would really appreciate it. I'm a linux/cpp/qt newbie, so I hope I provided enough information...

    With kind regards
    Peter


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You can call Qt Creator from the command line with QT_DEBUG_PLUGINS=1 so you can observe what happens with the plugin loading part.



  • Hi SGaist,

    thanks for tip!

    I tried setting QT_DEBUG_PLUGINS to 1 and starting the designer from command line, but suddebly everything seemed to be OK. In the output I could see the plugin being found and loaded, and in designer I could also see the widgets. Starting qt from the graphical ui hower still did not work (qwt widgets not displayed).

    This led me to conclude there was a difference in settings that are used when starting qt from a graphical shell and starting it from within terminal.

    And look and behold... I added the lines below to /etc/environment and suddenly I could start qt from the graphical interface with the QWT widgets available.
    QMAKEFEATURES=/usr/local/qwt-6.1.2/features
    QT_PLUGIN_PATH="/usr/local/qwt-6.1.2/plugins:/home/petervg/Qt5.5.0/5.5/gcc_64/plugins"
    QTDIR=/home/petervg/Qt5.5.0
    export QTDIR
    export QT_PLUGIN_PATH
    export QMAKEFEATURES

    So as for my own conclusions (correct me if I'm wrong)

    • I suspect neither "/home/petervg/Qt5.5.0/5.5/gcc_64/plugins/designer" nor "/usr/local/qwt-6.1.2/plugins/designer" is the correct folder where the plugin should be placed. But then where do I have to place them?
      -> This is the correct folder to place them

    • Why is the console application that reports the plugin folder search path producing 2 different outputs?
      -> I added extra paths to .bashrc, but these paths are ONLY used when starting a terminal.

    • Why doesn't adding the QT_PLUGIN_PATH var to my .bashrc file help QT to locate the QWT plugin?
      -> Same as above. System wide variables/paths should be placed in /etc/environment ad not in .bashrc. .bashrc is only used in a terminal.

    With kind regards
    Peter


  • Lifetime Qt Champion

    Did you logout and login again after modifying your .bashrc ?



  • hmm, not sure about that one... I think I did, but I know I've been putting this laptop into suspend often because it's not the fastest pc I have :-)

    Anyway, I found this on https://help.ubuntu.com/community/EnvironmentVariables

    Shell config files such as ~/.bashrc, ~/.bash_profile, and ~/.bash_login are often suggested for setting environment variables. While this may work on Bash shells for programs started from the shell, variables set in those files are not available by default to programs started from the graphical environment in a desktop session

    So I didn't test any further.


Log in to reply
 

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