Skip to content

Commit

Permalink
把v2.0的涉及到无关api变化的修正合并到v1.x中,加强v1.x的健壮性
Browse files Browse the repository at this point in the history
  • Loading branch information
czyt1988 committed Jan 21, 2024
1 parent a1e400d commit 30d1f39
Show file tree
Hide file tree
Showing 32 changed files with 922 additions and 864 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ tmp-file
.$*
.vs

.qtc_clangd

# vscode 的隐藏文件
.vscode

Expand Down
70 changes: 4 additions & 66 deletions src/SARibbonBar/SARibbonBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,18 @@ class SARibbonBar::PrivateData
QList< SARibbonContextCategory* > mContextCategoryList; ///< 存放所有的上下文标签
QList< _SARibbonTabData > mHidedCategory;
int mIconRightBorderPosition { 1 }; ///< 标题栏x值得最小值,在有图标和快捷启动按钮,此值都需要变化
QAction* mMinimumCategoryButtonAction { nullptr }; ///< 隐藏面板按钮action
SARibbonButtonGroupWidget* mRightButtonGroup { nullptr }; ///< 在tab bar右边的按钮群
SARibbonQuickAccessBar* mQuickAccessBar { nullptr }; ///< 快速响应栏
QAction* mMinimumCategoryButtonAction { nullptr }; ///< 隐藏面板按钮action
SARibbonButtonGroupWidget* mRightButtonGroup { nullptr }; ///< 在tab bar右边的按钮群
SARibbonQuickAccessBar* mQuickAccessBar { nullptr }; ///< 快速响应栏
SARibbonBar::RibbonStyles mRibbonStyle { SARibbonBar::RibbonStyleLooseThreeRow }; ///< ribbon的风格
SARibbonBar::RibbonMode mCurrentRibbonMode { SARibbonBar::NormalRibbonMode }; ///< 记录当前模式
SARibbonBar::RibbonMode mCurrentRibbonMode { SARibbonBar::NormalRibbonMode }; ///< 记录当前模式
QSize mWindowButtonSize; ///< 由SARibbonMainWindow告诉的windowbutton的尺寸
QList< QColor > mContextCategoryColorList; ///< contextCategory的色系
int mContextCategoryColorListIndex { -1 }; ///< 记录contextCategory色系索引
QColor mTitleTextColor; ///< 标题文字颜色,默认无效,无效的情况下和SARibbonBar的qss:color属性一致
QColor mTabBarBaseLineColor { QColor(186, 201, 219) }; ///< tabbar 底部会绘制一条线条,定义线条颜色
Qt::Alignment mTitleAligment { Qt::AlignCenter }; ///< 标题对齐方式
bool mIsTitleVisible { true }; ///< 标题是否显示
bool mEnableUserDefineAccessBarIconSize { false }; ///< 允许用户自定义AccessBar的IconSize
bool mEnableUserDefineRightBarIconSize { false }; ///< 允许用户自定义RightBar的IconSize
SARibbonAlignment mRibbonAlignment { SARibbonAlignment::AlignLeft }; ///< 对齐方式
int mTitleBarHeight { 30 }; ///< 标题栏高度
int mTabBarHeight { -1 }; ///< tabbar高度,默认为-1,-1的时候就是无效高度,这时高度由字体决定,用户调用setTabBarHeight后,设置的高度为正,则使用用户设定的高度,而不使用自动计算的高度
Expand Down Expand Up @@ -1648,66 +1646,6 @@ bool SARibbonBar::isTitleVisible() const
return d_ptr->mIsTitleVisible;
}

/**
@brief 设置允许用户自定义AccessBar的icon size
若设置为true此时用户调用AccessBar的setIconSize是可接受的,否则iconsize大小将由SARibbonBar计算
默认为false
@param
*/
void SARibbonBar::setEnableUserDefineAccessBarIconSize(bool on)
{
d_ptr->mEnableUserDefineAccessBarIconSize = on;
if (!(d_ptr->mEnableUserDefineAccessBarIconSize)) { // 允许用户自定义AccessBar的IconSize就不进入此条件重置大小
// 变更iconsize
QSize btnIconSize = PrivateData::calcIconSizeByHeight(titleBarHeight());
if (btnIconSize.height() != d_ptr->mQuickAccessBar->itemHeight()) {
d_ptr->mQuickAccessBar->setItemHeight(btnIconSize.height());
}
}
}

/**
@brief 是否允许用户自定义AccessBar的icon size
@return
*/
bool SARibbonBar::isEnableUserDefineAccessBarIconSize() const
{
return d_ptr->mEnableUserDefineAccessBarIconSize;
}

/**
@brief 是否允许用户自定义RightBar的icon size
若设置为true此时用户调用RightBar的setIconSize是可接受的,否则iconsize大小将由SARibbonBar计算
默认为false
@param on
*/
void SARibbonBar::setEnableUserDefineRightBarIconSize(bool on)
{
d_ptr->mEnableUserDefineRightBarIconSize = on;
// 变更iconsize
if (!(d_ptr->mEnableUserDefineRightBarIconSize)) {
QSize btnIconSize = PrivateData::calcIconSizeByHeight(titleBarHeight());
if (btnIconSize.height() != d_ptr->mRightButtonGroup->itemHeight()) {
d_ptr->mRightButtonGroup->setItemHeight(btnIconSize.height());
}
}
}

/**
@brief 是否允许用户自定义RightBar的icon size
@return
*/
bool SARibbonBar::isEnableUserDefineRightBarIconSize() const
{
return d_ptr->mEnableUserDefineRightBarIconSize;
}

/**
@brief 设置上下文标签的颜色列表
Expand Down
8 changes: 0 additions & 8 deletions src/SARibbonBar/SARibbonBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,6 @@ class SA_RIBBON_EXPORT SARibbonBar : public QMenuBar
void setTitleVisible(bool on = false);
bool isTitleVisible() const;

// 允许用户自定义AccessBar图标尺寸,默认为false
void setEnableUserDefineAccessBarIconSize(bool on = true);
bool isEnableUserDefineAccessBarIconSize() const;

// 允许用户自定义RightBar图标尺寸,默认为false
void setEnableUserDefineRightBarIconSize(bool on = true);
bool isEnableUserDefineRightBarIconSize() const;

// 上下文标签的颜色列表,上下文标签显示的时候,会从颜色列表中取颜色进行标签的渲染
void setContextCategoryColorList(const QList< QColor >& cls);
QList< QColor > getContextCategoryColorList() const;
Expand Down
Loading

0 comments on commit 30d1f39

Please sign in to comment.