-
Notifications
You must be signed in to change notification settings - Fork 316
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
13 changed files
with
233 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
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
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
Submodule qwindowkit
updated
51 files
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
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
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
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
SET(VERSION_SHORT 0.1) | ||
project(MainWindowExample VERSION ${VERSION_SHORT}) | ||
set(SARIBBON_EXPAMPLE_NAME MainWindowExample) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
# qt库加载,最低要求5.8 | ||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) | ||
find_package(Qt${QT_VERSION_MAJOR} 5.8 COMPONENTS Core Gui Widgets REQUIRED) | ||
|
||
add_executable(${SARIBBON_EXPAMPLE_NAME} WIN32 | ||
mainwindow.h | ||
mainwindow.cpp | ||
main.cpp | ||
saribbonresouce.qrc | ||
) | ||
|
||
target_include_directories(${SARIBBON_EXPAMPLE_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../SARibbonBar") | ||
|
||
target_link_libraries(${SARIBBON_EXPAMPLE_NAME} PRIVATE SARibbonBar) | ||
target_link_libraries(${SARIBBON_EXPAMPLE_NAME} PUBLIC | ||
Qt${QT_VERSION_MAJOR}::Core | ||
Qt${QT_VERSION_MAJOR}::Gui | ||
Qt${QT_VERSION_MAJOR}::Widgets) | ||
|
||
set_target_properties(${SARIBBON_EXPAMPLE_NAME} PROPERTIES | ||
AUTOMOC ON | ||
AUTORCC ON | ||
AUTOUIC ON | ||
CXX_EXTENSIONS OFF | ||
DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX} | ||
VERSION ${SARIBBON_VERSION} | ||
EXPORT_NAME ${SARIBBON_EXPAMPLE_NAME} | ||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" | ||
) | ||
|
||
install(TARGETS ${SARIBBON_EXPAMPLE_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION bin ARCHIVE DESTINATION lib) | ||
|
||
# 会有一个FAILED: src/example/MainWindowExample/CMakeFiles/MainWindowExample.dir/MainWindowExample.rc.res | ||
# 暂时注释 | ||
# | ||
# if(WIN32) | ||
# add_custom_command(TARGET ${SARIBBON_EXPAMPLE_NAME} | ||
# POST_BUILD | ||
# COMMAND ${CMAKE_COMMAND} -E | ||
# copy_if_different | ||
# "$<TARGET_FILE:SARibbonBar>" | ||
# "$<TARGET_FILE_DIR:${SARIBBON_EXPAMPLE_NAME}>" | ||
# ) | ||
# create_win32_resource_version( | ||
# TARGET ${SARIBBON_EXPAMPLE_NAME} | ||
# FILENAME ${SARIBBON_EXPAMPLE_NAME} | ||
# EXT "exe" | ||
# DESCRIPTION "Example application for Qt Ribbon Control" | ||
# ) | ||
# visual_studio_qt_helper(${SARIBBON_EXPAMPLE_NAME}) | ||
# endif() |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "mainwindow.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()); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include "mainwindow.h" | ||
#if !SARIBBON_USE_3RDPARTY_FRAMELESSHELPER | ||
#include "SAFramelessHelper.h" | ||
#endif | ||
#include "SARibbonApplicationButton.h" | ||
#include "SARibbonBar.h" | ||
#include "SARibbonButtonGroupWidget.h" | ||
#include "SARibbonCategory.h" | ||
#include "SARibbonCheckBox.h" | ||
#include "SARibbonColorToolButton.h" | ||
#include "SARibbonComboBox.h" | ||
#include "SARibbonCustomizeDialog.h" | ||
#include "SARibbonCustomizeWidget.h" | ||
#include "SARibbonGallery.h" | ||
#include "SARibbonLineEdit.h" | ||
#include "SARibbonMenu.h" | ||
#include "SARibbonPannel.h" | ||
#include "SARibbonQuickAccessBar.h" | ||
#include "SARibbonToolButton.h" | ||
#include "colorWidgets/SAColorGridWidget.h" | ||
#include "colorWidgets/SAColorPaletteGridWidget.h" | ||
#include "SARibbonSystemButtonBar.h" | ||
#include <QAbstractButton> | ||
#include <QAction> | ||
#include <QApplication> | ||
#include <QButtonGroup> | ||
#include <QCalendarWidget> | ||
#include <QDebug> | ||
#include <QElapsedTimer> | ||
#include <QFile> | ||
#include <QFileDialog> | ||
#include <QFontComboBox> | ||
#include <QLabel> | ||
#include <QLineEdit> | ||
#include <QMenu> | ||
#include <QMessageBox> | ||
#include <QPushButton> | ||
#include <QRadioButton> | ||
#include <QSpinBox> | ||
#include <QStatusBar> | ||
#include <QTextEdit> | ||
#include <QTextStream> | ||
#include <QXmlStreamWriter> | ||
#include <QMessageBox> | ||
#include <QShortcut> | ||
#include <QLineEdit> | ||
#include <QDialogButtonBox> | ||
|
||
MainWindow::MainWindow(QWidget* par) | ||
: SARibbonMainWindow(par), mWidgetForCustomize(nullptr), mMenuApplicationBtn(nullptr) | ||
{ | ||
showMaximized(); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#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); | ||
}; | ||
|
||
#endif // MAINWINDOW_H |