一、源码下载
【1】https://gitee.com/czyt1988/SARibbon/tree/master/src
【2】Qt下的Ribbon控件——SARibbon
二、源码编译
1、修改SARibbonBar
文件夹下的CMakelists.txt
文件,修改后的CMakelists.txt
文件如下所示:
set(LIB_NAME SARibbonBar)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
qt5_add_resources(QRCS resource.qrc)
SET(HEADER_FILES
SAFramelessHelper.h
SARibbonStyleOption.h
SARibbonActionsManager.h
SARibbonBar.h
SARibbonCustomizeData.h
SARibbonCustomizeDialog.h
SARibbonCustomizeWidget.h
SARibbonMainWindow.h
SAWindowButtonGroup.h
SARibbonApplicationButton.h
SARibbonTabBar.h
SARibbonCategory.h
SARibbonContextCategory.h
SARibbonPannel.h
SARibbonToolButton.h
SARibbonMenu.h
SARibbonGlobal.h
SARibbonPannelOptionButton.h
SARibbonSeparatorWidget.h
SARibbonCategoryLayout.h
SARibbonGallery.h
SARibbonControlButton.h
SARibbonGalleryGroup.h
SARibbonGalleryItem.h
SARibbonComboBox.h
SARibbonElementCreateDelegate.h
SARibbonElementManager.h
SARibbonDrawHelper.h
SARibbonLineEdit.h
SARibbonCheckBox.h
SARibbonButtonGroupWidget.h
SARibbonStackedWidget.h
SARibbonQuickAccessBar.h
SARibbonCtrlContainer.h
SARibbonPannelLayout.h
SARibbonPannelItem.h
SARibbonLineWidgetContainer.h
)
qt5_wrap_cpp(MOC_HEADER_FILES ${HEADER_FILES})
SET(SOURCE_FILES
SAFramelessHelper.cpp
SARibbonStyleOption.cpp
SARibbonActionsManager.cpp
SARibbonBar.cpp
SARibbonCustomizeData.cpp
SARibbonCustomizeDialog.cpp
SARibbonCustomizeWidget.cpp
SARibbonMainWindow.cpp
SAWindowButtonGroup.cpp
SARibbonApplicationButton.cpp
SARibbonTabBar.cpp
SARibbonCategory.cpp
SARibbonContextCategory.cpp
SARibbonPannel.cpp
SARibbonToolButton.cpp
SARibbonMenu.cpp
SARibbonPannelOptionButton.cpp
SARibbonSeparatorWidget.cpp
SARibbonCategoryLayout.cpp
SARibbonGallery.cpp
SARibbonControlButton.cpp
SARibbonGalleryGroup.cpp
SARibbonGalleryItem.cpp
SARibbonComboBox.cpp
SARibbonElementCreateDelegate.cpp
SARibbonElementManager.cpp
SARibbonDrawHelper.cpp
SARibbonLineEdit.cpp
SARibbonCheckBox.cpp
SARibbonButtonGroupWidget.cpp
SARibbonStackedWidget.cpp
SARibbonQuickAccessBar.cpp
SARibbonCtrlContainer.cpp
SARibbonPannelLayout.cpp
SARibbonPannelItem.cpp
SARibbonLineWidgetContainer.cpp
)
add_definitions(-DSA_RIBBON_BAR_MAKE_LIB)
add_library(${LIB_NAME} SHARED
${QRCS}
${MOC_HEADER_FILES}
${HEADER_FILES}
${SOURCE_FILES}
)
target_link_libraries(${LIB_NAME} Qt5::Widgets)
set_target_properties(${LIB_NAME} PROPERTIES
AUTOMOC TRUE
AUTOUIC TRUE
AUTORCC TRUE
DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION}
)
target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
install(TARGETS ${LIB_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION bin
ARCHIVE DESTINATION lib
)
install(FILES ${HEADER_FILES} DESTINATION include)
if(WIN32)
create_win32_resource_version(
TARGET ${LIB_NAME}
FILENAME ${LIB_NAME}
EXT "dll"
DESCRIPTION "Ribbon control library for Qt"
)
endif()
2、使用Cmake编译即可。
三、封装成库
1、编译成功后点击生成,在中出现如下图所示的Debug
和Release
文件夹
2、新建lib
文件夹将Debug
文件夹中的SARibbonBard.lib
和Release
文件夹中的SARibbonBar.lib
复制粘贴进lib
文件夹。
3、新建bin
文件夹将Debug
文件夹中的SARibbonBard.dll
和SARibbonBard.pdb
以及Release
文件夹中的SARibbonBar.dll
复制粘贴进bin
文件夹。
4、新建include
文件夹将src——SARibbonBar
中的内容复制粘贴进include
文件夹,即可完成库的封装。
四、Qt配库
1、新建QtWidgetsApplication
应用程序
2、在属性页添加相应的包含目录和库目录。
3、在链接器中输入附加依赖项