Additional style plugins

  • Hello forum,

    I upgraded Qt from 4.7 to 5.2.1 and used QCleanlooksstyle in my project.
    on ",75758" I found the additional styles.
    So I checked all out from the repository, opened the .pro file in QtCreator and compiled all successfully.
    After that I installed the plugins with "make install". Everything looked good.

    in my .pro file I added the line: QTPLUGIN += qcleanlooksstyle
    In the main window constructor I added qApp->setStyle(new QCleanlooksStyle());

    and get the linker error:
    undefined reference to `QCleanlooksStyle::QCleanlooksStyle()'

    What is wrong?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you build your plugin statically ? QTPLUGIN is only needed in this case

  • Hi , thanks for answering

    No I linked it dynamically. After compilation and installation I found in my Qt installation a new folder
    with three libs

    I'd like to carry on using cleanlooksstyle as I did with Qt 4.7.
    but get always the error message.

  • Lifetime Qt Champion

    IIRC, you would need to use "this version": of setStyle

  • Well that works fine now when linking dynamically.
    After that I linked the plugins statically and tried again with static linking to my project.
    I have now additional the libs

    Now qmake says:
    Project WARNING: Plugin class name could not be determined for qcleanlooksstyle plugin.

  • Lifetime Qt Champion

    Did you setup your project to use static plugins ?

  • I think I have. I compiled a static version of Qt for testing purposes and start it on second computer without any Qt installation and it works.
    I have to import mysql plugin in the static version and it works.
    Is it possible that Qtcreator can't find the new folder "styles" because it is not in any "...PATH" variable?
    If it is where can i add it?

  • I looked around in the modules folder of my static Qt and found several .pri files. I found qt_plugin_qcleanlooksstyle.pri with the following content

    QT_PLUGIN.qcleanlooksstyle.TYPE = styles
    QT_PLUGIN.qcleanlooksstyle.CLASS_NAME =

    After that I opened the .pri file of a working plugin qt_plugin_qsqlmysql.pri

    QT_PLUGIN.qsqlmysql.TYPE = sqldrivers
    QT_PLUGIN.qsqlmysql.CLASS_NAME = QMYSQLDriverPlugin

    It seemed, that in the style pri file the class name is misssing. So I added the class name to the file.

    QT_PLUGIN.qcleanlooksstyle.TYPE = styles
    QT_PLUGIN.qcleanlooksstyle.CLASS_NAME =QCleanlooksStyle

    qmake was satisfied with this solution, BUT at link time another error occured :
    undefined reference to `qt_static_plugin_QCleanlooksStyle()

    Something goes wrong ????

  • Lifetime Qt Champion

    It looks like the static plugin is not found, are you sure you have it at the right place ?

  • The place seems to be ok. I rebuild the plugins and added the class name in the modules file ( see post above ). qmake finds the plugin now.
    @g++ -Wl,-O1 -o DockWidgets main.o MainWindow.o dockwidgets_plugin_import.o moc_MainWindow.o -L/home/jaensch/QtStatic5.2.1/lib -L/home/jaensch/QtStatic5.2.1/plugins/styles -lqcleanlooksstyle -lQt5Widgets -lgobject-2.0 -L/home/jaensch/QtStatic5.2.1/plugins/sqldrivers -lqsqlmysql -lmysqlclient_r -lssl -lcrypto -lqsqlite -lQt5Sql -L/home/jaensch/QtStatic5.2.1/plugins/platforms -lqxcb -lX11-xcb -lXi -lSM -lICE -ldbus-1 -lxcb -L/home/jaensch/Downloads/qt-everywhere-opensource-src-5.2.1/qtbase/src/plugins/platforms/xcb/xcb-static -lxcb-static -L/home/jaensch/Downloads/qt-everywhere-opensource-src-5.2.1/qtbase/lib -lxkbcommon -lQt5PlatformSupport -lfontconfig -lfreetype -lXrender -lXext -lX11 -lQt5DBus -lQt5Gui -ljpeg -lpng -lEGL -lQt5Core -lz -licui18n -licuuc -lpcre16 -lm -ldl -lgthread-2.0 -pthread -lglib-2.0 -lrt -lGL -lpthread
    /home/jaensch/QtStatic5.2.1/lib/libQt5Widgets.a(qstylehelper.o): In function QStyleHelper::uniqueName(QString const&, QStyleOption const*, QSize const&)': qstylehelper.cpp:(.text+0x190): multiple definition ofQStyleHelper::uniqueName(QString const&, QStyleOption const*, QSize const&)'
    /home/jaensch/QtStatic5.2.1/plugins/styles/libqcleanlooksstyle.a(qstylehelper.o):qstylehelper.cpp:(.text+0x190): first defined here
    /home/jaensch/QtStatic5.2.1/lib/libQt5Widgets.a(qstylehelper.o): In function QStyleHelper::calcBigLineSize(int)': qstylehelper.cpp:(.text+0xdf0): multiple definition ofQStyleHelper::calcBigLineSize(int)'
    /home/jaensch/QtStatic5.2.1/plugins/styles/libqcleanlooksstyle.a(qstylehelper.o):qstylehelper.cpp:(.text+0xd10): first defined here
    /home/jaensch/QtStatic5.2.1/lib/libQt5Widgets.a(qstylehelper.o): In function QStyleHelper::angle(QPointF const&, QPointF const&)': qstylehelper.cpp:(.text+0xe20): multiple definition ofQStyleHelper::angle(QPointF const&, QPointF const&)'
    /home/jaensch/QtStatic5.2.1/plugins/styles/libqcleanlooksstyle.a(qstylehelper.o):qstylehelper.cpp:(.text+0xd40): first defined here
    /home/jaensch/QtStatic5.2.1/lib/libQt5Widgets.a(qstylehelper.o): In function QStyleHelper::drawBorderPixmap(QPixmap const&, QPainter*, QRect const&, int, int, int, int)': qstylehelper.cpp:(.text+0xf10): multiple definition ofQStyleHelper::drawBorderPixmap(QPixmap const&, QPainter*, QRect const&, int, int, int, int)'
    /home/jaensch/QtStatic5.2.1/plugins/styles/libqcleanlooksstyle.a(qstylehelper.o):qstylehelper.cpp:(.text+0xe30): first defined here
    /home/jaensch/QtStatic5.2.1/lib/libQt5Widgets.a(qstylehelper.o): In function QStyleHelper::calcLines(QStyleOptionSlider const*)': qstylehelper.cpp:(.text+0x1560): multiple definition ofQStyleHelper::calcLines(QStyleOptionSlider const*)'
    /home/jaensch/QtStatic5.2.1/plugins/styles/libqcleanlooksstyle.a(qstylehelper.o):qstylehelper.cpp:(.text+0x1480): first defined here
    /home/jaensch/QtStatic5.2.1/lib/libQt5Widgets.a(qstylehelper.o): In function QStyleHelper::drawDial(QStyleOptionSlider const*, QPainter*)': qstylehelper.cpp:(.text+0x1aa0): multiple definition ofQStyleHelper::drawDial(QStyleOptionSlider const*, QPainter*)'
    /home/jaensch/QtStatic5.2.1/plugins/styles/libqcleanlooksstyle.a(qstylehelper.o):qstylehelper.cpp:(.text+0x19c0): first defined here
    collect2: error: ld returned 1 exit status
    make: *** [DockWidgets] Error 1
    08:22:26: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project DockWidgets (kit: Static Desktop Qt 5.2.1 GCC 64bit)
    When executing step 'Make'
    08:22:26: Elapsed time: 00:02.@


  • Lifetime Qt Champion

    The static plugins are built in Qt so your use case is special. What you can do since you already build Qt yourself is to integrate it to Qt

Log in to reply

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