-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
34,995 additions
and
34,995 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,121 @@ | ||
#ifndef MAINWINDOW_H | ||
#define MAINWINDOW_H | ||
#include "SARibbonMainWindow.h" | ||
class SARibbonCategory; | ||
class SARibbonContextCategory; | ||
class SARibbonCustomizeWidget; | ||
class SARibbonActionsManager; | ||
class SARibbonQuickAccessBar; | ||
class SARibbonButtonGroupWidget; | ||
class SARibbonPannel; | ||
class QTextEdit; | ||
class QComboBox; | ||
class QCloseEvent; | ||
class QLineEdit; | ||
|
||
class MainWindow : public SARibbonMainWindow | ||
{ | ||
Q_OBJECT | ||
public: | ||
MainWindow(QWidget* par = nullptr); | ||
|
||
private: | ||
// 创建ribbon-application菜单示例 | ||
void createRibbonApplicationButton(); | ||
// 创建main菜单示例 | ||
void createCategoryMain(SARibbonCategory* page); | ||
void createCategoryOther(SARibbonCategory* page); | ||
void createCategoryDelete(SARibbonCategory* page); | ||
void createCategorySize(SARibbonCategory* page); | ||
void createCategoryColor(SARibbonCategory* page); | ||
void createContextCategory1(); | ||
void createContextCategory2(); | ||
void createContextCategoryPage1(SARibbonCategory* page); | ||
void createContextCategoryPage2(SARibbonCategory* page); | ||
void createQuickAccessBar(); | ||
void createRightButtonGroup(); | ||
void createWindowButtonGroupBar(); | ||
// 创建ActionsManager,实现actions的管理以及SARibbonBar的自定义 | ||
void createActionsManager(); | ||
QAction* createAction(const QString& text, const QString& iconurl, const QString& objName); | ||
QAction* createAction(const QString& text, const QString& iconurl); | ||
private Q_SLOTS: | ||
void onMenuButtonPopupCheckableTest(bool b); | ||
void onInstantPopupCheckableTest(bool b); | ||
void onDelayedPopupCheckableTest(bool b); | ||
void onMenuButtonPopupCheckabletriggered(bool b); | ||
void onInstantPopupCheckabletriggered(bool b); | ||
void onDelayedPopupCheckabletriggered(bool b); | ||
void onShowContextCategory(bool on); | ||
void onStyleClicked(int id); | ||
void onActionCustomizeTriggered(); | ||
void onActionCustomizeAndSaveTriggered(); | ||
void onActionCustomizeAndSaveWithApplyTriggered(); | ||
void onActionHelpTriggered(); | ||
void onActionRemoveAppBtnTriggered(bool b); | ||
void onActionUseQssTriggered(); | ||
void onActionLoadCustomizeXmlFileTriggered(); | ||
void onActionWindowFlagNormalButtonTriggered(bool b); | ||
void onFontComWidgetCurrentFontChanged(const QFont& f); | ||
void onActionFontLargerTriggered(); | ||
void onActionFontSmallerTriggered(); | ||
void onActionWordWrapTriggered(bool b); | ||
void onButtonGroupActionTriggered(QAction* act); | ||
void onColorButtonColorClicked(const QColor& c, bool on); | ||
void onRibbonThemeComboBoxCurrentIndexChanged(int index); | ||
void onActionHideActionTriggered(bool on); | ||
// 切换所有action是否可见 | ||
void onActionVisibleAllTriggered(bool on); | ||
// 居中对齐checkbox的槽 | ||
void onCheckBoxAlignmentCenterClicked(bool checked); | ||
// | ||
void onSpinBoxRibbonTitleHeightChanged(int h); | ||
void onSpinBoxRibbonTabHeightChanged(int h); | ||
void onSpinBoxRibbonCategoryHeightChanged(int h); | ||
void onSpinBoxRibbonPannelTtitleHeightChanged(int h); | ||
void onSpinBoxRibbonPannelSpacingChanged(int h); | ||
void onSpinBoxRibbonPannelToolBtnIconSizeChanged(int h); | ||
|
||
private: | ||
// 创建其它actions,这些actions并不在SARibbonBar管理 | ||
void createOtherActions(); | ||
|
||
protected: | ||
void closeEvent(QCloseEvent* e) override; | ||
|
||
private: | ||
SARibbonContextCategory* mContextCategory; | ||
SARibbonContextCategory* mContextCategory2; | ||
SARibbonCustomizeWidget* mWidgetForCustomize; | ||
QTextEdit* mTextedit; | ||
SARibbonActionsManager* mActionsManager; | ||
int mTagForActionText; | ||
int mTagForActionIcon; | ||
QMenu* mMenuApplicationBtn; | ||
QComboBox* mComboboxRibbonTheme; | ||
QLineEdit* mSearchEditor { nullptr }; | ||
// | ||
QAction* mActionWordWrap { nullptr }; | ||
QAction* mActionDisable { nullptr }; | ||
QAction* mActionUnlock { nullptr }; | ||
QAction* mActionSetTextTest { nullptr }; | ||
QAction* mActionShowTest { nullptr }; | ||
QAction* mActionHideAction2 { nullptr }; | ||
QAction* mActionHideAction4 { nullptr }; | ||
QAction* mActionHideShowTextAct2 { nullptr }; | ||
QAction* mActionHideShowTextAct3 { nullptr }; | ||
QAction* mActionHideShowTextAct4 { nullptr }; | ||
// | ||
QAction* mOtherAction1 { nullptr }; | ||
QAction* mOtherAction2 { nullptr }; | ||
QAction* mOtherAction3 { nullptr }; | ||
QAction* mOtherAction4 { nullptr }; | ||
QAction* mOtherAction5 { nullptr }; | ||
QAction* mOtherActionIcon1 { nullptr }; | ||
SARibbonPannel* mPannelVisbileExample { nullptr }; | ||
// | ||
QAction* mActionVisibleAll { nullptr }; ///< 控制所有action是否可见的开关 | ||
bool mHasApplyCustomizeXmlFile { false }; /// 程序启动后是否应用上次修改 | ||
}; | ||
|
||
#endif // MAINWINDOW_H | ||
#ifndef MAINWINDOW_H | ||
#define MAINWINDOW_H | ||
#include "SARibbonMainWindow.h" | ||
class SARibbonCategory; | ||
class SARibbonContextCategory; | ||
class SARibbonCustomizeWidget; | ||
class SARibbonActionsManager; | ||
class SARibbonQuickAccessBar; | ||
class SARibbonButtonGroupWidget; | ||
class SARibbonPannel; | ||
class QTextEdit; | ||
class QComboBox; | ||
class QCloseEvent; | ||
class QLineEdit; | ||
|
||
class MainWindow : public SARibbonMainWindow | ||
{ | ||
Q_OBJECT | ||
public: | ||
MainWindow(QWidget* par = nullptr); | ||
|
||
private: | ||
// 创建ribbon-application菜单示例 | ||
void createRibbonApplicationButton(); | ||
// 创建main菜单示例 | ||
void createCategoryMain(SARibbonCategory* page); | ||
void createCategoryOther(SARibbonCategory* page); | ||
void createCategoryDelete(SARibbonCategory* page); | ||
void createCategorySize(SARibbonCategory* page); | ||
void createCategoryColor(SARibbonCategory* page); | ||
void createContextCategory1(); | ||
void createContextCategory2(); | ||
void createContextCategoryPage1(SARibbonCategory* page); | ||
void createContextCategoryPage2(SARibbonCategory* page); | ||
void createQuickAccessBar(); | ||
void createRightButtonGroup(); | ||
void createWindowButtonGroupBar(); | ||
// 创建ActionsManager,实现actions的管理以及SARibbonBar的自定义 | ||
void createActionsManager(); | ||
QAction* createAction(const QString& text, const QString& iconurl, const QString& objName); | ||
QAction* createAction(const QString& text, const QString& iconurl); | ||
private Q_SLOTS: | ||
void onMenuButtonPopupCheckableTest(bool b); | ||
void onInstantPopupCheckableTest(bool b); | ||
void onDelayedPopupCheckableTest(bool b); | ||
void onMenuButtonPopupCheckabletriggered(bool b); | ||
void onInstantPopupCheckabletriggered(bool b); | ||
void onDelayedPopupCheckabletriggered(bool b); | ||
void onShowContextCategory(bool on); | ||
void onStyleClicked(int id); | ||
void onActionCustomizeTriggered(); | ||
void onActionCustomizeAndSaveTriggered(); | ||
void onActionCustomizeAndSaveWithApplyTriggered(); | ||
void onActionHelpTriggered(); | ||
void onActionRemoveAppBtnTriggered(bool b); | ||
void onActionUseQssTriggered(); | ||
void onActionLoadCustomizeXmlFileTriggered(); | ||
void onActionWindowFlagNormalButtonTriggered(bool b); | ||
void onFontComWidgetCurrentFontChanged(const QFont& f); | ||
void onActionFontLargerTriggered(); | ||
void onActionFontSmallerTriggered(); | ||
void onActionWordWrapTriggered(bool b); | ||
void onButtonGroupActionTriggered(QAction* act); | ||
void onColorButtonColorClicked(const QColor& c, bool on); | ||
void onRibbonThemeComboBoxCurrentIndexChanged(int index); | ||
void onActionHideActionTriggered(bool on); | ||
// 切换所有action是否可见 | ||
void onActionVisibleAllTriggered(bool on); | ||
// 居中对齐checkbox的槽 | ||
void onCheckBoxAlignmentCenterClicked(bool checked); | ||
// | ||
void onSpinBoxRibbonTitleHeightChanged(int h); | ||
void onSpinBoxRibbonTabHeightChanged(int h); | ||
void onSpinBoxRibbonCategoryHeightChanged(int h); | ||
void onSpinBoxRibbonPannelTtitleHeightChanged(int h); | ||
void onSpinBoxRibbonPannelSpacingChanged(int h); | ||
void onSpinBoxRibbonPannelToolBtnIconSizeChanged(int h); | ||
|
||
private: | ||
// 创建其它actions,这些actions并不在SARibbonBar管理 | ||
void createOtherActions(); | ||
|
||
protected: | ||
void closeEvent(QCloseEvent* e) override; | ||
|
||
private: | ||
SARibbonContextCategory* mContextCategory; | ||
SARibbonContextCategory* mContextCategory2; | ||
SARibbonCustomizeWidget* mWidgetForCustomize; | ||
QTextEdit* mTextedit; | ||
SARibbonActionsManager* mActionsManager; | ||
int mTagForActionText; | ||
int mTagForActionIcon; | ||
QMenu* mMenuApplicationBtn; | ||
QComboBox* mComboboxRibbonTheme; | ||
QLineEdit* mSearchEditor { nullptr }; | ||
// | ||
QAction* mActionWordWrap { nullptr }; | ||
QAction* mActionDisable { nullptr }; | ||
QAction* mActionUnlock { nullptr }; | ||
QAction* mActionSetTextTest { nullptr }; | ||
QAction* mActionShowTest { nullptr }; | ||
QAction* mActionHideAction2 { nullptr }; | ||
QAction* mActionHideAction4 { nullptr }; | ||
QAction* mActionHideShowTextAct2 { nullptr }; | ||
QAction* mActionHideShowTextAct3 { nullptr }; | ||
QAction* mActionHideShowTextAct4 { nullptr }; | ||
// | ||
QAction* mOtherAction1 { nullptr }; | ||
QAction* mOtherAction2 { nullptr }; | ||
QAction* mOtherAction3 { nullptr }; | ||
QAction* mOtherAction4 { nullptr }; | ||
QAction* mOtherAction5 { nullptr }; | ||
QAction* mOtherActionIcon1 { nullptr }; | ||
SARibbonPannel* mPannelVisbileExample { nullptr }; | ||
// | ||
QAction* mActionVisibleAll { nullptr }; ///< 控制所有action是否可见的开关 | ||
bool mHasApplyCustomizeXmlFile { false }; /// 程序启动后是否应用上次修改 | ||
}; | ||
|
||
#endif // MAINWINDOW_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,64 @@ | ||
#include "mdimainwindow.h" | ||
#include <QApplication> | ||
#include <QDebug> | ||
#include <QElapsedTimer> | ||
#include "SARibbonBar.h" | ||
// 重定向qdebug的打印 | ||
void log_out_put(QtMsgType type, const QMessageLogContext& context, const QString& msg); | ||
|
||
/** | ||
* @brief 重定向qdebug的打印 | ||
* @param type | ||
* @param context | ||
* @param msg | ||
*/ | ||
void log_out_put(QtMsgType type, const QMessageLogContext& context, const QString& msg) | ||
{ | ||
QByteArray localMsg = msg.toLocal8Bit(); | ||
|
||
switch (type) { | ||
case QtDebugMsg: | ||
fprintf(stdout, "%s |[Debug] (%s[%u],%s)\n", localMsg.constData(), context.function, context.line, context.file); | ||
break; | ||
|
||
case QtWarningMsg: | ||
fprintf(stdout, "%s |[Warning] (%s[%u],%s)\n", localMsg.constData(), context.function, context.line, context.file); | ||
break; | ||
|
||
case QtCriticalMsg: | ||
fprintf(stdout, "%s |[Critical] (%s[%u],%s)\n", localMsg.constData(), context.function, context.line, context.file); | ||
break; | ||
|
||
case QtFatalMsg: | ||
fprintf(stdout, "%s |[Fatal] (%s[%u],%s)\n", localMsg.constData(), context.function, context.line, context.file); | ||
abort(); | ||
break; | ||
|
||
default: | ||
fprintf(stdout, "%s |[Debug](%s[%u],%s)\n", localMsg.constData(), context.function, context.line, context.file); | ||
break; | ||
} | ||
#ifndef QT_NO_DEBUG_OUTPUT | ||
fflush(stdout); | ||
#endif | ||
} | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
// 以下是针对高分屏的设置,有高分屏需求都需要按照下面进行设置 | ||
SARibbonBar::initHighDpi(); | ||
|
||
QApplication a(argc, argv); | ||
qInstallMessageHandler(log_out_put); | ||
QFont f = a.font(); | ||
f.setFamily(u8"微软雅黑"); | ||
a.setFont(f); | ||
QElapsedTimer cost; | ||
|
||
cost.start(); | ||
MainWindow w; | ||
qDebug() << "window build cost:" << cost.elapsed() << " ms"; | ||
w.show(); | ||
|
||
return (a.exec()); | ||
} | ||
#include "mdimainwindow.h" | ||
#include <QApplication> | ||
#include <QDebug> | ||
#include <QElapsedTimer> | ||
#include "SARibbonBar.h" | ||
// 重定向qdebug的打印 | ||
void log_out_put(QtMsgType type, const QMessageLogContext& context, const QString& msg); | ||
|
||
/** | ||
* @brief 重定向qdebug的打印 | ||
* @param type | ||
* @param context | ||
* @param msg | ||
*/ | ||
void log_out_put(QtMsgType type, const QMessageLogContext& context, const QString& msg) | ||
{ | ||
QByteArray localMsg = msg.toLocal8Bit(); | ||
|
||
switch (type) { | ||
case QtDebugMsg: | ||
fprintf(stdout, "%s |[Debug] (%s[%u],%s)\n", localMsg.constData(), context.function, context.line, context.file); | ||
break; | ||
|
||
case QtWarningMsg: | ||
fprintf(stdout, "%s |[Warning] (%s[%u],%s)\n", localMsg.constData(), context.function, context.line, context.file); | ||
break; | ||
|
||
case QtCriticalMsg: | ||
fprintf(stdout, "%s |[Critical] (%s[%u],%s)\n", localMsg.constData(), context.function, context.line, context.file); | ||
break; | ||
|
||
case QtFatalMsg: | ||
fprintf(stdout, "%s |[Fatal] (%s[%u],%s)\n", localMsg.constData(), context.function, context.line, context.file); | ||
abort(); | ||
break; | ||
|
||
default: | ||
fprintf(stdout, "%s |[Debug](%s[%u],%s)\n", localMsg.constData(), context.function, context.line, context.file); | ||
break; | ||
} | ||
#ifndef QT_NO_DEBUG_OUTPUT | ||
fflush(stdout); | ||
#endif | ||
} | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
// 以下是针对高分屏的设置,有高分屏需求都需要按照下面进行设置 | ||
SARibbonBar::initHighDpi(); | ||
|
||
QApplication a(argc, argv); | ||
qInstallMessageHandler(log_out_put); | ||
QFont f = a.font(); | ||
f.setFamily(u8"微软雅黑"); | ||
a.setFont(f); | ||
QElapsedTimer cost; | ||
|
||
cost.start(); | ||
MainWindow w; | ||
qDebug() << "window build cost:" << cost.elapsed() << " ms"; | ||
w.show(); | ||
|
||
return (a.exec()); | ||
} |
Oops, something went wrong.