Nitrokey / nitrokey-app

Nitrokey's Application (Win, Linux, Mac)
https://www.nitrokey.com/
287 stars 55 forks source link

Not building with Qt 5.11 #361

Closed darkflash closed 6 years ago

darkflash commented 6 years ago

Expected behaviour

It works with Qt <= 5.10

Steps for reproduction

Qt 5.11 mkdir build cd build mkdir install cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install .. $ make -j4

Logs: /home/user/nitrokey-app/src/ui/stick20responsedialog.cpp: In member function ‘void Stick20ResponseDialog::center_window()’: /home/user/nitrokey-app/src/ui/stick20responsedialog.cpp:59:23: error: incomplete type ‘QStyle’ used in nested name specifier setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, size(), ^~~ /home/user/nitrokey-app/src/ui/stick20changepassworddialog.cpp: In member function ‘void DialogChangePassword::moveWindowToCenter()’: /home/user/nitrokey-app/src/ui/stick20changepassworddialog.cpp:196:15: error: incomplete type ‘QStyle’ used in nested name specifier QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, size(), desktop->availableGeometry(), size)); ^~~ make[2]: [CMakeFiles/nitrokey-app.dir/build.make:227: CMakeFiles/nitrokey-app.dir/src/ui/stick20changepassworddialog.cpp.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: [CMakeFiles/nitrokey-app.dir/build.make:279: CMakeFiles/nitrokey-app.dir/src/ui/stick20responsedialog.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:68: CMakeFiles/nitrokey-app.dir/all] Error 2

I think the problem is related to some methods of this class: https://doc.qt.io/qt-5/qstyle.html

xajler commented 6 years ago

Actually everything is OK with that class, to compile this code with Qt 5.11 you'll need to add:

#include <QStyle>

into this two files: src/ui/stick20changepassworddialog.cpp src/ui/stick20responsedialog.cpp

And hopefully somebody at nitrokey will upgrade this code to Qt 5.11. Tested working on ArchLinux.

darkflash commented 6 years ago

I confirm that adding #include <QStyle>
the files will be compiled. Thanks.

szszszsz commented 6 years ago

Corrected, thank you!