Qt5學(xué)習(xí):Qwt的安裝與使用

一、環(huán)境

  • QT 版本:QT 5.8.0(msvc2013_64)
  • QWT 版本:qwt 6.1.3

二、配置

  • 從官網(wǎng)下載 qwt 壓縮包后將其解壓到 QT 安裝目錄下;
    在這里 QT 的安裝目錄為 D:\Qt 。
  • 雙擊 qwt.pro 項(xiàng)目,使用 qt creater 直接打開(kāi) qwt.pro 項(xiàng)目;
  • 打開(kāi) qwt.pro 項(xiàng)目中 designer 目錄下的 qwtbuild 目錄中的 qwtbuild.pri;
  • 更改代碼如下:

改前:

win32 {
    # On Windows you can't mix release and debug libraries.
    # The designer is built in release mode. If you like to use it
    # you need a release version. For your own application development you
    # might need a debug version. 
    # Enable debug_and_release + build_all if you want to build both.

    CONFIG           += debug_and_release
    CONFIG           += build_all
}

改后:

win32 {
    # On Windows you can't mix release and debug libraries.
    # The designer is built in release mode. If you like to use it
    # you need a release version. For your own application development you
    # might need a debug version. 
    # Enable debug_and_release + build_all if you want to build both.

    #CONFIG           += debug_and_release
    CONFIG           += build_all
}
  • 直接編譯運(yùn)行;
  • 編譯好時(shí)會(huì)有一個(gè)彈窗,不用管它,直接取消就可以了,然后將 D:\Qt\Qwt\build-qwt-Desktop_Qt_5_8_0_MSVC2013_64bit-Debug\designer\plugins\designer 目錄下的 qwt_designer_plugin.dll 文件拷貝到 D:\Qt\Qt5.8.0\5.8\msvc2013_64\plugins\designer 目錄夾下;
  • 將 D:\Qt\Qwt\build-qwt-Desktop_Qt_5_8_0_MSVC2013_64bit-Debug\lib 目錄下的 qwt.dll 和 qwtd.dll 文件拷貝到 D:\Qt\Qt5.8.0\5.8\msvc2013_64\bin 目錄下;
  • 將 D:\Qt\Qwt\build-qwt-Desktop_Qt_5_8_0_MSVC2013_64bit-Debug\lib 目錄下的 qwt.lib 和 qwtd.lib 文件拷貝到 D:\Qt\Qt5.8.0\5.8\msvc2013_64\lib 目錄下;
  • 在 D:\Qt\Qt5.8.0\5.8\msvc2013_64\include 目錄下新建文件夾 qwt ,將原 qwt 目錄中 src 目錄中的所有 .h 文件拷貝進(jìn)該新建文件夾。

注意:qwt 控件需要右擊 ui 文件,選擇“用...打開(kāi)”中的 Qt Designer 才能看到,直接雙擊 ui 文件打開(kāi)看不到。
完成以上操作,qwt已經(jīng)差不多配置好了,但還不能直接運(yùn)用。

三、運(yùn)用

新建一個(gè)項(xiàng)目,在項(xiàng)目文件(.pro)中添加一下代碼:

LIBS += -LD:\Qt\Qt5.8.0\5.8\msvc2013_64\lib -lqwtd
INCLUDEPATH += D:\Qt\Qt5.8.0\5.8\msvc2013_64\include\qwt

到這里 qwt 控件就可以運(yùn)行了。

qwt運(yùn)行例圖.PNG
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容