Compare commits
No commits in common. "ac52c2710c4703af2853e9a173be2320c1db75e8" and "3515eb178d45a0a545d4d28e01a98b08d7ec302a" have entirely different histories.
ac52c2710c
...
3515eb178d
|
@ -1,3 +1,3 @@
|
|||
[submodule "lib_source/3rdparty/framelesshelper"]
|
||||
path = lib_source/3rdparty/framelesshelper
|
||||
[submodule "3rdparty/framelesshelper"]
|
||||
path = 3rdparty/framelesshelper
|
||||
url = git@github.com:mentalfl0w/framelesshelper.git
|
||||
|
|
|
@ -10,18 +10,27 @@ option(RIBBONUI_BUILD_EXAMPLES "Build RibbonUI APP." ON)
|
|||
option(RIBBONUI_BUILD_FRAMELESSHEPLER "Build FramelessHelper." ON)
|
||||
option(RIBBONUI_BUILD_STATIC_LIB "Build RibbonUI static library." OFF)
|
||||
|
||||
add_subdirectory(lib_source)
|
||||
|
||||
if (RIBBONUI_BUILD_EXAMPLES)
|
||||
add_subdirectory(example)
|
||||
endif()
|
||||
|
||||
if (RIBBONUI_BUILD_FRAMELESSHEPLER)
|
||||
set(FRAMELESSHELPER_BUILD_STATIC ON)
|
||||
set(FRAMELESSHELPER_NO_SUMMARY OFF)
|
||||
set(FRAMELESSHELPER_NO_DEBUG_OUTPUT ON)
|
||||
set(FRAMELESSHELPER_BUILD_WIDGETS OFF)
|
||||
add_subdirectory(3rdparty/framelesshelper)
|
||||
endif()
|
||||
|
||||
if(NOT RIBBONUI_QML_PLUGIN_DIRECTORY)
|
||||
set(RIBBONUI_QML_PLUGIN_DIRECTORY ${QT_SDK_DIR}/qml/RibbonUI CACHE PATH "RibbonUI Plugin Path")
|
||||
endif()
|
||||
|
||||
add_subdirectory(lib_source)
|
||||
|
||||
message("---------------------------- RibbonUI ----------------------------")
|
||||
message("Build RibbonUI APP: ${RIBBONUI_BUILD_EXAMPLES}")
|
||||
message("Build FramelessHelper: ${RIBBONUI_BUILD_FRAMELESSHEPLER}")
|
||||
message("Build RibbonUI static library: ${RIBBONUI_BUILD_STATIC_LIB}")
|
||||
message("RibbonUI QML Plugin Path: ${RIBBONUI_QML_PLUGIN_DIRECTORY}")
|
||||
message("------------------------------------------------------------------")
|
||||
|
|
|
@ -85,7 +85,7 @@ qt_add_qml_module(${PROJECT_NAME}
|
|||
URI ${PROJECT_NAME}
|
||||
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
RESOURCE_PREFIX "/qt/qml/"
|
||||
QML_FILES example.qml
|
||||
QML_FILES example.qml components/RibbonWindow.qml
|
||||
RESOURCES resources/imgs/heart.png resources/imgs/search.png
|
||||
)
|
||||
|
||||
|
@ -97,19 +97,22 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
|
|||
)
|
||||
|
||||
if(RIBBONUI_BUILD_STATIC_LIB)
|
||||
add_definitions(-DRIBBONUI_BUILD_STATIC_LIB)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
Qt::Quick
|
||||
RibbonUIplugin
|
||||
FramelessHelper::Core
|
||||
FramelessHelper::Quick
|
||||
)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
RIBBONUI_BUILD_STATIC_LIB
|
||||
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
Qt::Quick
|
||||
RibbonUI
|
||||
FramelessHelper::Core
|
||||
FramelessHelper::Quick
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
Qt::Quick
|
||||
RibbonUI
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})
|
||||
|
||||
|
|
|
@ -1,17 +1,28 @@
|
|||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
#include "ribbonui.h"
|
||||
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||
|
||||
FRAMELESSHELPER_USE_NAMESPACE
|
||||
#ifdef RIBBONUI_BUILD_STATIC_LIB
|
||||
Q_IMPORT_QML_PLUGIN(RibbonUIPlugin)
|
||||
#endif
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
RibbonUI::init(); // Must set before QGuiApplication
|
||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||
FramelessHelper::Quick::initialize();
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
|
||||
#endif
|
||||
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
|
||||
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
RibbonUI::registerTypes(&engine);
|
||||
FramelessHelper::Quick::registerTypes(&engine);
|
||||
const QUrl url(u"qrc:/qt/qml/RibbonUIAPP/example.qml"_qs);
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||
&app, [url](QObject *obj, const QUrl &objUrl) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import QtQuick.Controls.Material
|
|||
import QtQuick.Window
|
||||
import RibbonUI
|
||||
import org.wangwenx190.FramelessHelper
|
||||
import "components"
|
||||
|
||||
RibbonWindow {
|
||||
id:root
|
||||
|
|
|
@ -6,8 +6,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
||||
qt_standard_project_setup()
|
||||
qt_policy(SET QTP0001 NEW)
|
||||
|
@ -21,12 +19,6 @@ if(APPLE)
|
|||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
set(FRAMELESSHELPER_BUILD_STATIC ON)
|
||||
set(FRAMELESSHELPER_NO_SUMMARY OFF)
|
||||
set(FRAMELESSHELPER_NO_DEBUG_OUTPUT ON)
|
||||
set(FRAMELESSHELPER_BUILD_WIDGETS OFF)
|
||||
add_subdirectory(3rdparty/framelesshelper)
|
||||
|
||||
find_package(Qt6 COMPONENTS Core Quick Qml REQUIRED)
|
||||
|
||||
set(version_str "${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH}")
|
||||
|
@ -52,14 +44,14 @@ set(
|
|||
qml/RibbonText.qml qml/RibbonTextBoxMenu.qml qml/RibbonPopup.qml
|
||||
qml/RibbonPopupDialog.qml qml/RibbonLineEdit.qml qml/RibbonTextEdit.qml
|
||||
qml/RibbonComboBox.qml qml/RibbonSpinBox.qml qml/RibbonScrollIndicator.qml
|
||||
qml/RibbonScrollBar.qml qml/RibbonWindow.qml
|
||||
qml/RibbonScrollBar.qml
|
||||
)
|
||||
|
||||
foreach(qmlfile ${qml_files})
|
||||
string(REPLACE "qml/" "" fixedfile ${qmlfile})
|
||||
set_source_files_properties(${qmlfile} PROPERTIES QT_RESOURCE_ALIAS ${fixedfile})
|
||||
endforeach(qmlfile)
|
||||
|
||||
message(${RIBBONUI_QML_PLUGIN_DIRECTORY})
|
||||
qt_add_library(${PROJECT_NAME} ${LIB_TYPE})
|
||||
qt_add_qml_module(${PROJECT_NAME}
|
||||
PLUGIN_TARGET ${PLUGIN_TARGET_NAME}
|
||||
|
@ -72,38 +64,13 @@ qt_add_qml_module(${PROJECT_NAME}
|
|||
RESOURCE_PREFIX "/qt/qml/"
|
||||
)
|
||||
|
||||
if (MINGW)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "d")
|
||||
endif()
|
||||
|
||||
if (RIBBONUI_BUILD_STATIC_LIB)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
RIBBONUI_BUILD_STATIC_LIB
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>
|
||||
RIBBONUI_LIBRARY
|
||||
)
|
||||
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
Qt::Quick
|
||||
Qt::CorePrivate
|
||||
Qt::QuickPrivate
|
||||
Qt::QmlPrivate
|
||||
)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||
FramelessHelper::Core
|
||||
FramelessHelper::Quick
|
||||
)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/3rdparty/framelesshelper/include
|
||||
)
|
||||
|
||||
install(DIRECTORY ${RIBBONUI_QML_PLUGIN_DIRECTORY} DESTINATION ${CMAKE_INSTALL_PREFIX}/imports)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
|
|
@ -5,18 +5,6 @@
|
|||
#include <QtQml/qqml.h>
|
||||
#include <QtQml/qqmlregistration.h>
|
||||
|
||||
#ifndef RIBBONUI_API
|
||||
# ifdef RIBBONUI_BUILD_STATIC_LIB
|
||||
# define RIBBONUI_API
|
||||
# else // RIBBONUI_BUILD_STATIC_LIB
|
||||
# ifdef RIBBONUI_LIBRARY
|
||||
# define RIBBONUI_API Q_DECL_EXPORT
|
||||
# else // RIBBONUI_LIBRARY
|
||||
# define RIBBONUI_API Q_DECL_IMPORT
|
||||
# endif // RIBBONUI_LIBRARY
|
||||
# endif // RIBBONUI_BUILD_STATIC_LIB
|
||||
#endif // RIBBONUI_API
|
||||
|
||||
namespace RibbonIconsFilledEnum {
|
||||
Q_NAMESPACE
|
||||
enum class RibbonIcons_Filled{
|
||||
|
|
|
@ -10,18 +10,18 @@ ScrollBar {
|
|||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
|
||||
verticalPadding: control.hovered || control.pressed ? (control.vertical ? 8 + 5 : 0) + (18 - 8) / 2 : 2
|
||||
horizontalPadding: control.hovered || control.pressed ? (control.vertical ? 0 : 8 + 5) + (18 - 8) / 2 : 2
|
||||
verticalPadding: (control.vertical ? 8 + 5 : 0) + (18 - 8) / 2
|
||||
horizontalPadding: (control.vertical ? 0 : 8 + 5) + (18 - 8) / 2
|
||||
visible: control.policy !== ScrollBar.AlwaysOff
|
||||
minimumSize: orientation === Qt.Horizontal ? height / width : width / height
|
||||
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: control.hovered || control.pressed ? 8 : 4
|
||||
implicitHeight: control.hovered || control.pressed ? 8 : 4
|
||||
implicitWidth: 8
|
||||
implicitHeight: 8
|
||||
visible: control.size < 1.0
|
||||
radius: width / 2
|
||||
color: RibbonTheme.dark_mode ? hover_handler.hovered ? '#D6D6D6' : hover_handler.hovered && control.pressed ? '#E5E5E5' : '#999999'
|
||||
: hover_handler.hovered ? '#424242' : hover_handler.hovered && control.pressed ? '#333333' : '#707070'
|
||||
: hover_handler.hovered ? '#424242' : hover_handler.hovered && control.pressed ? '#333333' : '#707070'
|
||||
opacity: 0.0
|
||||
|
||||
states: State {
|
||||
|
@ -38,41 +38,21 @@ ScrollBar {
|
|||
}
|
||||
}
|
||||
|
||||
Behavior on implicitWidth {
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: hover_handler.hovered ? 0 : 300 }
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutSine
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitHeight {
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: hover_handler.hovered ? 0 : 300 }
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutSine
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler{
|
||||
id:hover_handler
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle{
|
||||
implicitWidth: control.hovered || control.pressed ? 18 : 0
|
||||
implicitHeight: control.hovered || control.pressed ? 18 : 0
|
||||
implicitWidth: 18
|
||||
implicitHeight: 18
|
||||
color: RibbonTheme.dark_mode ? '#141414' : '#F5F5F5'
|
||||
opacity: 0.0
|
||||
radius: implicitWidth / 2
|
||||
visible: control.contentItem.visible
|
||||
states: State {
|
||||
name: "active"
|
||||
when: control.active && control.hovered
|
||||
when: control.active
|
||||
PropertyChanges { control.background.opacity: 0.75 }
|
||||
}
|
||||
|
||||
|
@ -80,14 +60,9 @@ ScrollBar {
|
|||
Transition {
|
||||
from: "active"
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 450 }
|
||||
NumberAnimation { target: control.background; duration: 200; property: "opacity"; to: 0.0 }
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
to: "active"
|
||||
SequentialAnimation {
|
||||
NumberAnimation { target: control.background; duration: 200; property: "opacity";}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -101,7 +76,7 @@ ScrollBar {
|
|||
onClicked: control.decrease()
|
||||
Component.onCompleted: setup()
|
||||
ribbon_icon.filled: true
|
||||
ribbon_icon.icon_size: 15
|
||||
ribbon_icon.icon_size: 14
|
||||
ribbon_icon.color: RibbonTheme.dark_mode ? hovered ? '#D6D6D6' : pressed ? '#E5E5E5' : '#999999'
|
||||
: hovered ? '#424242' : pressed ? '#333333' : '#707070'
|
||||
Connections{
|
||||
|
@ -141,7 +116,7 @@ ScrollBar {
|
|||
onClicked: control.increase()
|
||||
Component.onCompleted: setup()
|
||||
ribbon_icon.filled: true
|
||||
ribbon_icon.icon_size: 15
|
||||
ribbon_icon.icon_size: 14
|
||||
ribbon_icon.color: RibbonTheme.dark_mode ? hovered ? '#D6D6D6' : pressed ? '#E5E5E5' : '#999999'
|
||||
: hovered ? '#424242' : pressed ? '#333333' : '#707070'
|
||||
Connections{
|
||||
|
@ -171,20 +146,4 @@ ScrollBar {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on verticalPadding {
|
||||
enabled: control.hovered
|
||||
NumberAnimation {
|
||||
duration: 100
|
||||
easing.type: Easing.OutSine
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on horizontalPadding {
|
||||
enabled: control.hovered
|
||||
NumberAnimation {
|
||||
duration: 100
|
||||
easing.type: Easing.OutSine
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,11 @@ ScrollIndicator {
|
|||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: control.hovered ? (control.background.implicitWidth - control.contentItem.implicitWidth)/2 : 2
|
||||
padding: (control.background.implicitWidth - control.contentItem.implicitWidth)/2
|
||||
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: control.hovered ? 8 : 4
|
||||
implicitHeight: control.hovered ? 8 : 4
|
||||
implicitWidth: 8
|
||||
implicitHeight: 8
|
||||
|
||||
color: RibbonTheme.dark_mode ? '#999999' : '#707070'
|
||||
visible: control.size < 1.0
|
||||
|
@ -31,35 +31,16 @@ ScrollIndicator {
|
|||
Transition {
|
||||
from: "active"
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 450 }
|
||||
NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 }
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Behavior on implicitWidth {
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: control.hovered ? 0 : 300 }
|
||||
NumberAnimation {
|
||||
duration: 50
|
||||
easing.type: Easing.OutSine
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitHeight {
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: control.hovered ? 0 : 300 }
|
||||
NumberAnimation {
|
||||
duration: 100
|
||||
easing.type: Easing.OutSine
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle{
|
||||
implicitWidth: control.hovered ? 18 : 0
|
||||
implicitHeight: control.hovered ? 18 : 0
|
||||
implicitWidth: 18
|
||||
implicitHeight: 18
|
||||
color: RibbonTheme.dark_mode ? '#141414' : '#F5F5F5'
|
||||
opacity: 0.0
|
||||
radius: implicitWidth / 2
|
||||
|
@ -67,7 +48,7 @@ ScrollIndicator {
|
|||
|
||||
states: State {
|
||||
name: "active"
|
||||
when: control.active && control.hovered
|
||||
when: control.active
|
||||
PropertyChanges { control.background.opacity: 0.75 }
|
||||
}
|
||||
|
||||
|
@ -75,14 +56,9 @@ ScrollIndicator {
|
|||
Transition {
|
||||
from: "active"
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 450 }
|
||||
NumberAnimation { target: control.background; duration: 200; property: "opacity"; to: 0.0 }
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
to: "active"
|
||||
SequentialAnimation {
|
||||
NumberAnimation { target: control.background; duration: 200; property: "opacity";}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -21,20 +21,3 @@ RibbonUI* RibbonUI::instance(){
|
|||
}
|
||||
return singleton;
|
||||
}
|
||||
|
||||
void RibbonUI::init()
|
||||
{
|
||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||
FramelessHelper::Quick::initialize();
|
||||
#ifdef Q_OS_WIN
|
||||
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
|
||||
#endif
|
||||
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
|
||||
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
}
|
||||
|
||||
void RibbonUI::registerTypes(QQmlEngine *qmlEngine)
|
||||
{
|
||||
FramelessHelper::Quick::registerTypes(qmlEngine);
|
||||
}
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
#include <QQuickItem>
|
||||
#include "definitions.h"
|
||||
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||
|
||||
FRAMELESSHELPER_USE_NAMESPACE
|
||||
class RibbonUI : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -18,8 +15,6 @@ class RibbonUI : public QQuickItem
|
|||
public:
|
||||
static RibbonUI* instance();
|
||||
static RibbonUI* create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return instance();}
|
||||
RIBBONUI_API static void init();
|
||||
RIBBONUI_API static void registerTypes(QQmlEngine *qmlEngine);
|
||||
private:
|
||||
explicit RibbonUI(QQuickItem *parent = nullptr);
|
||||
Q_DISABLE_COPY_MOVE(RibbonUI)
|
||||
|
|
Loading…
Reference in New Issue