Skip to content

Commit

Permalink
修复重复刷新的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
czyt1988 committed Nov 20, 2023
1 parent 2e51696 commit ff68619
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/SARibbonBar/SARibbonBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class SARibbonBar::PrivateData
, mTitleAligment(Qt::AlignCenter)
, mIsTitleVisible(true)
, mEnableUserDefineAccessBarIconSize(false)
, mEnableUserDefineRightBarIconSize(false)
, mRibbonAlignment(SARibbonAlignment::AlignLeft)
{
mContextCategoryColorList = SARibbonBar::getDefaultContextCategoryColorList();
Expand Down Expand Up @@ -1861,7 +1862,7 @@ void SARibbonBar::changeEvent(QEvent* e)

void SARibbonBar::resizeInOfficeStyle()
{
synchronousCategoryLayoutMode();
synchronousCategoryLayoutMode(false);
QMargins border = contentsMargins();
int x = border.left();
int y = border.top();
Expand Down Expand Up @@ -1969,7 +1970,7 @@ void SARibbonBar::resizeInOfficeStyle()

void SARibbonBar::resizeInWpsLiteStyle()
{
synchronousCategoryLayoutMode();
synchronousCategoryLayoutMode(false);
QMargins border = contentsMargins();
int x = border.left();
int y = border.top();
Expand Down
9 changes: 9 additions & 0 deletions src/example/MainWindowExample/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,15 @@ void MainWindow::createOtherActions()
mOtherActionIcon1 = new QAction(QIcon(":/icon/icon/layout.svg"), ("action with icon"), this);
}

#include <QMessageBox>
void MainWindow::closeEvent(QCloseEvent* e)
{
auto res = QMessageBox::question(this, tr("question"), tr("Confirm whether to exit"));
if (res == QMessageBox::Yes) {
SARibbonMainWindow::closeEvent(e);
}
}

void MainWindow::createCategoryMain(SARibbonCategory* page)
{
//! 1
Expand Down
4 changes: 4 additions & 0 deletions src/example/MainWindowExample/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class SARibbonButtonGroupWidget;
class SARibbonPannel;
class QTextEdit;
class QComboBox;
class QCloseEvent;

class MainWindow : public SARibbonMainWindow
{
Expand Down Expand Up @@ -70,6 +71,9 @@ private slots:
// 创建其它actions,这些actions并不在SARibbonBar管理
void createOtherActions();

protected:
void closeEvent(QCloseEvent* e) override;

private:
SARibbonContextCategory* mContextCategory;
SARibbonContextCategory* mContextCategory2;
Expand Down

0 comments on commit ff68619

Please sign in to comment.