Skip to content

Commit

Permalink
导出SARibbon.h/cpp的合并工程
Browse files Browse the repository at this point in the history
  • Loading branch information
czyt1988 committed Jan 21, 2024
1 parent b7fcfc7 commit 16c464c
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 40 deletions.
10 changes: 2 additions & 8 deletions src/SARibbon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,7 @@ SARibbonApplicationButton::SARibbonApplicationButton(const QIcon& icon, const QS
// 为了避免使用此框架的app设置了全局的qpushbutton 的 qss样式影响此按钮,定义了一个类

/**
* @brief The SAWindowButtonGroupPrivate class
* @brief The SARibbonSystemButtonBar class
*/
class SARibbonSystemButtonBar::PrivateData
{
Expand All @@ -2210,7 +2210,7 @@ class SARibbonSystemButtonBar::PrivateData
PrivateData(SARibbonSystemButtonBar* p) : q_ptr(p)
{
mButtonGroup = new SARibbonButtonGroupWidget(p);
mButtonGroup->setObjectName("SAWindowButtonGroupToolBar");
mButtonGroup->setObjectName("SASystemButtonGroup");
}

void setupMinimizeButton(bool on)
Expand Down Expand Up @@ -12019,11 +12019,6 @@ bool SARibbonBar::eventFilter(QObject* obj, QEvent* e)
}
}
}
// if (SAWindowButtonGroup *g = qobject_cast<SAWindowButtonGroup *>(obj)) {
// if (e->type() == QEvent::Resize) {
// m_d->windowButtonSize = g->size();
// }
// }
}
return (QMenuBar::eventFilter(obj, e));
}
Expand Down Expand Up @@ -15195,7 +15190,6 @@ SARibbonCustomizeWidget* SARibbonCustomizeDialog::customizeWidget() const

#else

#include "SAWindowButtonGroup.h"
#endif

/**
Expand Down
4 changes: 2 additions & 2 deletions src/SARibbon.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,11 +598,11 @@ class SA_RIBBON_EXPORT SARibbonApplicationButton : public QToolButton

/**
* \brief 窗口的最大最小化按钮
* @note 内部有个SARibbonButtonGroupWidget,其ObjectName = SAWindowButtonGroupToolBar
* @note 内部有个SARibbonButtonGroupWidget,其ObjectName = SASystemButtonGroup
* 如果需要qss,可以进行特化处理:
*
* @code
* SARibbonButtonGroupWidget#SAWindowButtonGroupToolBar
* SARibbonButtonGroupWidget#SASystemButtonGroup
* @endcode
*
*/
Expand Down
33 changes: 15 additions & 18 deletions src/SARibbon.pri
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,27 @@
#-------------------------------------------------


# 这里判断qt的版本看看是否适合使用frameless,如果适合使用SA_RIBBON_CONFIG将加入use_frameless
equals(QT_MAJOR_VERSION, 5){
greaterThan(QT_MINOR_VERSION, 13){
SA_RIBBON_CONFIG += use_frameless
}
}else{
# qt6.0不支持
greaterThan(QT_MINOR_VERSION, 0){
SA_RIBBON_CONFIG += use_frameless
}
}
######################################
# Config | 配置
######################################
#SA_RIBBON_CONFIG 用于定义一些编译选项:
# SA_RIBBON_CONFIG+=use_frameless
# 此选项将使用frameless第三方库,这个选项在SARibbonBar.pri中会自动判断,如果,达到frameless的使用要求将会自动定义
# frameless第三方库必须C++17且只有几个版本的qt可用,目前支持(qt5.14,qt5.15,qt6.4以上)
# 除了上诉版本SA_RIBBON_CONFIG中不会加入use_frameless
# frameless库能实现Ubuntu下和mac下的显示,同时多屏幕的支持也较好
# 使用frameless库,需要定义QWindowKit的安装目录,默认在SARIBBON_BIN_DIR
# SA_RIBBON_QWindowKit_Install_DIR = $$SARIBBON_BIN_DIR
######################################
# 集成模式默认不使用frameless,如果使用,需要自己引入qwk依赖
SA_RIBBON_CONFIG -= use_frameless


