![](/img/trans.png)
[英]How to store preferences (and user settings) in a cross-platform application?
[英]How to use QtWinExtras in cross-platform application
我應該分開模塊和標題包含條件類似
/// .pro file
win32:QT += winextras
/// .cpp file
#ifdef Q_OS_WIN
#include <QtWin>
#endif
/// ... later
#ifdef Q_OS_WIN
QWinTaskbarButton *taskbarButton = new QWinTaskbarButton(this);
#endif
或者我可以省略那些條件?
如果要為多個平台編譯項目,則應該以條件方式使用它們。 這是因為winextras
, x11extras
, macextras
和androidextras
等模塊僅適用於特定的操作系統。 例如,在Linux上,qmake在制作使用winextras
的項目時會給你錯誤。
除非您只想為特定平台編譯它,否則無需使其成為條件。 所以這一切都取決於你和你的用例。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.