# 这里判断SA_RIBBON_CONFIG是否包含use_frameless,如果包含将引入frameless库,并定义SARIBBON_USE_3RDPARTY_FRAMELESSHELPER为1
contains( SA_RIBBON_CONFIG, use_frameless ) {
!contains(CONFIG,C++17){
CONFIG += c++17
}
# 引入第三方库framelesshelper
# 1.framelesshelper/qmake/inc/core/framelesshelper.config中的FRAMELESSHELPER_FEATURE_static_build设置为-1
include($$PWD/SARibbonBar/3rdparty/framelesshelper/qmake/core.pri)
include($$PWD/SARibbonBar/3rdparty/framelesshelper/qmake/widgets.pri)
DEFINES += FRAMELESSHELPER_CORE_LIBRARY
DEFINES += FRAMELESSHELPER_WIDGETS_LIBRARY
DEFINES += FRAMELESSHELPER_FEATURE_static_build=1
# 定义SARIBBON_USE_3RDPARTY_FRAMELESSHELPER为1
DEFINES += SARIBBON_USE_3RDPARTY_FRAMELESSHELPER=1
}else{
Expand Down
5 changes: 0 additions & 5 deletions src/SARibbonBar/SARibbonBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1908,11 +1908,6 @@ bool SARibbonBar::eventFilter(QObject* obj, QEvent* e)
}
}
}
// if (SAWindowButtonGroup *g = qobject_cast<SAWindowButtonGroup *>(obj)) {
// if (e->type() == QEvent::Resize) {
// m_d->windowButtonSize = g->size();
// }
// }
}
return (QMenuBar::eventFilter(obj, e));
}
Expand Down
4 changes: 2 additions & 2 deletions src/SARibbonBar/SARibbonBar.pri
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SOURCES += \
$$PWD/SARibbonCustomizeWidget.cpp \
$$PWD/SARibbonElementFactory.cpp \
$$PWD/SARibbonMainWindow.cpp \
$$PWD/SAWindowButtonGroup.cpp \
$$PWD/SARibbonSystemButtonBar.cpp \
$$PWD/SARibbonApplicationButton.cpp \
$$PWD/SARibbonTabBar.cpp \
$$PWD/SARibbonCategory.cpp \
Expand Down Expand Up @@ -80,7 +80,7 @@ HEADERS += \
$$PWD/SARibbonCustomizeWidget.h \
$$PWD/SARibbonElementFactory.h \
$$PWD/SARibbonMainWindow.h \
$$PWD/SAWindowButtonGroup.h \
$$PWD/SARibbonSystemButtonBar.h \
$$PWD/SARibbonApplicationButton.h \
$$PWD/SARibbonTabBar.h \
$$PWD/SARibbonCategory.h \
Expand Down
1 change: 0 additions & 1 deletion src/SARibbonBar/SARibbonMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "SARibbonStackedWidget.h"
#else
#include "SAFramelessHelper.h"
#include "SAWindowButtonGroup.h"
#endif

/**
Expand Down
4 changes: 2 additions & 2 deletions src/SARibbonBar/SARibbonSystemButtonBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// 为了避免使用此框架的app设置了全局的qpushbutton 的 qss样式影响此按钮,定义了一个类

/**
* @brief The SAWindowButtonGroupPrivate class
* @brief The SARibbonSystemButtonBar class
*/
class SARibbonSystemButtonBar::PrivateData
{
Expand All @@ -33,7 +33,7 @@ class SARibbonSystemButtonBar::PrivateData
PrivateData(SARibbonSystemButtonBar* p) : q_ptr(p)
{
mButtonGroup = new SARibbonButtonGroupWidget(p);
mButtonGroup->setObjectName("SAWindowButtonGroupToolBar");
mButtonGroup->setObjectName("SASystemButtonGroup");
}

void setupMinimizeButton(bool on)
Expand Down
4 changes: 2 additions & 2 deletions src/SARibbonBar/SARibbonSystemButtonBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

/**
* \brief 窗口的最大最小化按钮
* @note 内部有个SARibbonButtonGroupWidget,其ObjectName = SAWindowButtonGroupToolBar
* @note 内部有个SARibbonButtonGroupWidget,其ObjectName = SASystemButtonGroup
* 如果需要qss,可以进行特化处理:
*
* @code
* SARibbonButtonGroupWidget#SAWindowButtonGroupToolBar
* SARibbonButtonGroupWidget#SASystemButtonGroup
* @endcode
*
*/
Expand Down

0 comments on commit 16c464c

Please sign in to comment.