restory QML related files
This commit is contained in:
parent
6b52c20cad
commit
6c1abd7bfe
|
@ -21,45 +21,16 @@ message("ukui-qml-style-helper PARENT_PATH: ${PARENT_PATH}")
|
|||
|
||||
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
|
||||
Widgets
|
||||
DBus
|
||||
)
|
||||
find_package(KF5Kirigami2 CONFIG REQUIRED COMPONENTS)
|
||||
find_package(KF5Config CONFIG REQUIRED COMPONENTS)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(Qsettings REQUIRED gsettings-qt)
|
||||
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
|
||||
pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0 )
|
||||
|
||||
set(EXTERNAL_LIBS "")
|
||||
set(PC_PKGS Qt5Xdg)
|
||||
|
||||
foreach(PC_LIB IN ITEMS ${PC_PKGS})
|
||||
pkg_check_modules(${PC_LIB} REQUIRED IMPORTED_TARGET ${PC_LIB})
|
||||
if(${${PC_LIB}_FOUND})
|
||||
include_directories(${${PC_LIB}_INCLUDE_DIRS})
|
||||
link_directories(${${PC_LIB}_LIBRARY_DIRS})
|
||||
list(APPEND EXTERNAL_LIBS PkgConfig::${PC_LIB})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
include_directories(${GLIB2_INCLUDE_DIRS})
|
||||
include_directories(${Qsettings_INCLUDE_DIRS})
|
||||
if (FONTCONFIG_FOUND)
|
||||
include_directories(${FONTCONFIG_INCLUDE_DIRS})
|
||||
link_directories(${FONTCONFIG_LIBRARY_DIRS})
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE HEADER_FILES "*.h"
|
||||
"styleparameter/*.h"
|
||||
"../qt5-ukui-platformtheme/platform-theme-fontdata.h"
|
||||
"../ukui-styles/dt-tmp-readconfig.h"
|
||||
)
|
||||
file(GLOB_RECURSE SRC_FILES "*.cpp"
|
||||
"styleparameter/*.cpp"
|
||||
"../qt5-ukui-platformtheme/platform-theme-fontdata.cpp"
|
||||
"../ukui-styles/dt-tmp-readconfig.cpp"
|
||||
)
|
||||
file(GLOB_RECURSE HEADER_FILES "*.h")
|
||||
file(GLOB_RECURSE SRC_FILES "*.cpp")
|
||||
file(GLOB_RECURSE OTHER_FILES qmldir)
|
||||
|
||||
SOURCE_GROUP("Header Files" FILES ${HEADER_FILES})
|
||||
|
@ -75,12 +46,8 @@ target_link_libraries(ukui-qml-style-helper PRIVATE
|
|||
KF5::Kirigami2
|
||||
Qt5::Quick
|
||||
Qt5::Widgets
|
||||
Qt5::DBus
|
||||
gsettings-qt
|
||||
qt5-ukui-style
|
||||
glib-2.0
|
||||
${FONTCONFIG_LIBRARIES}
|
||||
${EXTERNAL_LIBS}
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
|
|
|
@ -188,7 +188,6 @@ void KyQuickStyleItem::initStyleOption()
|
|||
|
||||
switch (m_itemType) {
|
||||
case Button: {
|
||||
qDebug() << "BUtton................";
|
||||
if (!m_styleoption)
|
||||
m_styleoption = new QStyleOptionButton();
|
||||
|
||||
|
@ -1477,7 +1476,6 @@ private:
|
|||
|
||||
void KyQuickStyleItem::paint(QPainter *painter)
|
||||
{
|
||||
return ;
|
||||
initStyleOption();
|
||||
if (QStyleOptionMenuItem *opt = qstyleoption_cast<QStyleOptionMenuItem*>(m_styleoption))
|
||||
painter->setFont(opt->font);
|
||||
|
|
|
@ -24,70 +24,12 @@
|
|||
#include "kyquickstyleitem.h"
|
||||
#include "kystylehelper.h"
|
||||
#include "KyIcon.h"
|
||||
#include "qdebug.h"
|
||||
#include <QQmlApplicationEngine>
|
||||
#include "styleparameter/ukuibutton.h"
|
||||
#include "styleparameter/appparameter.h"
|
||||
#include "styleparameter/imageprovider.h"
|
||||
#include "styleparameter/ukuilabel.h"
|
||||
#include "styleparameter/ukuimenuitem.h"
|
||||
#include "styleparameter/ukuimenu.h"
|
||||
#include "styleparameter/ukuipopup.h"
|
||||
#include "styleparameter/ukuiscrollbar.h"
|
||||
#include "styleparameter/ukuitabbutton.h"
|
||||
#include "styleparameter/ukuitooltip.h"
|
||||
#include "styleparameter/tokenparameter.h"
|
||||
#include "styleparameter/ukuiradiobutton.h"
|
||||
#include "styleparameter/ukuicheckbox.h"
|
||||
#include "styleparameter/ukuicombobox.h"
|
||||
#include "styleparameter/ukuiitemdelegate.h"
|
||||
#include "styleparameter/ukuitextfiled.h"
|
||||
#include "styleparameter/ukuiprogressbar.h"
|
||||
#include "styleparameter/ukuislider.h"
|
||||
#include "styleparameter/ukuispinbox.h"
|
||||
#include "styleparameter/ukuitabbar.h"
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
void Qqc2StylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
|
||||
{
|
||||
qDebug() << "registerTypes000000000...........";
|
||||
|
||||
engine->addImageProvider("imageProvider", new ImageProvider());
|
||||
qDebug() << "registerTypes222222222222........";
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Qqc2StylePlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.ukui.qqc2style.private"));
|
||||
// @uri org.ukui.qqc2style.private
|
||||
// qmlRegisterType<KyQuickStyleItem>(uri, 1, 0, "StyleItem");
|
||||
qmlRegisterType<KyQuickStyleItem>(uri, 1, 0, "StyleItem");
|
||||
qmlRegisterType<KyStyleHelper>(uri, 1, 0, "StyleHelper");
|
||||
qmlRegisterType<KyIcon>(uri, 1, 0, "KyIcon");
|
||||
qmlRegisterType<UKUIButton>(uri, 1, 0, "UKUIButton");
|
||||
qmlRegisterType<APPParameter>(uri, 1, 0, "APPParameter");
|
||||
qmlRegisterType<UKUILabel>(uri, 1, 0, "UKUILabel");
|
||||
qmlRegisterType<UKUIMenuItem>(uri, 1, 0, "UKUIMenuItem");
|
||||
qmlRegisterType<UKUIMenu>(uri, 1, 0, "UKUIMenu");
|
||||
qmlRegisterType<UKUIPopup>(uri, 1, 0, "UKUIPopup");
|
||||
qmlRegisterType<UKUIScrollBar>(uri, 1, 0, "UKUIScrollBar");
|
||||
qmlRegisterType<UKUITabButton>(uri, 1, 0, "UKUITabButton");
|
||||
qmlRegisterType<UKUIToolTip>(uri, 1, 0, "UKUIToolTip");
|
||||
qmlRegisterType<UKUIRadioButton>(uri, 1, 0, "UKUIRadioButton");
|
||||
qmlRegisterType<UKUICheckBox>(uri, 1, 0, "UKUICheckBox");
|
||||
qmlRegisterType<UKUIComboBox>(uri, 1, 0, "UKUIComboBox");
|
||||
qmlRegisterType<UKUIItemDelegate>(uri, 1, 0, "UKUIItemDelegate");
|
||||
qmlRegisterType<UKUITextFiled>(uri, 1, 0, "UKUITextFiled");
|
||||
qmlRegisterType<UKUIProgressBar>(uri, 1, 0, "UKUIProgressBar");
|
||||
qmlRegisterType<UKUISlider>(uri, 1, 0, "UKUISlider");
|
||||
qmlRegisterType<UKUISpinBox>(uri, 1, 0, "UKUISpinBox");
|
||||
qmlRegisterType<UKUITabBar>(uri, 1, 0, "UKUITabBar");
|
||||
|
||||
qRegisterMetaType<TokenParameter>("TokenParameter");
|
||||
|
||||
TokenParameter *token = new TokenParameter();
|
||||
qDebug() << "tokennnnn" << token;
|
||||
qApp->setProperty("qqc2-globaltoken", QVariant::fromValue(token));
|
||||
qDebug() << "registerTypes3333333333333........" << uri << qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
}
|
||||
|
|
|
@ -31,10 +31,7 @@ class Qqc2StylePlugin : public QQmlExtensionPlugin
|
|||
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
|
||||
|
||||
public:
|
||||
void initializeEngine(QQmlEngine *engine, const char *uri) override;
|
||||
void registerTypes(const char *uri) override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif // QQC2STYLEPLUGIN_H
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
#include "appparameter.h"
|
||||
#include <QDebug>
|
||||
#include <QApplication>
|
||||
#include <QGSettings>
|
||||
#include <QFontDatabase>
|
||||
#include <QIcon>
|
||||
#include <QDBusConnection>
|
||||
|
||||
#include "settings/ukui-style-settings.h"
|
||||
#include "../../qt5-ukui-platformtheme/platform-theme-fontdata.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
APPParameter::APPParameter(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
if(!qApp)
|
||||
return;
|
||||
qDebug() << "APPParameter...........";
|
||||
m_font = QApplication::font();
|
||||
m_palette = QApplication::palette();
|
||||
|
||||
if (QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
qDebug() << "APPParameter11111111111...........";
|
||||
|
||||
auto settings = UKUIStyleSettings::globalInstance();
|
||||
|
||||
//set font
|
||||
auto fontName = settings->get("systemFont").toString();
|
||||
auto fontSize = settings->get("systemFontSize").toString().toDouble();
|
||||
if (qApp->property("noChangeSystemFontSize").isValid() && qApp->property("noChangeSystemFontSize").toBool())
|
||||
fontSize = 11;
|
||||
QFont tempFont = m_font;
|
||||
tempFont.setFamily(fontName);
|
||||
tempFont.setPointSizeF(fontSize);
|
||||
setFont(tempFont);
|
||||
/*!
|
||||
* \bug
|
||||
* if we set app font, qwizard title's font will
|
||||
* become very small. I handle the wizard title
|
||||
* in ProxyStyle::polish().
|
||||
*/
|
||||
//Skip QGuiApplication avoid it crash when we setfont
|
||||
if (qApp->applicationName().toLower().contains(QLatin1String("kwin"))) {
|
||||
QDBusConnection::sessionBus().connect(QString(),
|
||||
QStringLiteral("/UKUIPlatformTheme"),
|
||||
QStringLiteral("org.ukui.UKUIPlatformTheme"),
|
||||
QStringLiteral("refreshFonts"),
|
||||
this,
|
||||
SLOT(slotChangeStyle(QString)));
|
||||
}
|
||||
|
||||
connect(settings, &QGSettings::changed, this, &APPParameter::slotChangeStyle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
APPParameter::~APPParameter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
APPParameter* APPParameter::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new APPParameter(p);
|
||||
}
|
||||
|
||||
const QFont &APPParameter::font() const
|
||||
{
|
||||
return m_font;
|
||||
}
|
||||
|
||||
void APPParameter::setFont(const QFont &newFont)
|
||||
{
|
||||
if (m_font == newFont)
|
||||
return;
|
||||
m_font = newFont;
|
||||
emit fontChanged();
|
||||
}
|
||||
|
||||
void APPParameter::slotChangeStyle(const QString& key)
|
||||
{
|
||||
auto settings = UKUIStyleSettings::globalInstance();
|
||||
// if (key == "iconThemeName" || key == "icon-theme-name") {
|
||||
// QString icontheme = settings->get("icon-theme-name").toString();
|
||||
|
||||
// QIcon::setThemeName(icontheme);
|
||||
|
||||
// QIcon icon = qApp->windowIcon();
|
||||
// qApp->setWindowIcon(QIcon::fromTheme(icon.name()));
|
||||
// // update all widgets for repaint new themed icons.
|
||||
// for (auto widget : QApplication::allWidgets()) {
|
||||
// widget->update();
|
||||
// }
|
||||
// }
|
||||
|
||||
if (key == "systemFont" || key == "system-font") {
|
||||
//Skip QGuiApplication avoid it crash when we setfont
|
||||
auto *app = qobject_cast<QApplication *>(qApp);
|
||||
if(app == nullptr)
|
||||
return;
|
||||
|
||||
QString font = settings->get("system-font").toString();
|
||||
|
||||
QFontDatabase db;
|
||||
int id = 0;
|
||||
if (!db.families().contains(font)) {
|
||||
PlatformThemeFontData fontData;
|
||||
QMap<QString, QString> fontMap = fontData.getAllFontInformation();
|
||||
if(fontMap.contains(font)){
|
||||
auto iter = fontMap.find(font);
|
||||
id = QFontDatabase::addApplicationFont(iter.value());
|
||||
}
|
||||
}
|
||||
|
||||
QFontDatabase newDb;
|
||||
if (newDb.families().contains(font)) {
|
||||
QFont tempFont = font;
|
||||
setFont(tempFont);
|
||||
}
|
||||
}
|
||||
if (key == "systemFontSize" || key == "system-font-size") {
|
||||
//Skip QGuiApplication avoid it crash when we setfont
|
||||
auto *app = qobject_cast<QApplication *>(qApp);
|
||||
if(app == nullptr)
|
||||
return;
|
||||
|
||||
if (qApp->property("noChangeSystemFontSize").isValid() && qApp->property("noChangeSystemFontSize").toBool())
|
||||
return;
|
||||
double fontSize = settings->get("system-font-size").toString().toDouble();
|
||||
if (fontSize > 0) {
|
||||
QFont oldFont = QApplication::font();
|
||||
|
||||
QFont tempFont = m_font;
|
||||
tempFont.setPointSize(fontSize);
|
||||
setFont(tempFont);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const QPalette &APPParameter::palette() const
|
||||
{
|
||||
return m_palette;
|
||||
}
|
||||
|
||||
|
||||
void APPParameter::setPalette(const QPalette &newPalette)
|
||||
{
|
||||
if (m_palette == newPalette)
|
||||
return;
|
||||
m_palette = newPalette;
|
||||
emit paletteChanged();
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APPPARAMETER_H
|
||||
#define APPPARAMETER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QPalette>
|
||||
#include <QQuickItem>
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class APPParameter : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
|
||||
Q_PROPERTY(QPalette palette READ palette WRITE setPalette NOTIFY paletteChanged)
|
||||
Q_PROPERTY(int iconWidth READ iconWidth WRITE setIconWidth NOTIFY iconWidthChanged)
|
||||
Q_PROPERTY(int space READ space WRITE setSpace NOTIFY spaceChanged)
|
||||
|
||||
public:
|
||||
explicit APPParameter(QQuickItem *parent = nullptr);
|
||||
~APPParameter();
|
||||
|
||||
static APPParameter* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
const QFont &font() const;
|
||||
void setFont(const QFont &newFont);
|
||||
|
||||
const QPalette &palette() const;
|
||||
void setPalette(const QPalette &newPalette);
|
||||
|
||||
int iconWidth() const;
|
||||
void setIconWidth(int newIconWidth);
|
||||
|
||||
int space() const;
|
||||
void setSpace(int newSpace);
|
||||
|
||||
public slots:
|
||||
|
||||
void slotChangeStyle(const QString& key);
|
||||
|
||||
signals:
|
||||
void fontChanged();
|
||||
|
||||
|
||||
void paletteChanged();
|
||||
|
||||
void iconWidthChanged();
|
||||
|
||||
void spaceChanged();
|
||||
|
||||
private:
|
||||
QFont m_font;
|
||||
QPalette m_palette;
|
||||
int m_iconWidth = 16;
|
||||
int m_space = 8;
|
||||
};
|
||||
|
||||
inline int APPParameter::iconWidth() const
|
||||
{
|
||||
return m_iconWidth;
|
||||
}
|
||||
|
||||
|
||||
inline void APPParameter::setIconWidth(int newIconWidth)
|
||||
{
|
||||
if (m_iconWidth == newIconWidth)
|
||||
return;
|
||||
m_iconWidth = newIconWidth;
|
||||
emit iconWidthChanged();
|
||||
}
|
||||
|
||||
inline int APPParameter::space() const
|
||||
{
|
||||
return m_space;
|
||||
}
|
||||
|
||||
inline void APPParameter::setSpace(int newSpace)
|
||||
{
|
||||
if (m_space == newSpace)
|
||||
return;
|
||||
m_space = newSpace;
|
||||
emit spaceChanged();
|
||||
}
|
||||
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::APPParameter, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // APPPARAMETER_H
|
|
@ -1,19 +0,0 @@
|
|||
#include "icon.h"
|
||||
#include "qdebug.h"
|
||||
#include "qpixmap.h"
|
||||
#include "qimage.h"
|
||||
#include <QFile>
|
||||
#include <QSize>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QColor>
|
||||
#include <qmath.h>
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
|
||||
Icon::Icon(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ICON_H
|
||||
#define ICON_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QQuickImageProvider>
|
||||
#include <QIcon>
|
||||
#include <QUrl>
|
||||
#include <QPixmap>
|
||||
#include <QString>
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class Icon : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Icon(QObject *parent = nullptr);
|
||||
|
||||
enum Mode { Normal, Disabled, Hovered, Selected };
|
||||
|
||||
};
|
||||
}
|
||||
#endif // IMAGEPROVIDER_H
|
|
@ -1,290 +0,0 @@
|
|||
#include "imageprovider.h"
|
||||
#include "qdebug.h"
|
||||
#include "qpixmap.h"
|
||||
#include "qimage.h"
|
||||
#include <QFile>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QSize>
|
||||
#include <qt5xdg/XdgIcon>
|
||||
#include <QColor>
|
||||
#include <QPainter>
|
||||
#include <qmath.h>
|
||||
|
||||
#include "effects/highlight-effect.h"
|
||||
#include "icon.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
static QSize defaultSize = QSize(16, 16);
|
||||
|
||||
QIcon IconHelper::getDefaultIcon()
|
||||
{
|
||||
QIcon icon;
|
||||
loadDefaultIcon(icon);
|
||||
return icon;
|
||||
}
|
||||
|
||||
QIcon IconHelper::loadIcon(const QString &id)
|
||||
{
|
||||
QIcon icon;
|
||||
if (id.isEmpty()) {
|
||||
loadDefaultIcon(icon);
|
||||
return icon;
|
||||
}
|
||||
|
||||
bool isOk = false;
|
||||
QString path = toLocalPath(id);
|
||||
qDebug() << "path......" << id << path;
|
||||
if (!path.isEmpty()) {
|
||||
QPixmap pixmap;
|
||||
isOk = loadPixmap(path, pixmap);
|
||||
if (isOk) {
|
||||
icon.addPixmap(pixmap);
|
||||
}
|
||||
|
||||
} else {
|
||||
isOk = loadThemeIcon(id, icon);
|
||||
if (!isOk) {
|
||||
isOk = loadXdgIcon(id, icon);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isOk) {
|
||||
loadDefaultIcon(icon);
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
bool IconHelper::loadPixmap(const QString &path, QPixmap &pixmap)
|
||||
{
|
||||
if (!QFile::exists(path)) {
|
||||
qWarning() << "Error: loadPixmap, File dose not exists." << path;
|
||||
return false;
|
||||
}
|
||||
|
||||
return pixmap.load(path);
|
||||
}
|
||||
|
||||
bool IconHelper::loadThemeIcon(const QString &name, QIcon &icon)
|
||||
{
|
||||
if (!QIcon::hasThemeIcon(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
icon = QIcon::fromTheme(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
void IconHelper::loadDefaultIcon(QIcon &icon)
|
||||
{
|
||||
if (!loadThemeIcon("application-x-desktop", icon)) {
|
||||
QPixmap pixmap;
|
||||
if (loadPixmap(":/res/icon/application-x-desktop.png", pixmap)) {
|
||||
icon.addPixmap(pixmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool IconHelper::loadXdgIcon(const QString &name, QIcon &icon)
|
||||
{
|
||||
icon = XdgIcon::fromTheme(name);
|
||||
if (icon.isNull()) {
|
||||
qWarning() << "Error: loadXdgIcon, icon dose not exists. name:" << name;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// see: https://doc.qt.io/archives/qt-5.12/qurl.html#details
|
||||
QString IconHelper::toLocalPath(const QUrl &url)
|
||||
{
|
||||
if (url.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
// file:
|
||||
if (url.isLocalFile()) {
|
||||
return url.path();
|
||||
}
|
||||
|
||||
QString schema = url.scheme();
|
||||
if (schema.isEmpty()) {
|
||||
QString path = url.path();
|
||||
if (path.startsWith("/") || path.startsWith(":")) {
|
||||
return path;
|
||||
}
|
||||
|
||||
} else {
|
||||
// qrc example: the Path ":/images/cut.png" or the URL "qrc:///images/cut.png"
|
||||
// see: https://doc.qt.io/archives/qt-5.12/resources.html
|
||||
if (schema == "qrc") {
|
||||
//qrc path: :/xxx/xxx.png
|
||||
return ":" + url.path();
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
bool IconHelper::isRemoteServerFile(const QUrl &url)
|
||||
{
|
||||
if (url.isEmpty() || url.scheme().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return url.scheme() == "http" || url.scheme() == "https";
|
||||
}
|
||||
|
||||
bool IconHelper::isThemeIcon(const QString &name)
|
||||
{
|
||||
return QIcon::hasThemeIcon(name) || !XdgIcon::fromTheme(name).isNull();
|
||||
}
|
||||
|
||||
bool IconHelper::isLocalFile(const QUrl &url)
|
||||
{
|
||||
return !toLocalPath(url).isEmpty();
|
||||
}
|
||||
|
||||
QPixmap IconHelper::generatePixMap(const QString &id, Icon::Mode mode, const QSize &requestedSize, QSize defaultSize)
|
||||
{
|
||||
QIcon icon = IconHelper::loadIcon(id);
|
||||
QPixmap pixmap = icon.pixmap(requestedSize.isEmpty() ? defaultSize : requestedSize);
|
||||
if(mode == Icon::Disabled){
|
||||
// Icon *icon = new Icon();
|
||||
qDebug() << "disable 000000000...............";
|
||||
pixmap = generatedDisablePixmap(pixmap);
|
||||
qDebug() << "disable 111111111111111...............";
|
||||
}
|
||||
else if(mode == Icon::Selected){
|
||||
pixmap = generatedHightlightPixmap(pixmap);
|
||||
|
||||
}
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
QPixmap IconHelper::generatedDisablePixmap(QPixmap pixmap)
|
||||
{
|
||||
QPixmap target = pixmap;
|
||||
|
||||
// //Fix me:QT original code
|
||||
QImage im = target.toImage().convertToFormat(QImage::Format_ARGB32);
|
||||
|
||||
// Create a colortable based on the background (black -> bg -> white)
|
||||
QColor bg = qApp->palette().color(QPalette::Disabled, QPalette::ButtonText);
|
||||
int red = bg.red();
|
||||
int green = bg.green();
|
||||
int blue = bg.blue();
|
||||
uchar reds[256], greens[256], blues[256];
|
||||
for (int i=0; i<128; ++i) {
|
||||
reds[i] = uchar((red * (i<<1)) >> 8);
|
||||
greens[i] = uchar((green * (i<<1)) >> 8);
|
||||
blues[i] = uchar((blue * (i<<1)) >> 8);
|
||||
}
|
||||
for (int i=0; i<128; ++i) {
|
||||
reds[i+128] = uchar(qMin(red + (i << 1), 255));
|
||||
greens[i+128] = uchar(qMin(green + (i << 1), 255));
|
||||
blues[i+128] = uchar(qMin(blue + (i << 1), 255));
|
||||
}
|
||||
|
||||
int intensity = (77 * red + 150 * green + 28 * blue) / 255;
|
||||
//qt_intensity(red, green, blue);
|
||||
const int factor = 191;
|
||||
|
||||
// High intensity colors needs dark shifting in the color table, while
|
||||
// low intensity colors needs light shifting. This is to increase the
|
||||
// perceived contrast.
|
||||
if ((red - factor > green && red - factor > blue)
|
||||
|| (green - factor > red && green - factor > blue)
|
||||
|| (blue - factor > red && blue - factor > green))
|
||||
intensity = qMin(255, intensity + 91);
|
||||
// else if (intensity <= 128)
|
||||
// intensity -= 51;
|
||||
bool isPureColor= HighLightEffect::isPixmapPureColor(pixmap);
|
||||
|
||||
for (int y=0; y<im.height(); ++y) {
|
||||
QRgb *scanLine = (QRgb*)im.scanLine(y);
|
||||
for (int x=0; x<im.width(); ++x) {
|
||||
QRgb pixel = *scanLine;
|
||||
// Calculate color table index, taking intensity adjustment
|
||||
// and a magic offset into account.
|
||||
uint ci = uint(qGray(pixel)/3 + (130 - intensity / 3));
|
||||
|
||||
int r = int(reds[ci]);
|
||||
int g = int(greens[ci]);
|
||||
int b = int(blues[ci]);
|
||||
int a = qAlpha(pixel)/255.0 > 0.7 ? 0.7 * 255 : qAlpha(pixel);
|
||||
if(isPureColor){
|
||||
r = qMax(int(reds[ci]), bg.red());
|
||||
g = qMax(int(greens[ci]), bg.green());
|
||||
b = qMax(int(blues[ci]), bg.blue());
|
||||
a = qAlpha(pixel);
|
||||
}
|
||||
*scanLine = qRgba(r, g, b, a);
|
||||
++scanLine;
|
||||
}
|
||||
}
|
||||
|
||||
return QPixmap::fromImage(im);
|
||||
|
||||
|
||||
//Fix me:set same color to text when set icon mode disable.But it has error in color icons.
|
||||
|
||||
// QColor bg = option->palette.color(QPalette::Disabled, QPalette::WindowText);
|
||||
// bg.setAlphaF(0.5);
|
||||
// QPainter p(&target);
|
||||
// p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
// p.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
// p.fillRect(target.rect(), bg);
|
||||
// p.end();
|
||||
|
||||
// return target;
|
||||
|
||||
}
|
||||
|
||||
QPixmap IconHelper::generatedHightlightPixmap(QPixmap pixmap)
|
||||
{
|
||||
QPixmap target = pixmap;
|
||||
QPainter p(&target);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
p.fillRect(target.rect(), Qt::white);
|
||||
return target;
|
||||
}
|
||||
|
||||
ImageProvider::ImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap)
|
||||
{
|
||||
qDebug() << "ImageProvider.............";
|
||||
}
|
||||
|
||||
//requestPixmap函数的重写,在qml中使用source加载图片时会自动调用requestPixmap或requestImage函数(根据图片类型不同),返回QPixmap或QImage对象
|
||||
QPixmap ImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
|
||||
{
|
||||
int lastIndex = id.lastIndexOf("/");
|
||||
QString model, iconID = id;
|
||||
if(lastIndex != -1){
|
||||
iconID = id.left(lastIndex);
|
||||
model = id.right(id.length() - lastIndex - 1);
|
||||
}
|
||||
qDebug() << "requestPixmap............model:" << model << "...iconID......." << iconID;
|
||||
|
||||
Icon::Mode im = Icon::Mode::Normal;
|
||||
if(model == "disenable")
|
||||
im = Icon::Disabled;
|
||||
else if(model == "clicked")
|
||||
im = Icon::Selected;
|
||||
else if(model == "hover")
|
||||
im = Icon::Hovered;
|
||||
|
||||
QPixmap pixmap = IconHelper::generatePixMap(iconID, im, requestedSize, defaultSize);
|
||||
|
||||
if (size) {
|
||||
QSize pixmapSize = pixmap.size();
|
||||
size->setWidth(pixmapSize.width());
|
||||
size->setHeight(pixmapSize.height());
|
||||
}
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IMAGEPROVIDER_H
|
||||
#define IMAGEPROVIDER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QQuickImageProvider>
|
||||
#include <QIcon>
|
||||
#include <QUrl>
|
||||
#include <QPixmap>
|
||||
#include <QString>
|
||||
#include "icon.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class IconHelper
|
||||
{
|
||||
public:
|
||||
// 判断函数
|
||||
// 是否存在主题图标
|
||||
static bool isThemeIcon(const QString &name);
|
||||
// 是否本地文件
|
||||
static bool isLocalFile(const QUrl &url);
|
||||
// 远程文件: http or https
|
||||
static bool isRemoteServerFile(const QUrl &url);
|
||||
|
||||
// 功能函数
|
||||
/**
|
||||
* Url转换为本地文件
|
||||
* 判断一个url是否本地文件。包括qrc
|
||||
* @param url
|
||||
* @return 返回可用于load的path,如果不是本地文件,返回空
|
||||
*/
|
||||
static QString toLocalPath(const QUrl &url);
|
||||
|
||||
// 图标相关
|
||||
// 从某个路径加载图标,并存入引用中,返回加载是否成功
|
||||
static bool loadPixmap(const QString &path, QPixmap &pixmap);
|
||||
|
||||
// 从路径或者主题加载图标
|
||||
static QIcon loadIcon(const QString &id);
|
||||
|
||||
// 默认图标
|
||||
static QIcon getDefaultIcon();
|
||||
|
||||
static QPixmap generatePixMap(const QString &id, Icon::Mode mode, const QSize &requestSize, QSize defaultSize);
|
||||
|
||||
|
||||
private:
|
||||
static bool loadThemeIcon(const QString &name, QIcon &icon);
|
||||
static bool loadXdgIcon(const QString &name, QIcon &icon);
|
||||
static void loadDefaultIcon(QIcon &icon);
|
||||
static QPixmap generatedDisablePixmap(QPixmap pixmap);
|
||||
static QPixmap generatedHightlightPixmap(QPixmap pixmap);
|
||||
|
||||
};
|
||||
|
||||
|
||||
class ImageProvider : public QQuickImageProvider
|
||||
{
|
||||
public:
|
||||
explicit ImageProvider();
|
||||
|
||||
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); //重写requestPixmap函数
|
||||
};
|
||||
}
|
||||
#endif // IMAGEPROVIDER_H
|
|
@ -1,47 +0,0 @@
|
|||
#include "tokenparameter.h"
|
||||
#include <QDebug>
|
||||
#include <QApplication>
|
||||
#include <QGSettings>
|
||||
#include <QFontDatabase>
|
||||
#include <QIcon>
|
||||
#include <QColor>
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
TokenParameter::TokenParameter()
|
||||
{
|
||||
//UKUIGlobalDTConfig::GlobalDTConfig dtConfig;
|
||||
|
||||
}
|
||||
|
||||
TokenParameter::~TokenParameter()
|
||||
{
|
||||
deleteInstance();
|
||||
}
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* TokenParameter:: getInstance()
|
||||
{
|
||||
if(dt == nullptr)
|
||||
dt = new UKUIGlobalDTConfig::GlobalDTConfig();
|
||||
return dt;
|
||||
}
|
||||
|
||||
void TokenParameter::deleteInstance()
|
||||
{
|
||||
if(dt){
|
||||
delete dt;
|
||||
dt = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//const std::shared_ptr<UKUIQQC2Style::UKUIButton> &TokenParameter::button() const
|
||||
//{
|
||||
// return m_button;
|
||||
//}
|
||||
|
||||
//void TokenParameter::setButton(std::shared_ptr<UKUIQQC2Style::UKUIButton> &newButton)
|
||||
//{
|
||||
// if (m_button == newButton)
|
||||
// return;
|
||||
// m_button = newButton;
|
||||
// emit buttonChanged();
|
||||
//}
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TOKENPARAMETER_H
|
||||
#define TOKENPARAMETER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMetaType>
|
||||
#include "../../ukui-styles/dt-tmp-readconfig.h"
|
||||
#include "ukuibutton.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class TokenParameter
|
||||
{
|
||||
//Q_PROPERTY(std::shared_ptr<UKUIQQC2Style::UKUIButton> button READ button WRITE setButton NOTIFY buttonChanged)
|
||||
|
||||
public:
|
||||
explicit TokenParameter();
|
||||
~TokenParameter();
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* getInstance();
|
||||
void deleteInstance();
|
||||
|
||||
|
||||
// const std::shared_ptr<UKUIQQC2Style::UKUIButton> &button() const;
|
||||
// void setButton(std::shared_ptr<UKUIQQC2Style::UKUIButton> &newButton);
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* dt;
|
||||
// UKUIButton m_button;
|
||||
};
|
||||
}
|
||||
Q_DECLARE_METATYPE(UKUIQQC2Style::TokenParameter*)
|
||||
|
||||
#endif // TOKENPARAMETER_H
|
|
@ -1,425 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "ukuibutton.h"
|
||||
#include "qdebug.h"
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUIButton::UKUIButton(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
{
|
||||
m_normalBC = DTColor(QColor("#E6E6E6"));
|
||||
m_clickedBC = DTColor(QColor("#B9B9B9"));
|
||||
m_hoveredBC = DTColor(QColor("#DCDCDC"));
|
||||
m_disableBC = DTColor(QColor("#EEEEEE"));
|
||||
m_disableTextColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.35));
|
||||
m_normalTextColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.85));
|
||||
m_normalHBC = DTColor(QColor("#3790FA"));
|
||||
m_clickedHBC = DTColor(QColor("#3790FA"));
|
||||
m_hoveredHBC = DTColor(QColor("#3790FA"));
|
||||
m_disableHBC = DTColor(QColor("#EEEEEE"));
|
||||
}
|
||||
qDebug() << "UKUIButton..............";
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUIButton::~UKUIButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UKUIButton* UKUIButton::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUIButton(p);
|
||||
}
|
||||
|
||||
void UKUIButton::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setNormalBC(instance->buttonActive());
|
||||
setClickedBC(instance->kComponentClick());
|
||||
setHoveredBC(instance->kComponentHover());
|
||||
setDisableBC(instance->buttonDisable());
|
||||
|
||||
setNormalHBC(instance->highLightActive());
|
||||
setHoveredHBC(instance->kBrandHover());
|
||||
setClickedHBC(instance->kBrandClick());
|
||||
setDisableHBC(instance->highLightDisable());
|
||||
|
||||
setNormalTextColor(instance->buttonTextActive());
|
||||
setDisableTextColor(instance->buttonTextDisable());
|
||||
|
||||
setBorderWidth(1);
|
||||
setFocusBorderWidth(instance->focusline());
|
||||
setNormalBorderColor(instance->kLineComponentNormal());
|
||||
setClickBorderColor(instance->kLineComponentClick());
|
||||
setHoverBorderColor(instance->kLineComponentHover());
|
||||
setDisableBorderColor(instance->kLineComponentDisable());
|
||||
|
||||
setNormalBorderHColor(instance->kLineBrandNormal());
|
||||
setClickBorderHColor(instance->kLineBrandClick());
|
||||
setHoverBorderHColor(instance->kLineBrandHover());
|
||||
setDisableBorderHColor(instance->kLineBrandDisable());
|
||||
setFocusBorderColor(instance->kBrandFocus());
|
||||
|
||||
// qDebug() << "instance->highLightActive()..." << m_normalHBC.red() << m_normalHBC.green() << m_normalHBC.blue();
|
||||
// qDebug() << "instance->setHoveredHBC()..." << m_hoveredHBC.red() << m_hoveredHBC.green() << m_hoveredHBC.blue();
|
||||
}
|
||||
|
||||
|
||||
double UKUIButton::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUIButton::setRadius(double newRadius)
|
||||
{
|
||||
if (m_radius == newRadius)
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit radiusChanged();
|
||||
}
|
||||
|
||||
double UKUIButton::leftRightMargin() const
|
||||
{
|
||||
return m_leftRightMargin;
|
||||
}
|
||||
|
||||
void UKUIButton::setLeftRightMargin(double newMargin)
|
||||
{
|
||||
if (m_leftRightMargin == newMargin)
|
||||
return;
|
||||
m_leftRightMargin = newMargin;
|
||||
emit leftRightMarginChanged();
|
||||
}
|
||||
|
||||
double UKUIButton::upDownMargin() const
|
||||
{
|
||||
return m_upDownMargin;
|
||||
}
|
||||
|
||||
void UKUIButton::setUpDownMargin(double newUpDownMargin)
|
||||
{
|
||||
if (m_upDownMargin == newUpDownMargin)
|
||||
return;
|
||||
m_upDownMargin = newUpDownMargin;
|
||||
emit upDownMarginChanged();
|
||||
}
|
||||
|
||||
double UKUIButton::space() const
|
||||
{
|
||||
return m_space;
|
||||
}
|
||||
|
||||
void UKUIButton::setSpace(double newSpace)
|
||||
{
|
||||
if (qFuzzyCompare(m_space, newSpace))
|
||||
return;
|
||||
m_space = newSpace;
|
||||
emit spaceChanged();
|
||||
}
|
||||
|
||||
int UKUIButton::normalWidth() const
|
||||
{
|
||||
return m_normalWidth;
|
||||
}
|
||||
|
||||
void UKUIButton::setNormalWidth(int newNormalWidth)
|
||||
{
|
||||
if (m_normalWidth == newNormalWidth)
|
||||
return;
|
||||
m_normalWidth = newNormalWidth;
|
||||
emit normalWidthChanged();
|
||||
}
|
||||
|
||||
int UKUIButton::normalHeight() const
|
||||
{
|
||||
return m_normalHeight;
|
||||
}
|
||||
|
||||
void UKUIButton::setNormalHeight(int newNormalHeight)
|
||||
{
|
||||
if (m_normalHeight == newNormalHeight)
|
||||
return;
|
||||
m_normalHeight = newNormalHeight;
|
||||
emit normalHeightChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIButton::normalBC() const
|
||||
{
|
||||
return m_normalBC;
|
||||
}
|
||||
|
||||
void UKUIButton::setNormalBC(DTColor newNormalBC)
|
||||
{
|
||||
if (m_normalBC != newNormalBC)
|
||||
{
|
||||
m_normalBC = newNormalBC;
|
||||
emit normalBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::clickedBC() const
|
||||
{
|
||||
return m_clickedBC;
|
||||
}
|
||||
|
||||
void UKUIButton::setClickedBC(DTColor newClickedBC)
|
||||
{
|
||||
if (m_clickedBC != newClickedBC){
|
||||
m_clickedBC = newClickedBC;
|
||||
emit clickedBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::hoveredBC() const
|
||||
{
|
||||
return m_hoveredBC;
|
||||
}
|
||||
|
||||
void UKUIButton::setHoveredBC(DTColor newHoveredBC)
|
||||
{
|
||||
if (m_hoveredBC != newHoveredBC){
|
||||
m_hoveredBC = newHoveredBC;
|
||||
emit hoveredBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::disableBC() const
|
||||
{
|
||||
return m_disableBC;
|
||||
}
|
||||
|
||||
void UKUIButton::setDisableBC(DTColor newDisableBC)
|
||||
{
|
||||
if (m_disableBC != newDisableBC){
|
||||
m_disableBC = newDisableBC;
|
||||
emit disableBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::disableTextColor() const
|
||||
{
|
||||
return m_disableTextColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setDisableTextColor(DTColor newDisableTextColor)
|
||||
{
|
||||
if (m_disableTextColor != newDisableTextColor){
|
||||
m_disableTextColor = newDisableTextColor;
|
||||
emit disableTextColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::normalTextColor() const
|
||||
{
|
||||
return m_normalTextColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setNormalTextColor(DTColor newNormalTextColor)
|
||||
{
|
||||
if (m_normalTextColor != newNormalTextColor){
|
||||
m_normalTextColor = newNormalTextColor;
|
||||
emit normalTextColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::normalHBC() const
|
||||
{
|
||||
return m_normalHBC;
|
||||
}
|
||||
|
||||
void UKUIButton::setNormalHBC(DTColor newNormalHBC)
|
||||
{
|
||||
if (m_normalHBC != newNormalHBC){
|
||||
m_normalHBC = newNormalHBC;
|
||||
emit normalHBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::clickedHBC() const
|
||||
{
|
||||
return m_clickedHBC;
|
||||
}
|
||||
|
||||
void UKUIButton::setClickedHBC(DTColor newClickedHBC)
|
||||
{
|
||||
if (m_clickedHBC != newClickedHBC){
|
||||
m_clickedHBC = newClickedHBC;
|
||||
emit clickedHBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::hoveredHBC() const
|
||||
{
|
||||
return m_hoveredHBC;
|
||||
}
|
||||
|
||||
void UKUIButton::setHoveredHBC(DTColor newHoveredHBC)
|
||||
{
|
||||
if (m_hoveredHBC != newHoveredHBC){
|
||||
m_hoveredHBC = newHoveredHBC;
|
||||
emit hoveredHBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::disableHBC() const
|
||||
{
|
||||
return m_disableHBC;
|
||||
}
|
||||
|
||||
void UKUIButton::setDisableHBC(DTColor newDisableHBC)
|
||||
{
|
||||
if (m_disableHBC != newDisableHBC){
|
||||
m_disableHBC = newDisableHBC;
|
||||
emit disableHBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int UKUIButton::borderWidth() const
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
|
||||
void UKUIButton::setBorderWidth(int newBorderWidth)
|
||||
{
|
||||
if (m_borderWidth == newBorderWidth)
|
||||
return;
|
||||
m_borderWidth = newBorderWidth;
|
||||
emit borderWidthChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIButton::normalBorderColor() const
|
||||
{
|
||||
return m_normalBorderColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setNormalBorderColor(DTColor newNormalBorderColor)
|
||||
{
|
||||
if (m_normalBorderColor != newNormalBorderColor){
|
||||
m_normalBorderColor = newNormalBorderColor;
|
||||
emit normalBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::hoverBorderColor() const
|
||||
{
|
||||
return m_hoverBorderColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setHoverBorderColor(DTColor newHoverBorderColor)
|
||||
{
|
||||
if (m_hoverBorderColor != newHoverBorderColor){
|
||||
m_hoverBorderColor = newHoverBorderColor;
|
||||
emit hoverBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::clickBorderColor() const
|
||||
{
|
||||
return m_clickBorderColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setClickBorderColor(DTColor newClickBorderColor)
|
||||
{
|
||||
if (m_clickBorderColor!= newClickBorderColor){
|
||||
m_clickBorderColor = newClickBorderColor;
|
||||
emit clickBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::disableBorderColor() const
|
||||
{
|
||||
return m_disableBorderColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setDisableBorderColor(DTColor newDisableBorderColor)
|
||||
{
|
||||
if (m_disableBorderColor != newDisableBorderColor){
|
||||
m_disableBorderColor = newDisableBorderColor;
|
||||
emit disableBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::normalBorderHColor() const
|
||||
{
|
||||
return m_normalBorderHColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setNormalBorderHColor(DTColor newNormalBorderHColor)
|
||||
{
|
||||
if (m_normalBorderHColor != newNormalBorderHColor){
|
||||
m_normalBorderHColor = newNormalBorderHColor;
|
||||
emit normalBorderHColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::hoverBorderHColor() const
|
||||
{
|
||||
return m_hoverBorderHColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setHoverBorderHColor(DTColor newHoverBorderHColor)
|
||||
{
|
||||
if (m_hoverBorderHColor != newHoverBorderHColor){
|
||||
m_hoverBorderHColor = newHoverBorderHColor;
|
||||
emit hoverBorderHColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::clickBorderHColor() const
|
||||
{
|
||||
return m_clickBorderHColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setClickBorderHColor(DTColor newClickBorderHColor)
|
||||
{
|
||||
if (m_clickBorderHColor != newClickBorderHColor){
|
||||
m_clickBorderHColor = newClickBorderHColor;
|
||||
emit clickBorderHColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::disableBorderHColor() const
|
||||
{
|
||||
return m_disableBorderHColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setDisableBorderHColor(DTColor newDisableBorderHColor)
|
||||
{
|
||||
if (m_disableBorderHColor != newDisableBorderHColor){
|
||||
m_disableBorderHColor = newDisableBorderHColor;
|
||||
emit disableBorderHColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIButton::focusBorderColor() const
|
||||
{
|
||||
return m_focusBorderColor;
|
||||
}
|
||||
|
||||
void UKUIButton::setFocusBorderColor(DTColor newFocusBorderColor)
|
||||
{
|
||||
if (m_focusBorderColor != newFocusBorderColor){
|
||||
m_focusBorderColor = newFocusBorderColor;
|
||||
emit focusBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int UKUIButton::focusBorderWidth() const
|
||||
{
|
||||
return m_focusBorderWidth;
|
||||
}
|
||||
|
||||
void UKUIButton::setFocusBorderWidth(int newFocusBorderWidth)
|
||||
{
|
||||
if (m_focusBorderWidth == newFocusBorderWidth)
|
||||
return;
|
||||
m_focusBorderWidth = newFocusBorderWidth;
|
||||
emit focusBorderWidthChanged();
|
||||
}
|
|
@ -1,252 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUIBUTTON_H
|
||||
#define UKUIBUTTON_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
using namespace UKUIGlobalDTConfig;
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUIButton : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(double radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
Q_PROPERTY(double leftRightMargin READ leftRightMargin WRITE setLeftRightMargin NOTIFY leftRightMarginChanged)
|
||||
Q_PROPERTY(double upDownMargin READ upDownMargin WRITE setUpDownMargin NOTIFY upDownMarginChanged)
|
||||
Q_PROPERTY(double space READ space WRITE setSpace NOTIFY spaceChanged)
|
||||
Q_PROPERTY(int normalWidth READ normalWidth WRITE setNormalWidth NOTIFY normalWidthChanged)
|
||||
Q_PROPERTY(int normalHeight READ normalHeight WRITE setNormalHeight NOTIFY normalHeightChanged)
|
||||
Q_PROPERTY(DTColor normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged)
|
||||
Q_PROPERTY(DTColor clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged)
|
||||
Q_PROPERTY(DTColor hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged)
|
||||
Q_PROPERTY(DTColor disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged)
|
||||
Q_PROPERTY(DTColor disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged)
|
||||
Q_PROPERTY(DTColor normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged)
|
||||
|
||||
|
||||
Q_PROPERTY(DTColor normalHBC READ normalHBC WRITE setNormalHBC NOTIFY normalHBCChanged)
|
||||
Q_PROPERTY(DTColor clickedHBC READ clickedHBC WRITE setClickedHBC NOTIFY clickedHBCChanged)
|
||||
Q_PROPERTY(DTColor hoveredHBC READ hoveredHBC WRITE setHoveredHBC NOTIFY hoveredHBCChanged)
|
||||
Q_PROPERTY(DTColor disableHBC READ disableHBC WRITE setDisableHBC NOTIFY disableHBCChanged)
|
||||
|
||||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
|
||||
Q_PROPERTY(int focusBorderWidth READ focusBorderWidth WRITE setFocusBorderWidth NOTIFY focusBorderWidthChanged)
|
||||
Q_PROPERTY(DTColor normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged)
|
||||
Q_PROPERTY(DTColor hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged)
|
||||
Q_PROPERTY(DTColor clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged)
|
||||
Q_PROPERTY(DTColor disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged)
|
||||
Q_PROPERTY(DTColor focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalBorderHColor READ normalBorderHColor WRITE setNormalBorderHColor NOTIFY normalBorderHColorChanged)
|
||||
Q_PROPERTY(DTColor hoverBorderHColor READ hoverBorderHColor WRITE setHoverBorderHColor NOTIFY hoverBorderHColorChanged)
|
||||
Q_PROPERTY(DTColor clickBorderHColor READ clickBorderHColor WRITE setClickBorderHColor NOTIFY clickBorderHColorChanged)
|
||||
Q_PROPERTY(DTColor disableBorderHColor READ disableBorderHColor WRITE setDisableBorderHColor NOTIFY disableBorderHColorChanged)
|
||||
|
||||
public:
|
||||
explicit UKUIButton(QQuickItem *parent = nullptr);
|
||||
~UKUIButton();
|
||||
|
||||
static UKUIButton* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
double radius() const;
|
||||
void setRadius(double newRadius);
|
||||
|
||||
double leftRightMargin() const;
|
||||
void setLeftRightMargin(double newMargin);
|
||||
|
||||
double upDownMargin() const;
|
||||
void setUpDownMargin(double newUpDownMargin);
|
||||
|
||||
double space() const;
|
||||
void setSpace(double newSpace);
|
||||
|
||||
int normalWidth() const;
|
||||
void setNormalWidth(int newNormalWidth);
|
||||
|
||||
int normalHeight() const;
|
||||
void setNormalHeight(int newNormalHeight);
|
||||
|
||||
DTColor normalBC() const;
|
||||
void setNormalBC(DTColor newNormalBC);
|
||||
|
||||
DTColor clickedBC() const;
|
||||
void setClickedBC(DTColor newClickedBC);
|
||||
|
||||
DTColor hoveredBC() const;
|
||||
void setHoveredBC(DTColor newHoveredBC);
|
||||
|
||||
DTColor disableBC() const;
|
||||
void setDisableBC(DTColor newDisableBC);
|
||||
|
||||
DTColor disableTextColor() const;
|
||||
void setDisableTextColor(DTColor newDisableTextColor);
|
||||
|
||||
DTColor normalTextColor() const;
|
||||
void setNormalTextColor(DTColor newNormalTextColor);
|
||||
|
||||
DTColor normalHBC() const;
|
||||
void setNormalHBC(DTColor newNormalHBC);
|
||||
|
||||
DTColor clickedHBC() const;
|
||||
void setClickedHBC(DTColor newClickedHBC);
|
||||
|
||||
DTColor hoveredHBC() const;
|
||||
void setHoveredHBC(DTColor newHoveredHBC);
|
||||
|
||||
DTColor disableHBC() const;
|
||||
void setDisableHBC(DTColor newDisableHBC);
|
||||
|
||||
int borderWidth() const;
|
||||
void setBorderWidth(int newBorderWidth);
|
||||
|
||||
DTColor normalBorderColor() const;
|
||||
void setNormalBorderColor(DTColor newNormalBorderColor);
|
||||
|
||||
DTColor hoverBorderColor() const;
|
||||
void setHoverBorderColor(DTColor newHoverBorderColor);
|
||||
|
||||
DTColor clickBorderColor() const;
|
||||
void setClickBorderColor(DTColor newClickBorderColor);
|
||||
|
||||
DTColor disableBorderColor() const;
|
||||
void setDisableBorderColor(DTColor newDisableBorderColor);
|
||||
|
||||
DTColor normalBorderHColor() const;
|
||||
void setNormalBorderHColor(DTColor newNormalBorderHColor);
|
||||
|
||||
DTColor hoverBorderHColor() const;
|
||||
void setHoverBorderHColor(DTColor newHoverBorderHColor);
|
||||
|
||||
DTColor clickBorderHColor() const;
|
||||
void setClickBorderHColor(DTColor newClickBorderHColor);
|
||||
|
||||
DTColor disableBorderHColor() const;
|
||||
void setDisableBorderHColor(DTColor newDisableBorderHColor);
|
||||
|
||||
DTColor focusBorderColor() const;
|
||||
void setFocusBorderColor(DTColor newFocusBorderColor);
|
||||
|
||||
int focusBorderWidth() const;
|
||||
void setFocusBorderWidth(int newFocusBorderWidth);
|
||||
|
||||
signals:
|
||||
void radiusChanged();
|
||||
|
||||
void leftRightMarginChanged();
|
||||
|
||||
void upDownMarginChanged();
|
||||
|
||||
void spaceChanged();
|
||||
|
||||
void normalWidthChanged();
|
||||
|
||||
void normalHeightChanged();
|
||||
|
||||
void normalBCChanged();
|
||||
|
||||
void clickedBCChanged();
|
||||
|
||||
void hoveredBCChanged();
|
||||
|
||||
void disableBCChanged();
|
||||
|
||||
void disableTextColorChanged();
|
||||
|
||||
void normalHBCChanged();
|
||||
|
||||
void clickedHBCChanged();
|
||||
|
||||
void hoveredHBCChanged();
|
||||
|
||||
void disableHBCChanged();
|
||||
|
||||
void borderWidthChanged();
|
||||
|
||||
void normalBorderColorChanged();
|
||||
|
||||
void hoverBorderColorChanged();
|
||||
|
||||
void clickBorderColorChanged();
|
||||
|
||||
void disableBorderColorChanged();
|
||||
|
||||
void normalBorderHColorChanged();
|
||||
|
||||
void hoverBorderHColorChanged();
|
||||
|
||||
void clickBorderHColorChanged();
|
||||
|
||||
void disableBorderHColorChanged();
|
||||
|
||||
void focusBorderColorChanged();
|
||||
|
||||
void focusBorderWidthChanged();
|
||||
|
||||
void normalTextColorChanged();
|
||||
|
||||
private:
|
||||
double m_radius = 6.0;
|
||||
double m_leftRightMargin = 10.0;
|
||||
double m_upDownMargin = 10.0;
|
||||
double m_space = 4.0;
|
||||
int m_normalWidth = 96;
|
||||
int m_normalHeight = 36;
|
||||
int m_borderWidth;
|
||||
int m_focusBorderWidth;
|
||||
|
||||
DTColor m_normalBC ;
|
||||
DTColor m_clickedBC ;
|
||||
DTColor m_hoveredBC ;
|
||||
DTColor m_disableBC ;
|
||||
DTColor m_disableTextColor ;
|
||||
DTColor m_normalTextColor ;
|
||||
DTColor m_normalHBC ;
|
||||
DTColor m_clickedHBC ;
|
||||
DTColor m_hoveredHBC ;
|
||||
DTColor m_disableHBC ;
|
||||
DTColor m_normalBorderColor ;
|
||||
DTColor m_hoverBorderColor ;
|
||||
DTColor m_clickBorderColor ;
|
||||
DTColor m_disableBorderColor ;
|
||||
DTColor m_normalBorderHColor ;
|
||||
DTColor m_hoverBorderHColor ;
|
||||
DTColor m_clickBorderHColor ;
|
||||
DTColor m_disableBorderHColor ;
|
||||
DTColor m_focusBorderColor ;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance ;
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIButton, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
//Q_DECLARE_METATYPE(UKUIQQC2Style::UKUIButton);
|
||||
//Q_DECLARE_METATYPE(std::shared_ptr<UKUIQQC2Style::UKUIButton>)
|
||||
|
||||
#endif // UKUIBUTTON_H
|
|
@ -1,496 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "ukuicheckbox.h"
|
||||
#include "qdebug.h"
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUICheckBox::UKUICheckBox(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
qDebug() << "UKUICheckBox..............";
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUICheckBox::~UKUICheckBox()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UKUICheckBox* UKUICheckBox::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUICheckBox(p);
|
||||
}
|
||||
|
||||
void UKUICheckBox::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setNormalTextColor(instance->kFontPrimary());
|
||||
setDisableTextColor(instance->kFontPrimaryDisable());
|
||||
setNormalIndicatorColor(instance->buttonActive());
|
||||
setHoverIndicatorColor(instance->kComponentHover());
|
||||
setClickIndicatorColor(instance->kComponentClick());
|
||||
setDisableIndicatorColor(instance->buttonDisable());
|
||||
setNormalIndicatorBorderColor(instance->kLineNormal());
|
||||
setHoverIndicatorBorderColor(instance->kLineNormal());
|
||||
setClickIndicatorBorderColor(instance->kLineNormal());
|
||||
setDisableIndicatorBorderColor(instance->kLineDisable());
|
||||
|
||||
setChecked_NormalIndicatorColor(instance->highLightActive());
|
||||
setChecked_HoverIndicatorColor(instance->kBrandHover());
|
||||
setChecked_ClickIndicatorColor(instance->kBrandClick());
|
||||
setChecked_DisableIndicatorColor(instance->buttonDisable());
|
||||
setChecked_NormalIndicatorBorderColor(instance->kLineNormal());
|
||||
setChecked_HoverIndicatorBorderColor(instance->kLineNormal());
|
||||
setChecked_ClickIndicatorBorderColor(instance->kLineNormal());
|
||||
setChecked_DisableIndicatorBorderColor(instance->kLineDisable());
|
||||
|
||||
setChecked_NormalChildrenColor(instance->highLightedTextActive());
|
||||
setChecked_HoverChildrenColor(instance->highLightedTextActive());
|
||||
setChecked_ClickChildrenColor(instance->highLightedTextActive());
|
||||
setChecked_DisableChildrenColor(instance->highLightedTextDisable());
|
||||
|
||||
setBorderWidth(instance->normalline());
|
||||
setSpace(8);
|
||||
setIndicatorWidth(16);
|
||||
setChildrenWidth(8);
|
||||
setRadius(instance->kradiusMin());
|
||||
}
|
||||
|
||||
|
||||
|
||||
double UKUICheckBox::leftRightMargin() const
|
||||
{
|
||||
return m_leftRightMargin;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setLeftRightMargin(double newLeftRightMargin)
|
||||
{
|
||||
if (qFuzzyCompare(m_leftRightMargin, newLeftRightMargin))
|
||||
return;
|
||||
m_leftRightMargin = newLeftRightMargin;
|
||||
emit leftRightMarginChanged();
|
||||
}
|
||||
|
||||
double UKUICheckBox::upDownMargin() const
|
||||
{
|
||||
return m_upDownMargin;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setUpDownMargin(double newUpDownMargin)
|
||||
{
|
||||
if (qFuzzyCompare(m_upDownMargin, newUpDownMargin))
|
||||
return;
|
||||
m_upDownMargin = newUpDownMargin;
|
||||
emit upDownMarginChanged();
|
||||
}
|
||||
|
||||
double UKUICheckBox::space() const
|
||||
{
|
||||
return m_space;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setSpace(double newSpace)
|
||||
{
|
||||
if (qFuzzyCompare(m_space, newSpace))
|
||||
return;
|
||||
m_space = newSpace;
|
||||
emit spaceChanged();
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::disableTextColor() const
|
||||
{
|
||||
return m_disableTextColor;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setDisableTextColor(DTColor newDisableTextColor)
|
||||
{
|
||||
if (m_disableTextColor != newDisableTextColor){
|
||||
m_disableTextColor = newDisableTextColor;
|
||||
emit disableTextColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::normalTextColor() const
|
||||
{
|
||||
return m_normalTextColor;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setNormalTextColor(DTColor newNormalTextColor)
|
||||
{
|
||||
if (m_normalTextColor != newNormalTextColor){
|
||||
m_normalTextColor = newNormalTextColor;
|
||||
emit normalTextColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::normalIndicatorColor() const
|
||||
{
|
||||
return m_normalIndicatorColor;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setNormalIndicatorColor(DTColor newNormalIndicatorColor)
|
||||
{
|
||||
if (m_normalIndicatorColor != newNormalIndicatorColor){
|
||||
m_normalIndicatorColor = newNormalIndicatorColor;
|
||||
emit normalIndicatorColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::hoverIndicatorColor() const
|
||||
{
|
||||
return m_hoverIndicatorColor;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setHoverIndicatorColor(DTColor newHoverIndicatorColor)
|
||||
{
|
||||
if (m_hoverIndicatorColor != newHoverIndicatorColor){
|
||||
m_hoverIndicatorColor = newHoverIndicatorColor;
|
||||
emit hoverIndicatorColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::clickIndicatorColor() const
|
||||
{
|
||||
return m_clickIndicatorColor;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setClickIndicatorColor(DTColor newClickIndicatorColor)
|
||||
{
|
||||
if (m_clickIndicatorColor != newClickIndicatorColor){
|
||||
m_clickIndicatorColor = newClickIndicatorColor;
|
||||
emit clickIndicatorColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::disableIndicatorColor() const
|
||||
{
|
||||
return m_disableIndicatorColor;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setDisableIndicatorColor(DTColor newDisableIndicatorColor)
|
||||
{
|
||||
if (m_disableIndicatorColor != newDisableIndicatorColor){
|
||||
m_disableIndicatorColor = newDisableIndicatorColor;
|
||||
emit disableIndicatorColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::normalIndicatorBorderColor() const
|
||||
{
|
||||
return m_normalIndicatorBorderColor;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setNormalIndicatorBorderColor(DTColor newNormalIndicatorBorderColor)
|
||||
{
|
||||
if (m_normalIndicatorBorderColor != newNormalIndicatorBorderColor){
|
||||
m_normalIndicatorBorderColor = newNormalIndicatorBorderColor;
|
||||
emit normalIndicatorBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::hoverIndicatorBorderColor() const
|
||||
{
|
||||
return m_hoverIndicatorBorderColor;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setHoverIndicatorBorderColor(DTColor newHoverIndicatorBorderColor)
|
||||
{
|
||||
if (m_hoverIndicatorBorderColor != newHoverIndicatorBorderColor){
|
||||
m_hoverIndicatorBorderColor = newHoverIndicatorBorderColor;
|
||||
emit hoverIndicatorBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::clickIndicatorBorderColor() const
|
||||
{
|
||||
return m_clickIndicatorBorderColor;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setClickIndicatorBorderColor(DTColor newClickIndicatorBorderColor)
|
||||
{
|
||||
if (m_clickIndicatorBorderColor != newClickIndicatorBorderColor){
|
||||
m_clickIndicatorBorderColor = newClickIndicatorBorderColor;
|
||||
emit clickIndicatorBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::disableIndicatorBorderColor() const
|
||||
{
|
||||
return m_disableIndicatorBorderColor;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setDisableIndicatorBorderColor(DTColor newDisableIndicatorBorderColor)
|
||||
{
|
||||
if (m_disableIndicatorBorderColor != newDisableIndicatorBorderColor){
|
||||
m_disableIndicatorBorderColor = newDisableIndicatorBorderColor;
|
||||
emit disableIndicatorBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_normalIndicatorColor() const
|
||||
{
|
||||
return m_checked_normalIndicatorColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_hoverIndicatorColor() const
|
||||
{
|
||||
return m_checked_hoverIndicatorColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_clickIndicatorColor() const
|
||||
{
|
||||
return m_checked_clickIndicatorColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_disableIndicatorColor() const
|
||||
{
|
||||
return m_checked_disableIndicatorColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_normalIndicatorBorderColor() const
|
||||
{
|
||||
return m_checked_normalIndicatorBorderColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_hoverIndicatorBorderColor() const
|
||||
{
|
||||
return m_checked_hoverIndicatorBorderColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_clickIndicatorBorderColor() const
|
||||
{
|
||||
return m_checked_clickIndicatorBorderColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_disableIndicatorBorderColor() const
|
||||
{
|
||||
return m_checked_disableIndicatorBorderColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_normalChildrenColor() const
|
||||
{
|
||||
return m_checked_normalChildrenColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_hoverChildrenColor() const
|
||||
{
|
||||
return m_checked_hoverChildrenColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_clickChildrenColor() const
|
||||
{
|
||||
return m_checked_clickChildrenColor;
|
||||
}
|
||||
|
||||
|
||||
DTColor UKUICheckBox::checked_disableChildrenColor() const
|
||||
{
|
||||
return m_checked_disableChildrenColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_normalChildrenBorderColor() const
|
||||
{
|
||||
return m_checked_normalChildrenBorderColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_hoverChildrenBorderColor() const
|
||||
{
|
||||
return m_checked_hoverChildrenBorderColor;
|
||||
}
|
||||
|
||||
DTColor UKUICheckBox::checked_clickChildrenBorderColor() const
|
||||
{
|
||||
return m_checked_clickChildrenBorderColor;
|
||||
}
|
||||
|
||||
|
||||
DTColor UKUICheckBox::checked_disableChildrenBorderColor() const
|
||||
{
|
||||
return m_checked_disableChildrenBorderColor;
|
||||
}
|
||||
|
||||
|
||||
void UKUICheckBox::setChecked_NormalIndicatorColor(DTColor newChecked_normalIndicatorColor)
|
||||
{
|
||||
if (m_checked_normalIndicatorColor != newChecked_normalIndicatorColor){
|
||||
m_checked_normalIndicatorColor = newChecked_normalIndicatorColor;
|
||||
emit checked_normalIndicatorColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_HoverIndicatorColor(DTColor newChecked_hoverIndicatorColor)
|
||||
{
|
||||
if (m_checked_hoverIndicatorColor != newChecked_hoverIndicatorColor){
|
||||
m_checked_hoverIndicatorColor = newChecked_hoverIndicatorColor;
|
||||
emit checked_hoverIndicatorColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_ClickIndicatorColor(DTColor newChecked_clickIndicatorColor)
|
||||
{
|
||||
if (m_checked_clickIndicatorColor != newChecked_clickIndicatorColor){
|
||||
m_checked_clickIndicatorColor = newChecked_clickIndicatorColor;
|
||||
emit checked_clickIndicatorColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_DisableIndicatorColor(DTColor newChecked_disableIndicatorColor)
|
||||
{
|
||||
if (m_checked_disableIndicatorColor != newChecked_disableIndicatorColor){
|
||||
m_checked_disableIndicatorColor = newChecked_disableIndicatorColor;
|
||||
emit checked_disableIndicatorColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_NormalIndicatorBorderColor(DTColor newChecked_normalIndicatorBorderColor)
|
||||
{
|
||||
if (m_checked_normalIndicatorBorderColor != newChecked_normalIndicatorBorderColor){
|
||||
m_checked_normalIndicatorBorderColor = newChecked_normalIndicatorBorderColor;
|
||||
emit checked_normalIndicatorBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_HoverIndicatorBorderColor(DTColor newChecked_hoverIndicatorBorderColor)
|
||||
{
|
||||
if (m_checked_hoverIndicatorBorderColor != newChecked_hoverIndicatorBorderColor){
|
||||
m_checked_hoverIndicatorBorderColor = newChecked_hoverIndicatorBorderColor;
|
||||
emit checked_hoverIndicatorBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_ClickIndicatorBorderColor(DTColor newChecked_clickIndicatorBorderColor)
|
||||
{
|
||||
if (m_checked_clickIndicatorBorderColor != newChecked_clickIndicatorBorderColor){
|
||||
m_checked_clickIndicatorBorderColor = newChecked_clickIndicatorBorderColor;
|
||||
emit checked_clickIndicatorBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_DisableIndicatorBorderColor(DTColor newChecked_disableIndicatorBorderColor)
|
||||
{
|
||||
if (m_checked_disableIndicatorBorderColor != newChecked_disableIndicatorBorderColor){
|
||||
m_checked_disableIndicatorBorderColor = newChecked_disableIndicatorBorderColor;
|
||||
emit checked_disableIndicatorBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_NormalChildrenColor(DTColor newChecked_normalChildrenColor)
|
||||
{
|
||||
if (m_checked_normalChildrenColor != newChecked_normalChildrenColor){
|
||||
m_checked_normalChildrenColor = newChecked_normalChildrenColor;
|
||||
emit checked_normalChildrenColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_HoverChildrenColor(DTColor newChecked_hoverChildrenColor)
|
||||
{
|
||||
if (m_checked_hoverChildrenColor != newChecked_hoverChildrenColor){
|
||||
m_checked_hoverChildrenColor = newChecked_hoverChildrenColor;
|
||||
emit checked_hoverChildrenColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_ClickChildrenColor(DTColor newChecked_clickChildrenColor)
|
||||
{
|
||||
if (m_checked_clickChildrenColor != newChecked_clickChildrenColor){
|
||||
m_checked_clickChildrenColor = newChecked_clickChildrenColor;
|
||||
emit checked_clickChildrenColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_DisableChildrenColor(DTColor newChecked_disableChildrenColor)
|
||||
{
|
||||
if (m_checked_disableChildrenColor != newChecked_disableChildrenColor){
|
||||
m_checked_disableChildrenColor = newChecked_disableChildrenColor;
|
||||
emit checked_disableChildrenColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_NormalChildrenBorderColor(DTColor newChecked_normalChildrenBorderColor)
|
||||
{
|
||||
if (m_checked_normalChildrenBorderColor != newChecked_normalChildrenBorderColor){
|
||||
m_checked_normalChildrenBorderColor = newChecked_normalChildrenBorderColor;
|
||||
emit checked_normalChildrenBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_HoverChildrenBorderColor(DTColor newChecked_hoverChildrenBorderColor)
|
||||
{
|
||||
if (m_checked_hoverChildrenBorderColor != newChecked_hoverChildrenBorderColor){
|
||||
m_checked_hoverChildrenBorderColor = newChecked_hoverChildrenBorderColor;
|
||||
emit checked_hoverChildrenBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_ClickChildrenBorderColor(DTColor newChecked_clickChildrenBorderColor)
|
||||
{
|
||||
if (m_checked_clickChildrenBorderColor != newChecked_clickChildrenBorderColor){
|
||||
m_checked_clickChildrenBorderColor = newChecked_clickChildrenBorderColor;
|
||||
emit checked_clickChildrenBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChecked_DisableChildrenBorderColor(DTColor newChecked_disableChildrenBorderColor)
|
||||
{
|
||||
if (m_checked_disableChildrenBorderColor != newChecked_disableChildrenBorderColor){
|
||||
m_checked_disableChildrenBorderColor = newChecked_disableChildrenBorderColor;
|
||||
emit checked_disableChildrenBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int UKUICheckBox::borderWidth() const
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setBorderWidth(int newBorderWidth)
|
||||
{
|
||||
if (m_borderWidth == newBorderWidth)
|
||||
return;
|
||||
m_borderWidth = newBorderWidth;
|
||||
emit borderWidthChanged();
|
||||
}
|
||||
|
||||
int UKUICheckBox::indicatorWidth() const
|
||||
{
|
||||
return m_indicatorWidth;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setIndicatorWidth(int newIndicatorWidth)
|
||||
{
|
||||
if (m_indicatorWidth == newIndicatorWidth)
|
||||
return;
|
||||
m_indicatorWidth = newIndicatorWidth;
|
||||
emit indicatorWidthChanged();
|
||||
}
|
||||
|
||||
int UKUICheckBox::childrenWidth() const
|
||||
{
|
||||
return m_childrenWidth;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setChildrenWidth(int newChildrenWidth)
|
||||
{
|
||||
if (m_childrenWidth == newChildrenWidth)
|
||||
return;
|
||||
m_childrenWidth = newChildrenWidth;
|
||||
emit childrenWidthChanged();
|
||||
}
|
||||
|
||||
int UKUICheckBox::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUICheckBox::setRadius(int newRadius)
|
||||
{
|
||||
if (m_radius == newRadius)
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit radiusChanged();
|
||||
}
|
|
@ -1,295 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUICHECKBOX_H
|
||||
#define UKUICHECKBOX_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUICheckBox : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(double leftRightMargin READ leftRightMargin WRITE setLeftRightMargin NOTIFY leftRightMarginChanged)
|
||||
Q_PROPERTY(double upDownMargin READ upDownMargin WRITE setUpDownMargin NOTIFY upDownMarginChanged)
|
||||
Q_PROPERTY(double space READ space WRITE setSpace NOTIFY spaceChanged)
|
||||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
|
||||
|
||||
|
||||
Q_PROPERTY(DTColor disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged)
|
||||
Q_PROPERTY(DTColor normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalIndicatorColor READ normalIndicatorColor WRITE setNormalIndicatorColor NOTIFY normalIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor hoverIndicatorColor READ hoverIndicatorColor WRITE setHoverIndicatorColor NOTIFY hoverIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor clickIndicatorColor READ clickIndicatorColor WRITE setClickIndicatorColor NOTIFY clickIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor disableIndicatorColor READ disableIndicatorColor WRITE setDisableIndicatorColor NOTIFY disableIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor normalIndicatorBorderColor READ normalIndicatorBorderColor WRITE setNormalIndicatorBorderColor NOTIFY normalIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor hoverIndicatorBorderColor READ hoverIndicatorBorderColor WRITE setHoverIndicatorBorderColor NOTIFY hoverIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor clickIndicatorBorderColor READ clickIndicatorBorderColor WRITE setClickIndicatorBorderColor NOTIFY clickIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor disableIndicatorBorderColor READ disableIndicatorBorderColor WRITE setDisableIndicatorBorderColor NOTIFY disableIndicatorBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor checked_normalIndicatorColor READ checked_normalIndicatorColor WRITE setChecked_NormalIndicatorColor NOTIFY checked_normalIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor checked_hoverIndicatorColor READ checked_hoverIndicatorColor WRITE setChecked_HoverIndicatorColor NOTIFY checked_hoverIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor checked_clickIndicatorColor READ checked_clickIndicatorColor WRITE setChecked_ClickIndicatorColor NOTIFY checked_clickIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor checked_disableIndicatorColor READ checked_disableIndicatorColor WRITE setChecked_DisableIndicatorColor NOTIFY checked_disableIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor checked_normalIndicatorBorderColor READ checked_normalIndicatorBorderColor WRITE setChecked_NormalIndicatorBorderColor NOTIFY checked_normalIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_hoverIndicatorBorderColor READ checked_hoverIndicatorBorderColor WRITE setChecked_HoverIndicatorBorderColor NOTIFY checked_hoverIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_clickIndicatorBorderColor READ checked_clickIndicatorBorderColor WRITE setChecked_ClickIndicatorBorderColor NOTIFY checked_clickIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_disableIndicatorBorderColor READ checked_disableIndicatorBorderColor WRITE setChecked_DisableIndicatorBorderColor NOTIFY checked_disableIndicatorBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor checked_normalChildrenColor READ checked_normalChildrenColor WRITE setChecked_NormalChildrenColor NOTIFY checked_normalChildrenColorChanged)
|
||||
Q_PROPERTY(DTColor checked_hoverChildrenColor READ checked_hoverChildrenColor WRITE setChecked_HoverChildrenColor NOTIFY checked_hoverChildrenColorChanged)
|
||||
Q_PROPERTY(DTColor checked_clickChildrenColor READ checked_clickChildrenColor WRITE setChecked_ClickChildrenColor NOTIFY checked_clickChildrenColorChanged)
|
||||
Q_PROPERTY(DTColor checked_disableChildrenColor READ checked_disableChildrenColor WRITE setChecked_DisableChildrenColor NOTIFY checked_disableChildrenColorChanged)
|
||||
Q_PROPERTY(DTColor checked_normalChildrenBorderColor READ checked_normalChildrenBorderColor WRITE setChecked_NormalChildrenBorderColor NOTIFY checked_normalChildrenBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_hoverChildrenBorderColor READ checked_hoverChildrenBorderColor WRITE setChecked_HoverChildrenBorderColor NOTIFY checked_hoverChildrenBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_clickChildrenBorderColor READ checked_clickChildrenBorderColor WRITE setChecked_ClickChildrenBorderColor NOTIFY checked_clickChildrenBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_disableChildrenBorderColor READ checked_disableChildrenBorderColor WRITE setChecked_DisableChildrenBorderColor NOTIFY checked_disableChildrenBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(int indicatorWidth READ indicatorWidth WRITE setIndicatorWidth NOTIFY indicatorWidthChanged)
|
||||
Q_PROPERTY(int childrenWidth READ childrenWidth WRITE setChildrenWidth NOTIFY childrenWidthChanged)
|
||||
Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
|
||||
|
||||
public:
|
||||
explicit UKUICheckBox(QQuickItem *parent = nullptr);
|
||||
~UKUICheckBox();
|
||||
|
||||
static UKUICheckBox* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
double leftRightMargin() const;
|
||||
void setLeftRightMargin(double newLeftRightMargin);
|
||||
|
||||
double upDownMargin() const;
|
||||
void setUpDownMargin(double newUpDownMargin);
|
||||
|
||||
double space() const;
|
||||
void setSpace(double newSpace);
|
||||
|
||||
DTColor disableTextColor() const;
|
||||
void setDisableTextColor(DTColor newDisableTextColor);
|
||||
|
||||
DTColor normalTextColor() const;
|
||||
void setNormalTextColor(DTColor newNormalTextColor);
|
||||
|
||||
DTColor normalIndicatorColor() const;
|
||||
void setNormalIndicatorColor(DTColor newNormalIndicatorColor);
|
||||
|
||||
DTColor hoverIndicatorColor() const;
|
||||
void setHoverIndicatorColor(DTColor newHoverIndicatorColor);
|
||||
|
||||
DTColor clickIndicatorColor() const;
|
||||
void setClickIndicatorColor(DTColor newClickIndicatorColor);
|
||||
|
||||
DTColor disableIndicatorColor() const;
|
||||
void setDisableIndicatorColor(DTColor newDisableIndicatorColor);
|
||||
|
||||
DTColor normalIndicatorBorderColor() const;
|
||||
void setNormalIndicatorBorderColor(DTColor newNormalIndicatorBorderColor);
|
||||
|
||||
DTColor hoverIndicatorBorderColor() const;
|
||||
void setHoverIndicatorBorderColor(DTColor newHoverIndicatorBorderColor);
|
||||
|
||||
DTColor clickIndicatorBorderColor() const;
|
||||
void setClickIndicatorBorderColor(DTColor newClickIndicatorBorderColor);
|
||||
|
||||
DTColor disableIndicatorBorderColor() const;
|
||||
void setDisableIndicatorBorderColor(DTColor newDisableIndicatorBorderColor);
|
||||
|
||||
DTColor checked_normalIndicatorColor() const;
|
||||
void setChecked_NormalIndicatorColor(DTColor newChecked_normalIndicatorColor);
|
||||
|
||||
DTColor checked_hoverIndicatorColor() const;
|
||||
void setChecked_HoverIndicatorColor(DTColor newChecked_hoverIndicatorColor);
|
||||
|
||||
DTColor checked_clickIndicatorColor() const;
|
||||
void setChecked_ClickIndicatorColor(DTColor newChecked_clickIndicatorColor);
|
||||
|
||||
DTColor checked_disableIndicatorColor() const;
|
||||
void setChecked_DisableIndicatorColor(DTColor newChecked_disableIndicatorColor);
|
||||
|
||||
DTColor checked_normalIndicatorBorderColor() const;
|
||||
void setChecked_NormalIndicatorBorderColor(DTColor newChecked_normalIndicatorBorderColor);
|
||||
|
||||
DTColor checked_hoverIndicatorBorderColor() const;
|
||||
void setChecked_HoverIndicatorBorderColor(DTColor newChecked_hoverIndicatorBorderColor);
|
||||
|
||||
DTColor checked_clickIndicatorBorderColor() const;
|
||||
void setChecked_ClickIndicatorBorderColor(DTColor newChecked_clickIndicatorBorderColor);
|
||||
|
||||
DTColor checked_disableIndicatorBorderColor() const;
|
||||
void setChecked_DisableIndicatorBorderColor(DTColor newChecked_disableIndicatorBorderColor);
|
||||
|
||||
DTColor checked_normalChildrenColor() const;
|
||||
void setChecked_NormalChildrenColor(DTColor newChecked_normalChildrenColor);
|
||||
|
||||
DTColor checked_hoverChildrenColor() const;
|
||||
void setChecked_HoverChildrenColor(DTColor newChecked_hoverChildrenColor);
|
||||
|
||||
DTColor checked_clickChildrenColor() const;
|
||||
void setChecked_ClickChildrenColor(DTColor newChecked_clickChildrenColor);
|
||||
|
||||
DTColor checked_disableChildrenColor() const;
|
||||
void setChecked_DisableChildrenColor(DTColor newChecked_disableChildrenColor);
|
||||
|
||||
DTColor checked_normalChildrenBorderColor() const;
|
||||
void setChecked_NormalChildrenBorderColor(DTColor newChecked_normalChildrenBorderColor);
|
||||
|
||||
DTColor checked_hoverChildrenBorderColor() const;
|
||||
void setChecked_HoverChildrenBorderColor(DTColor newChecked_hoverChildrenBorderColor);
|
||||
|
||||
DTColor checked_clickChildrenBorderColor() const;
|
||||
void setChecked_ClickChildrenBorderColor(DTColor newChecked_clickChildrenBorderColor);
|
||||
|
||||
DTColor checked_disableChildrenBorderColor() const;
|
||||
void setChecked_DisableChildrenBorderColor(DTColor newChecked_disableChildrenBorderColor);
|
||||
|
||||
int borderWidth() const;
|
||||
void setBorderWidth(int newBorderWidth);
|
||||
|
||||
int indicatorWidth() const;
|
||||
void setIndicatorWidth(int newIndicatorWidth);
|
||||
|
||||
int childrenWidth() const;
|
||||
void setChildrenWidth(int newChildrenWidth);
|
||||
|
||||
int radius() const;
|
||||
void setRadius(int newRadius);
|
||||
|
||||
signals:
|
||||
|
||||
void leftRightMarginChanged();
|
||||
|
||||
void upDownMarginChanged();
|
||||
|
||||
void spaceChanged();
|
||||
|
||||
void disableTextColorChanged();
|
||||
|
||||
void normalTextColorChanged();
|
||||
|
||||
void normalIndicatorColorChanged();
|
||||
|
||||
void hoverIndicatorColorChanged();
|
||||
|
||||
void clickIndicatorColorChanged();
|
||||
|
||||
void disableIndicatorColorChanged();
|
||||
|
||||
void normalIndicatorBorderColorChanged();
|
||||
|
||||
void hoverIndicatorBorderColorChanged();
|
||||
|
||||
void clickIndicatorBorderColorChanged();
|
||||
|
||||
void disableIndicatorBorderColorChanged();
|
||||
|
||||
void checked_normalIndicatorColorChanged();
|
||||
|
||||
void checked_hoverIndicatorColorChanged();
|
||||
|
||||
void checked_clickIndicatorColorChanged();
|
||||
|
||||
void checked_disableIndicatorColorChanged();
|
||||
|
||||
void checked_normalIndicatorBorderColorChanged();
|
||||
|
||||
void checked_hoverIndicatorBorderColorChanged();
|
||||
|
||||
void checked_clickIndicatorBorderColorChanged();
|
||||
|
||||
void checked_disableIndicatorBorderColorChanged();
|
||||
|
||||
void checked_normalChildrenColorChanged();
|
||||
|
||||
void checked_hoverChildrenColorChanged();
|
||||
|
||||
void checked_clickChildrenColorChanged();
|
||||
|
||||
void checked_disableChildrenColorChanged();
|
||||
|
||||
void checked_normalChildrenBorderColorChanged();
|
||||
|
||||
void checked_hoverChildrenBorderColorChanged();
|
||||
|
||||
void checked_clickChildrenBorderColorChanged();
|
||||
|
||||
void checked_disableChildrenBorderColorChanged();
|
||||
|
||||
void borderWidthChanged();
|
||||
|
||||
void indicatorWidthChanged();
|
||||
|
||||
void childrenWidthChanged();
|
||||
|
||||
void radiusChanged();
|
||||
|
||||
private:
|
||||
double m_leftRightMargin;
|
||||
double m_upDownMargin;
|
||||
double m_space;
|
||||
DTColor m_disableTextColor ;
|
||||
DTColor m_normalTextColor ;
|
||||
DTColor m_normalIndicatorColor ;
|
||||
DTColor m_hoverIndicatorColor ;
|
||||
DTColor m_clickIndicatorColor ;
|
||||
DTColor m_disableIndicatorColor ;
|
||||
DTColor m_normalIndicatorBorderColor ;
|
||||
DTColor m_hoverIndicatorBorderColor ;
|
||||
DTColor m_clickIndicatorBorderColor ;
|
||||
DTColor m_disableIndicatorBorderColor ;
|
||||
DTColor m_checked_normalIndicatorColor ;
|
||||
DTColor m_checked_hoverIndicatorColor ;
|
||||
DTColor m_checked_clickIndicatorColor ;
|
||||
DTColor m_checked_disableIndicatorColor ;
|
||||
DTColor m_checked_normalIndicatorBorderColor ;
|
||||
DTColor m_checked_hoverIndicatorBorderColor ;
|
||||
DTColor m_checked_clickIndicatorBorderColor ;
|
||||
DTColor m_checked_disableIndicatorBorderColor ;
|
||||
DTColor m_checked_normalChildrenColor ;
|
||||
DTColor m_checked_hoverChildrenColor ;
|
||||
DTColor m_checked_clickChildrenColor ;
|
||||
DTColor m_checked_disableChildrenColor ;
|
||||
DTColor m_checked_normalChildrenBorderColor ;
|
||||
DTColor m_checked_hoverChildrenBorderColor ;
|
||||
DTColor m_checked_clickChildrenBorderColor ;
|
||||
DTColor m_checked_disableChildrenBorderColor ;
|
||||
int m_borderWidth;
|
||||
int m_indicatorWidth;
|
||||
int m_childrenWidth;
|
||||
int m_radius;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance ;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUICheckBox, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
|
||||
#endif // UKUICHECKBOX_H
|
|
@ -1,278 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "ukuicombobox.h"
|
||||
#include "qdebug.h"
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUIComboBox::UKUIComboBox(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
qDebug() << "UKUIComboBox..............";
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUIComboBox::~UKUIComboBox()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UKUIComboBox* UKUIComboBox::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUIComboBox(p);
|
||||
}
|
||||
|
||||
void UKUIComboBox::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setLeftRightPadding(instance->kmarginNormal());
|
||||
setRadius(instance->kradiusNormal());
|
||||
setBorderWidth(instance->normalline());
|
||||
setFocusBorderWidth(instance->focusline());
|
||||
setNormalWidth(240);
|
||||
setNormalHeight(36);
|
||||
setNormalBC(instance->buttonActive());
|
||||
setNormalBorderColor(instance->kLineComponentNormal());
|
||||
setDisableBorderColor(instance->kLineComponentDisable());
|
||||
setFocusBorderColor(instance->kBrandFocus());
|
||||
setNormalTextColor(instance->buttonTextActive());
|
||||
setDisableTextColor(instance->buttonTextDisable());
|
||||
}
|
||||
|
||||
double UKUIComboBox::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setRadius(double newRadius)
|
||||
{
|
||||
if (qFuzzyCompare(m_radius, newRadius))
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit radiusChanged();
|
||||
}
|
||||
|
||||
double UKUIComboBox::leftRightPadding() const
|
||||
{
|
||||
return m_leftRightPadding;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setLeftRightPadding(double newLeftRightPadding)
|
||||
{
|
||||
if (qFuzzyCompare(m_leftRightPadding, newLeftRightPadding))
|
||||
return;
|
||||
m_leftRightPadding = newLeftRightPadding;
|
||||
emit leftRightPaddingChanged();
|
||||
}
|
||||
|
||||
double UKUIComboBox::upDownMargin() const
|
||||
{
|
||||
return m_upDownMargin;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setUpDownMargin(double newUpDownMargin)
|
||||
{
|
||||
if (qFuzzyCompare(m_upDownMargin, newUpDownMargin))
|
||||
return;
|
||||
m_upDownMargin = newUpDownMargin;
|
||||
emit upDownMarginChanged();
|
||||
}
|
||||
|
||||
double UKUIComboBox::space() const
|
||||
{
|
||||
return m_space;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setSpace(double newSpace)
|
||||
{
|
||||
if (qFuzzyCompare(m_space, newSpace))
|
||||
return;
|
||||
m_space = newSpace;
|
||||
emit spaceChange();
|
||||
}
|
||||
|
||||
int UKUIComboBox::normalWidth() const
|
||||
{
|
||||
return m_normalWidth;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setNormalWidth(int newNormalWidth)
|
||||
{
|
||||
if (m_normalWidth == newNormalWidth)
|
||||
return;
|
||||
m_normalWidth = newNormalWidth;
|
||||
emit normalWidthChanged();
|
||||
}
|
||||
|
||||
int UKUIComboBox::normalHeight() const
|
||||
{
|
||||
return m_normalHeight;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setNormalHeight(int newNormalHeight)
|
||||
{
|
||||
if (m_normalHeight == newNormalHeight)
|
||||
return;
|
||||
m_normalHeight = newNormalHeight;
|
||||
emit normalHeightChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIComboBox::normalBC() const
|
||||
{
|
||||
return m_normalBC;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setNormalBC(DTColor newNormalBC)
|
||||
{
|
||||
if (m_normalBC !=newNormalBC){
|
||||
m_normalBC = newNormalBC;
|
||||
emit normalBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIComboBox::clickedBC() const
|
||||
{
|
||||
return m_clickedBC;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setClickedBC(DTColor newClickedBC)
|
||||
{
|
||||
if (m_clickedBC != newClickedBC){
|
||||
m_clickedBC = newClickedBC;
|
||||
emit clickedBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIComboBox::hoveredBC() const
|
||||
{
|
||||
return m_hoveredBC;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setHoveredBC(DTColor newHoveredBC)
|
||||
{
|
||||
if (m_hoveredBC != newHoveredBC){
|
||||
m_hoveredBC = newHoveredBC;
|
||||
emit hoveredBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIComboBox::disableBC() const
|
||||
{
|
||||
return m_disableBC;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setDisableBC(DTColor newDisableBC)
|
||||
{
|
||||
if (m_disableBC != newDisableBC){
|
||||
m_disableBC = newDisableBC;
|
||||
emit disableBCChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIComboBox::disableTextColor() const
|
||||
{
|
||||
return m_disableTextColor;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setDisableTextColor(DTColor newDisableTextColor)
|
||||
{
|
||||
if (m_disableTextColor != newDisableTextColor){
|
||||
m_disableTextColor = newDisableTextColor;
|
||||
emit disableTextColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIComboBox::normalTextColor() const
|
||||
{
|
||||
return m_normalTextColor;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setNormalTextColor(DTColor newNormalTextColor)
|
||||
{
|
||||
if (m_normalTextColor != newNormalTextColor){
|
||||
m_normalTextColor = newNormalTextColor;
|
||||
emit normalTextColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int UKUIComboBox::borderWidth() const
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setBorderWidth(int newBorderWidth)
|
||||
{
|
||||
if (m_borderWidth == newBorderWidth)
|
||||
return;
|
||||
m_borderWidth = newBorderWidth;
|
||||
emit borderWidthChanged();
|
||||
}
|
||||
|
||||
int UKUIComboBox::focusBorderWidth() const
|
||||
{
|
||||
return m_focusBorderWidth;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setFocusBorderWidth(int newFocusBorderWidth)
|
||||
{
|
||||
if (m_focusBorderWidth == newFocusBorderWidth)
|
||||
return;
|
||||
m_focusBorderWidth = newFocusBorderWidth;
|
||||
emit focusBorderWidthChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIComboBox::normalBorderColor() const
|
||||
{
|
||||
return m_normalBorderColor;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setNormalBorderColor(DTColor newNormalBorderColor)
|
||||
{
|
||||
if (m_normalBorderColor != newNormalBorderColor){
|
||||
m_normalBorderColor = newNormalBorderColor;
|
||||
emit normalBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIComboBox::clickBorderColor() const
|
||||
{
|
||||
return m_clickBorderColor;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setClickBorderColor(DTColor newClickBorderColor)
|
||||
{
|
||||
if (m_clickBorderColor != newClickBorderColor){
|
||||
m_clickBorderColor = newClickBorderColor;
|
||||
emit clickBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIComboBox::disableBorderColor() const
|
||||
{
|
||||
return m_disableBorderColor;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setDisableBorderColor(DTColor newDisableBorderColor)
|
||||
{
|
||||
if (m_disableBorderColor != newDisableBorderColor){
|
||||
m_disableBorderColor = newDisableBorderColor;
|
||||
emit disableBorderColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DTColor UKUIComboBox::focusBorderColor() const
|
||||
{
|
||||
return m_focusBorderColor;
|
||||
}
|
||||
|
||||
void UKUIComboBox::setFocusBorderColor(DTColor newFocusBorderColor)
|
||||
{
|
||||
if (m_focusBorderColor != newFocusBorderColor){
|
||||
m_focusBorderColor = newFocusBorderColor;
|
||||
emit focusBorderColorChanged();
|
||||
}
|
||||
}
|
|
@ -1,189 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUICOMBOBOX_H
|
||||
#define UKUICOMBOBOX_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUIComboBox : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(double radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
Q_PROPERTY(double leftRightPadding READ leftRightPadding WRITE setLeftRightPadding NOTIFY leftRightPaddingChanged)
|
||||
Q_PROPERTY(double upDownMargin READ upDownMargin WRITE setUpDownMargin NOTIFY upDownMarginChanged)
|
||||
Q_PROPERTY(double space READ space WRITE setSpace NOTIFY spaceChange)
|
||||
|
||||
Q_PROPERTY(int normalWidth READ normalWidth WRITE setNormalWidth NOTIFY normalWidthChanged)
|
||||
Q_PROPERTY(int normalHeight READ normalHeight WRITE setNormalHeight NOTIFY normalHeightChanged)
|
||||
Q_PROPERTY(DTColor normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged)
|
||||
Q_PROPERTY(DTColor clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged)
|
||||
Q_PROPERTY(DTColor hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged)
|
||||
Q_PROPERTY(DTColor disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged)
|
||||
Q_PROPERTY(DTColor disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged)
|
||||
Q_PROPERTY(DTColor normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged)
|
||||
|
||||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
|
||||
Q_PROPERTY(int focusBorderWidth READ focusBorderWidth WRITE setFocusBorderWidth NOTIFY focusBorderWidthChanged)
|
||||
Q_PROPERTY(DTColor normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged)
|
||||
Q_PROPERTY(DTColor clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged)
|
||||
Q_PROPERTY(DTColor disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged)
|
||||
Q_PROPERTY(DTColor focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged)
|
||||
|
||||
|
||||
public:
|
||||
explicit UKUIComboBox(QQuickItem *parent = nullptr);
|
||||
~UKUIComboBox();
|
||||
|
||||
static UKUIComboBox* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
|
||||
double radius() const;
|
||||
void setRadius(double newRadius);
|
||||
|
||||
double leftRightPadding() const;
|
||||
void setLeftRightPadding(double newLeftRightPadding);
|
||||
|
||||
double upDownMargin() const;
|
||||
void setUpDownMargin(double newUpDownMargin);
|
||||
|
||||
double space() const;
|
||||
void setSpace(double newSpace);
|
||||
|
||||
int normalWidth() const;
|
||||
void setNormalWidth(int newNormalWidth);
|
||||
|
||||
int normalHeight() const;
|
||||
void setNormalHeight(int newNormalHeight);
|
||||
|
||||
DTColor normalBC() const;
|
||||
void setNormalBC(DTColor newNormalBC);
|
||||
|
||||
DTColor clickedBC() const;
|
||||
void setClickedBC(DTColor newClickedBC);
|
||||
|
||||
DTColor hoveredBC() const;
|
||||
void setHoveredBC(DTColor newHoveredBC);
|
||||
|
||||
DTColor disableBC() const;
|
||||
void setDisableBC(DTColor newDisableBC);
|
||||
|
||||
DTColor disableTextColor() const;
|
||||
void setDisableTextColor(DTColor newDisableTextColor);
|
||||
|
||||
DTColor normalTextColor() const;
|
||||
void setNormalTextColor(DTColor newNormalTextColor);
|
||||
|
||||
int borderWidth() const;
|
||||
void setBorderWidth(int newBorderWidth);
|
||||
|
||||
int focusBorderWidth() const;
|
||||
void setFocusBorderWidth(int newFocusBorderWidth);
|
||||
|
||||
DTColor normalBorderColor() const;
|
||||
void setNormalBorderColor(DTColor newNormalBorderColor);
|
||||
|
||||
DTColor clickBorderColor() const;
|
||||
void setClickBorderColor(DTColor newClickBorderColor);
|
||||
|
||||
DTColor disableBorderColor() const;
|
||||
void setDisableBorderColor(DTColor newDisableBorderColor);
|
||||
|
||||
DTColor focusBorderColor() const;
|
||||
void setFocusBorderColor(DTColor newFocusBorderColor);
|
||||
|
||||
signals:
|
||||
|
||||
void radiusChanged();
|
||||
|
||||
void leftRightPaddingChanged();
|
||||
|
||||
void upDownMarginChanged();
|
||||
|
||||
void spaceChange();
|
||||
|
||||
void normalWidthChanged();
|
||||
|
||||
void normalHeightChanged();
|
||||
|
||||
void normalBCChanged();
|
||||
|
||||
void clickedBCChanged();
|
||||
|
||||
void hoveredBCChanged();
|
||||
|
||||
void disableBCChanged();
|
||||
|
||||
void disableTextColorChanged();
|
||||
|
||||
void normalTextColorChanged();
|
||||
|
||||
void borderWidthChanged();
|
||||
|
||||
void focusBorderWidthChanged();
|
||||
|
||||
void normalBorderColorChanged();
|
||||
|
||||
void clickBorderColorChanged();
|
||||
|
||||
void disableBorderColorChanged();
|
||||
|
||||
void focusBorderColorChanged();
|
||||
|
||||
private:
|
||||
|
||||
double m_radius;
|
||||
double m_leftRightPadding;
|
||||
double m_upDownMargin;
|
||||
double m_space;
|
||||
int m_normalWidth;
|
||||
int m_normalHeight;
|
||||
int m_borderWidth;
|
||||
int m_focusBorderWidth;
|
||||
|
||||
DTColor m_normalBC ;
|
||||
DTColor m_clickedBC ;
|
||||
DTColor m_hoveredBC ;
|
||||
DTColor m_disableBC ;
|
||||
DTColor m_disableTextColor ;
|
||||
DTColor m_normalTextColor ;
|
||||
DTColor m_normalBorderColor ;
|
||||
DTColor m_clickBorderColor ;
|
||||
DTColor m_disableBorderColor ;
|
||||
DTColor m_focusBorderColor ;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance ;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIComboBox, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUICOMBOBOX_H
|
|
@ -1,203 +0,0 @@
|
|||
#include "ukuiitemdelegate.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUIItemDelegate::UKUIItemDelegate(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUIItemDelegate::~UKUIItemDelegate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setRadius(instance->kradiusNormal());
|
||||
setNormalTextColor(instance->textActive());
|
||||
setDisableTextColor(instance->textDisable());
|
||||
|
||||
setNormalBC(DTColor(QColor(0,0,0,0)));
|
||||
setClickedBC(instance->kContainClick());
|
||||
setHoveredBC(instance->kContainHover());
|
||||
setDisableBC(DTColor(QColor(0,0,0,0)));
|
||||
|
||||
setBorderWidth(1);
|
||||
setNormalBorderColor(instance->kLineComponentNormal());
|
||||
setClickBorderColor(instance->kLineComponentClick());
|
||||
setHoverBorderColor(instance->kLineComponentHover());
|
||||
setDisableBorderColor(instance->kLineComponentDisable());
|
||||
|
||||
}
|
||||
|
||||
|
||||
UKUIItemDelegate* UKUIItemDelegate::qmlAttachedProperties(QObject *parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUIItemDelegate(p);
|
||||
}
|
||||
|
||||
DTColor UKUIItemDelegate::normalTextColor() const
|
||||
{
|
||||
return m_normalTextColor;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setNormalTextColor(DTColor newNormalTextColor)
|
||||
{
|
||||
if (m_normalTextColor == newNormalTextColor)
|
||||
return;
|
||||
m_normalTextColor = newNormalTextColor;
|
||||
emit normalTextColorChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIItemDelegate::disableTextColor() const
|
||||
{
|
||||
return m_disableTextColor;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setDisableTextColor(DTColor newDisableTextColor)
|
||||
{
|
||||
if (m_disableTextColor == newDisableTextColor)
|
||||
return;
|
||||
m_disableTextColor = newDisableTextColor;
|
||||
emit disableTextColorChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIItemDelegate::normalBC() const
|
||||
{
|
||||
return m_normalBC;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setNormalBC(DTColor newNormalBC)
|
||||
{
|
||||
if (m_normalBC == newNormalBC)
|
||||
return;
|
||||
m_normalBC = newNormalBC;
|
||||
emit normalBCChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIItemDelegate::clickedBC() const
|
||||
{
|
||||
return m_clickedBC;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setClickedBC(DTColor newClickedBC)
|
||||
{
|
||||
if (m_clickedBC == newClickedBC)
|
||||
return;
|
||||
m_clickedBC = newClickedBC;
|
||||
emit clickedBCChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIItemDelegate::hoveredBC() const
|
||||
{
|
||||
return m_hoveredBC;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setHoveredBC(DTColor newHoveredBC)
|
||||
{
|
||||
if (m_hoveredBC == newHoveredBC)
|
||||
return;
|
||||
m_hoveredBC = newHoveredBC;
|
||||
emit hoveredBCChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIItemDelegate::disableBC() const
|
||||
{
|
||||
return m_disableBC;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setDisableBC(DTColor newDisableBC)
|
||||
{
|
||||
if (m_disableBC == newDisableBC)
|
||||
return;
|
||||
m_disableBC = newDisableBC;
|
||||
emit disableBCChanged();
|
||||
}
|
||||
|
||||
int UKUIItemDelegate::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setRadius(int newRadius)
|
||||
{
|
||||
if (m_radius == newRadius)
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit radiusChanged();
|
||||
}
|
||||
|
||||
int UKUIItemDelegate::borderWidth() const
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setBorderWidth(int newBorderWidth)
|
||||
{
|
||||
if (m_borderWidth == newBorderWidth)
|
||||
return;
|
||||
m_borderWidth = newBorderWidth;
|
||||
emit borderWidthChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIItemDelegate::normalBorderColor() const
|
||||
{
|
||||
return m_normalBorderColor;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setNormalBorderColor(DTColor newNormalBorderColor)
|
||||
{
|
||||
if (m_normalBorderColor == newNormalBorderColor)
|
||||
return;
|
||||
m_normalBorderColor = newNormalBorderColor;
|
||||
emit normalBorderColorChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIItemDelegate::hoverBorderColor() const
|
||||
{
|
||||
return m_hoverBorderColor;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setHoverBorderColor(DTColor newHoverBorderColor)
|
||||
{
|
||||
if (m_hoverBorderColor == newHoverBorderColor)
|
||||
return;
|
||||
m_hoverBorderColor = newHoverBorderColor;
|
||||
emit hoverBorderColorChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIItemDelegate::clickBorderColor() const
|
||||
{
|
||||
return m_clickBorderColor;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setClickBorderColor(DTColor newClickBorderColor)
|
||||
{
|
||||
if (m_clickBorderColor == newClickBorderColor)
|
||||
return;
|
||||
m_clickBorderColor = newClickBorderColor;
|
||||
emit clickBorderColorChanged();
|
||||
}
|
||||
|
||||
DTColor UKUIItemDelegate::disableBorderColor() const
|
||||
{
|
||||
return m_disableBorderColor;
|
||||
}
|
||||
|
||||
void UKUIItemDelegate::setDisableBorderColor(DTColor newDisableBorderColor)
|
||||
{
|
||||
if (m_disableBorderColor == newDisableBorderColor)
|
||||
return;
|
||||
m_disableBorderColor = newDisableBorderColor;
|
||||
emit disableBorderColorChanged();
|
||||
}
|
|
@ -1,147 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUIITEMDELEGATE_H
|
||||
#define UKUIITEMDELEGATE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUIItemDelegate : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged)
|
||||
Q_PROPERTY(DTColor disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged)
|
||||
Q_PROPERTY(DTColor normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged)
|
||||
Q_PROPERTY(DTColor clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged)
|
||||
Q_PROPERTY(DTColor hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged)
|
||||
Q_PROPERTY(DTColor disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged)
|
||||
|
||||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
|
||||
Q_PROPERTY(DTColor normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged)
|
||||
Q_PROPERTY(DTColor hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged)
|
||||
Q_PROPERTY(DTColor clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged)
|
||||
Q_PROPERTY(DTColor disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged)
|
||||
|
||||
public:
|
||||
explicit UKUIItemDelegate(QQuickItem *parent = nullptr);
|
||||
~UKUIItemDelegate();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUIItemDelegate* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
|
||||
DTColor normalTextColor() const;
|
||||
void setNormalTextColor(DTColor newNormalTextColor);
|
||||
|
||||
DTColor disableTextColor() const;
|
||||
void setDisableTextColor(DTColor newDisableTextColor);
|
||||
|
||||
DTColor normalBC() const;
|
||||
void setNormalBC(DTColor newNormalBC);
|
||||
|
||||
DTColor clickedBC() const;
|
||||
void setClickedBC(DTColor newClickedBC);
|
||||
|
||||
DTColor hoveredBC() const;
|
||||
void setHoveredBC(DTColor newHoveredBC);
|
||||
|
||||
DTColor disableBC() const;
|
||||
void setDisableBC(DTColor newDisableBC);
|
||||
|
||||
int radius() const;
|
||||
void setRadius(int newRadius);
|
||||
|
||||
int borderWidth() const;
|
||||
void setBorderWidth(int newBorderWidth);
|
||||
|
||||
DTColor normalBorderColor() const;
|
||||
void setNormalBorderColor(DTColor newNormalBorderColor);
|
||||
|
||||
DTColor hoverBorderColor() const;
|
||||
void setHoverBorderColor(DTColor newHoverBorderColor);
|
||||
|
||||
DTColor clickBorderColor() const;
|
||||
void setClickBorderColor(DTColor newClickBorderColor);
|
||||
|
||||
DTColor disableBorderColor() const;
|
||||
void setDisableBorderColor(DTColor newDisableBorderColor);
|
||||
|
||||
signals:
|
||||
|
||||
void normalTextColorChanged();
|
||||
|
||||
void disableTextColorChanged();
|
||||
|
||||
void normalBCChanged();
|
||||
|
||||
void clickedBCChanged();
|
||||
|
||||
void hoveredBCChanged();
|
||||
|
||||
void disableBCChanged();
|
||||
|
||||
void radiusChanged();
|
||||
|
||||
void borderWidthChanged();
|
||||
|
||||
void normalBorderColorChanged();
|
||||
|
||||
void hoverBorderColorChanged();
|
||||
|
||||
void clickBorderColorChanged();
|
||||
|
||||
void disableBorderColorChanged();
|
||||
|
||||
private:
|
||||
DTColor m_normalTextColor ;
|
||||
DTColor m_disableTextColor ;
|
||||
DTColor m_normalBC ;
|
||||
DTColor m_clickedBC ;
|
||||
DTColor m_hoveredBC ;
|
||||
DTColor m_disableBC ;
|
||||
DTColor m_normalBorderColor ;
|
||||
DTColor m_hoverBorderColor ;
|
||||
DTColor m_clickBorderColor ;
|
||||
DTColor m_disableBorderColor ;
|
||||
int m_radius;
|
||||
int m_borderWidth;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIItemDelegate, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUIITEMDELEGATE_H
|
|
@ -1,73 +0,0 @@
|
|||
#include "ukuilabel.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUILabel::UKUILabel(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUILabel::~UKUILabel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUILabel::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setNormalColor(instance->textActive());
|
||||
setDisableColor(instance->textDisable());
|
||||
}
|
||||
|
||||
UKUILabel* UKUILabel::qmlAttachedProperties(QObject *parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUILabel(p);
|
||||
}
|
||||
|
||||
const DTColor &UKUILabel::normalColor() const
|
||||
{
|
||||
return m_normalColor;
|
||||
}
|
||||
|
||||
void UKUILabel::setNormalColor(const DTColor &newNormalColor)
|
||||
{
|
||||
if (m_normalColor == newNormalColor)
|
||||
return;
|
||||
m_normalColor = newNormalColor;
|
||||
emit normalColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUILabel::linkColor() const
|
||||
{
|
||||
return m_linkColor;
|
||||
}
|
||||
|
||||
void UKUILabel::setLinkColor(const DTColor &newLinkColor)
|
||||
{
|
||||
if (m_linkColor == newLinkColor)
|
||||
return;
|
||||
m_linkColor = newLinkColor;
|
||||
emit linkColorChanged();
|
||||
}
|
||||
|
||||
|
||||
const DTColor &UKUILabel::disableColor() const
|
||||
{
|
||||
return m_disableColor;
|
||||
}
|
||||
|
||||
void UKUILabel::setDisableColor(const DTColor &newDisableColor)
|
||||
{
|
||||
if (m_disableColor == newDisableColor)
|
||||
return;
|
||||
m_disableColor = newDisableColor;
|
||||
emit disableColorChanged();
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUILABEL_H
|
||||
#define UKUILABEL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUILabel : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(DTColor normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged)
|
||||
Q_PROPERTY(DTColor disableColor READ disableColor WRITE setDisableColor NOTIFY disableColorChanged)
|
||||
Q_PROPERTY(DTColor linkColor READ linkColor WRITE setLinkColor NOTIFY linkColorChanged)
|
||||
|
||||
public:
|
||||
explicit UKUILabel(QQuickItem *parent = nullptr);
|
||||
~UKUILabel();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUILabel* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
const DTColor &normalColor() const;
|
||||
void setNormalColor(const DTColor &newNormalColor);
|
||||
const DTColor &linkColor() const;
|
||||
void setLinkColor(const DTColor &newLinkColor);
|
||||
|
||||
|
||||
const DTColor &disableColor() const;
|
||||
void setDisableColor(const DTColor &newDisableColor);
|
||||
|
||||
signals:
|
||||
void normalColorChanged();
|
||||
|
||||
void linkColorChanged();
|
||||
|
||||
void disableColorChanged();
|
||||
|
||||
private:
|
||||
DTColor m_normalColor = DTColor(QColor ::fromRgbF(0, 0, 0, 0.85));
|
||||
|
||||
DTColor m_linkColor = DTColor(Qt::blue);
|
||||
DTColor m_disableColor;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUILabel, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUILABEL_H
|
|
@ -1,143 +0,0 @@
|
|||
#include "ukuimenu.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUIMenu::UKUIMenu(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
qDebug() << "UKUIMenu..............";
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUIMenu::~UKUIMenu()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUIMenu::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setshadowNormalColor(instance->shadowActive());
|
||||
setshadowDisableColor(instance->shadowDisable());
|
||||
setNormalBC(instance->baseActive());
|
||||
setNormalBorderColor(instance->kLineWindowAcitive());
|
||||
setBorder(1);
|
||||
}
|
||||
|
||||
UKUIMenu* UKUIMenu::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUIMenu(p);
|
||||
}
|
||||
|
||||
int UKUIMenu::leftRightPadding() const
|
||||
{
|
||||
return m_leftRightPadding;
|
||||
}
|
||||
|
||||
void UKUIMenu::setLeftRightPadding(int newLeftRightPadding)
|
||||
{
|
||||
if (m_leftRightPadding == newLeftRightPadding)
|
||||
return;
|
||||
m_leftRightPadding = newLeftRightPadding;
|
||||
emit leftRightPaddingChanged();
|
||||
}
|
||||
|
||||
int UKUIMenu::topBottomPadding() const
|
||||
{
|
||||
return m_topBottomPadding;
|
||||
}
|
||||
|
||||
void UKUIMenu::setTopBottomPadding(int newTopBottomPadding)
|
||||
{
|
||||
if (m_topBottomPadding == newTopBottomPadding)
|
||||
return;
|
||||
m_topBottomPadding = newTopBottomPadding;
|
||||
emit topBottomPaddingChanged();
|
||||
}
|
||||
|
||||
|
||||
int UKUIMenu::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUIMenu::setRadius(int newRadius)
|
||||
{
|
||||
if (m_radius == newRadius)
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit radiusChanged();
|
||||
}
|
||||
|
||||
|
||||
const DTColor &UKUIMenu::shadowNormalColor() const
|
||||
{
|
||||
return m_shadowNormalColor;
|
||||
}
|
||||
|
||||
void UKUIMenu::setshadowNormalColor(const DTColor &newshadowNormalColor)
|
||||
{
|
||||
if (m_shadowNormalColor == newshadowNormalColor)
|
||||
return;
|
||||
m_shadowNormalColor = newshadowNormalColor;
|
||||
emit shadowNormalColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenu::shadowDisableColor() const
|
||||
{
|
||||
return m_shadowDisableColor;
|
||||
}
|
||||
|
||||
void UKUIMenu::setshadowDisableColor(const DTColor &newShadowDisableColor)
|
||||
{
|
||||
if (m_shadowDisableColor == newShadowDisableColor)
|
||||
return;
|
||||
m_shadowDisableColor = newShadowDisableColor;
|
||||
emit shadowDisableColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenu::normalBC() const
|
||||
{
|
||||
return m_normalBC;
|
||||
}
|
||||
|
||||
void UKUIMenu::setNormalBC(const DTColor &newNormalBC)
|
||||
{
|
||||
if (m_normalBC == newNormalBC)
|
||||
return;
|
||||
m_normalBC = newNormalBC;
|
||||
emit normalBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenu::normalBorderColor() const
|
||||
{
|
||||
return m_normalBorderColor;
|
||||
}
|
||||
|
||||
void UKUIMenu::setNormalBorderColor(const DTColor &newNormalBorderColor)
|
||||
{
|
||||
if (m_normalBorderColor == newNormalBorderColor)
|
||||
return;
|
||||
m_normalBorderColor = newNormalBorderColor;
|
||||
emit normalBorderColorChanged();
|
||||
}
|
||||
|
||||
int UKUIMenu::border() const
|
||||
{
|
||||
return m_border;
|
||||
}
|
||||
|
||||
void UKUIMenu::setBorder(int newBorder)
|
||||
{
|
||||
if (m_border == newBorder)
|
||||
return;
|
||||
m_border = newBorder;
|
||||
emit borderChanged();
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUIMENU_H
|
||||
#define UKUIMENU_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUIMenu : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int leftRightPadding READ leftRightPadding WRITE setLeftRightPadding NOTIFY leftRightPaddingChanged)
|
||||
Q_PROPERTY(int topBottomPadding READ topBottomPadding WRITE setTopBottomPadding NOTIFY topBottomPaddingChanged)
|
||||
Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
Q_PROPERTY(int border READ border WRITE setBorder NOTIFY borderChanged)
|
||||
Q_PROPERTY(DTColor shadowNormalColor READ shadowNormalColor WRITE setshadowNormalColor NOTIFY shadowNormalColorChanged)
|
||||
Q_PROPERTY(DTColor shadowDisableColor READ shadowDisableColor WRITE setshadowDisableColor NOTIFY shadowDisableColorChanged)
|
||||
Q_PROPERTY(DTColor normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged)
|
||||
Q_PROPERTY(DTColor normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged)
|
||||
|
||||
public:
|
||||
explicit UKUIMenu(QQuickItem *parent = nullptr);
|
||||
~UKUIMenu();
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUIMenu* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
int leftRightPadding() const;
|
||||
void setLeftRightPadding(int newLeftRightPadding);
|
||||
|
||||
int topBottomPadding() const;
|
||||
void setTopBottomPadding(int newTopBottomPadding);
|
||||
|
||||
int radius() const;
|
||||
void setRadius(int newRadius);
|
||||
|
||||
const DTColor &shadowNormalColor() const;
|
||||
void setshadowNormalColor(const DTColor &newshadowNormalColor);
|
||||
|
||||
const DTColor &shadowDisableColor() const;
|
||||
void setshadowDisableColor(const DTColor &newShadowDisableColor);
|
||||
|
||||
const DTColor &normalBC() const;
|
||||
void setNormalBC(const DTColor &newNormalBC);
|
||||
|
||||
const DTColor &normalBorderColor() const;
|
||||
void setNormalBorderColor(const DTColor &newNormalBorderColor);
|
||||
|
||||
int border() const;
|
||||
void setBorder(int newBorder);
|
||||
|
||||
signals:
|
||||
void leftRightPaddingChanged();
|
||||
|
||||
void topBottomPaddingChanged();
|
||||
|
||||
void radiusChanged();
|
||||
|
||||
void shadowNormalColorChanged();
|
||||
|
||||
void shadowDisableColorChanged();
|
||||
|
||||
void normalBCChanged();
|
||||
|
||||
void normalBorderColorChanged();
|
||||
|
||||
void borderChanged();
|
||||
|
||||
private:
|
||||
int m_leftRightPadding = 8;
|
||||
int m_topBottomPadding = 6;
|
||||
int m_radius = 8;
|
||||
DTColor m_shadowNormalColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.3));
|
||||
DTColor m_shadowDisableColor;
|
||||
DTColor m_normalBC;
|
||||
DTColor m_normalBorderColor;
|
||||
int m_border;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIMenu, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUIMENU_H
|
|
@ -1,265 +0,0 @@
|
|||
#include "ukuimenuitem.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUIMenuItem::UKUIMenuItem(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
qDebug() << "UKUIMenuItem..............";
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUIMenuItem::~UKUIMenuItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUIMenuItem::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setBorderWidth(1);
|
||||
setNormalBC(DTColor(QColor(0,0,0,0)));
|
||||
setHoveredBC(instance->kComponentHover());
|
||||
setClickedBC(instance->kComponentClick());
|
||||
setDisableBC(DTColor(QColor(0,0,0,0)));
|
||||
setNormalBorderColor(DTColor(QColor(0,0,0,0)));
|
||||
setHoverBorderColor(instance->kLineComponentHover());
|
||||
setClickBorderColor(instance->kLineComponentClick());
|
||||
setDisableBorderColor(DTColor(QColor(0,0,0,0)));
|
||||
setNormalTextColor(instance->kFontPrimary());
|
||||
setDisableTextColor(instance->kFontPrimaryDisable());
|
||||
}
|
||||
|
||||
UKUIMenuItem* UKUIMenuItem::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUIMenuItem(p);
|
||||
}
|
||||
|
||||
int UKUIMenuItem::leftRightPadding() const
|
||||
{
|
||||
return m_leftRightPadding;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setLeftRightPadding(int newLeftRightPadding)
|
||||
{
|
||||
if (m_leftRightPadding == newLeftRightPadding)
|
||||
return;
|
||||
m_leftRightPadding = newLeftRightPadding;
|
||||
emit leftRightPaddingChanged();
|
||||
}
|
||||
|
||||
int UKUIMenuItem::topBottomPadding() const
|
||||
{
|
||||
return m_topBottomPadding;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setTopBottomPadding(int newTopBottomPadding)
|
||||
{
|
||||
if (m_topBottomPadding == newTopBottomPadding)
|
||||
return;
|
||||
m_topBottomPadding = newTopBottomPadding;
|
||||
emit topBottomPaddingChanged();
|
||||
}
|
||||
|
||||
int UKUIMenuItem::imageWidth() const
|
||||
{
|
||||
return m_imageWidth;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setImageWidth(int newImageWidth)
|
||||
{
|
||||
if (m_imageWidth == newImageWidth)
|
||||
return;
|
||||
m_imageWidth = newImageWidth;
|
||||
emit imageWidthChanged();
|
||||
}
|
||||
|
||||
int UKUIMenuItem::imageSpace() const
|
||||
{
|
||||
return m_imageSpace;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setImageSpace(int newImageSpace)
|
||||
{
|
||||
if (m_imageSpace == newImageSpace)
|
||||
return;
|
||||
m_imageSpace = newImageSpace;
|
||||
emit imageSpaceChanged();
|
||||
}
|
||||
|
||||
int UKUIMenuItem::normalHeight() const
|
||||
{
|
||||
return m_normalHeight;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setNormalHeight(int newNormalHeight)
|
||||
{
|
||||
if (m_normalHeight == newNormalHeight)
|
||||
return;
|
||||
m_normalHeight = newNormalHeight;
|
||||
emit normalHeightChanged();
|
||||
}
|
||||
|
||||
int UKUIMenuItem::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setRadius(int newRadius)
|
||||
{
|
||||
if (m_radius == newRadius)
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit RadiusChanged();
|
||||
}
|
||||
|
||||
|
||||
const DTColor &UKUIMenuItem::normalBC() const
|
||||
{
|
||||
return m_normalBC;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setNormalBC(const DTColor &newNormalBC)
|
||||
{
|
||||
if (m_normalBC == newNormalBC)
|
||||
return;
|
||||
m_normalBC = newNormalBC;
|
||||
emit normalBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenuItem::clickedBC() const
|
||||
{
|
||||
return m_clickedBC;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setClickedBC(const DTColor &newClickedBC)
|
||||
{
|
||||
if (m_clickedBC == newClickedBC)
|
||||
return;
|
||||
m_clickedBC = newClickedBC;
|
||||
emit clickedBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenuItem::hoveredBC() const
|
||||
{
|
||||
return m_hoveredBC;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setHoveredBC(const DTColor &newHoveredBC)
|
||||
{
|
||||
if (m_hoveredBC == newHoveredBC)
|
||||
return;
|
||||
m_hoveredBC = newHoveredBC;
|
||||
emit hoveredBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenuItem::disableBC() const
|
||||
{
|
||||
return m_disableBC;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setDisableBC(const DTColor &newDisableBC)
|
||||
{
|
||||
if (m_disableBC == newDisableBC)
|
||||
return;
|
||||
m_disableBC = newDisableBC;
|
||||
emit disableBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenuItem::disableTextColor() const
|
||||
{
|
||||
return m_disableTextColor;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setDisableTextColor(const DTColor &newDisableTextColor)
|
||||
{
|
||||
if (m_disableTextColor == newDisableTextColor)
|
||||
return;
|
||||
m_disableTextColor = newDisableTextColor;
|
||||
emit disableTextColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenuItem::normalTextColor() const
|
||||
{
|
||||
return m_normalTextColor;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setNormalTextColor(const DTColor &newNormalTextColor)
|
||||
{
|
||||
if (m_normalTextColor == newNormalTextColor)
|
||||
return;
|
||||
m_normalTextColor = newNormalTextColor;
|
||||
emit disableTextColorChanged();
|
||||
}
|
||||
|
||||
int UKUIMenuItem::borderWidth() const
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setBorderWidth(int newBorderWidth)
|
||||
{
|
||||
if (m_borderWidth == newBorderWidth)
|
||||
return;
|
||||
m_borderWidth = newBorderWidth;
|
||||
emit borderWidthChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenuItem::normalBorderColor() const
|
||||
{
|
||||
return m_normalBorderColor;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setNormalBorderColor(const DTColor &newNormalBorderColor)
|
||||
{
|
||||
if (m_normalBorderColor == newNormalBorderColor)
|
||||
return;
|
||||
m_normalBorderColor = newNormalBorderColor;
|
||||
emit normalBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenuItem::hoverBorderColor() const
|
||||
{
|
||||
return m_hoverBorderColor;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setHoverBorderColor(const DTColor &newHoverBorderColor)
|
||||
{
|
||||
if (m_hoverBorderColor == newHoverBorderColor)
|
||||
return;
|
||||
m_hoverBorderColor = newHoverBorderColor;
|
||||
emit hoverBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenuItem::clickBorderColor() const
|
||||
{
|
||||
return m_clickBorderColor;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setClickBorderColor(const DTColor &newClickBorderColor)
|
||||
{
|
||||
if (m_clickBorderColor == newClickBorderColor)
|
||||
return;
|
||||
m_clickBorderColor = newClickBorderColor;
|
||||
emit clickBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIMenuItem::disableBorderColor() const
|
||||
{
|
||||
return m_disableBorderColor;
|
||||
}
|
||||
|
||||
void UKUIMenuItem::setDisableBorderColor(const DTColor &newDisableBorderColor)
|
||||
{
|
||||
if (m_disableBorderColor == newDisableBorderColor)
|
||||
return;
|
||||
m_disableBorderColor = newDisableBorderColor;
|
||||
emit disableBorderColorChanged();
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUIMENUITEM_H
|
||||
#define UKUIMENUITEM_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUIMenuItem : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int leftRightPadding READ leftRightPadding WRITE setLeftRightPadding NOTIFY leftRightPaddingChanged)
|
||||
Q_PROPERTY(int topBottomPadding READ topBottomPadding WRITE setTopBottomPadding NOTIFY topBottomPaddingChanged)
|
||||
Q_PROPERTY(int imageWidth READ imageWidth WRITE setImageWidth NOTIFY imageWidthChanged)
|
||||
Q_PROPERTY(int imageSpace READ imageSpace WRITE setImageSpace NOTIFY imageSpaceChanged)
|
||||
Q_PROPERTY(int normalHeight READ normalHeight WRITE setNormalHeight NOTIFY normalHeightChanged)
|
||||
Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY RadiusChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged)
|
||||
Q_PROPERTY(DTColor clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged)
|
||||
Q_PROPERTY(DTColor hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged)
|
||||
Q_PROPERTY(DTColor disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged)
|
||||
Q_PROPERTY(DTColor disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged)
|
||||
Q_PROPERTY(DTColor normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY disableTextColorChanged)
|
||||
|
||||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
|
||||
Q_PROPERTY(DTColor normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged)
|
||||
Q_PROPERTY(DTColor hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged)
|
||||
Q_PROPERTY(DTColor clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged)
|
||||
Q_PROPERTY(DTColor disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged)
|
||||
|
||||
public:
|
||||
explicit UKUIMenuItem(QQuickItem *parent = nullptr);
|
||||
~UKUIMenuItem();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUIMenuItem* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
int leftRightPadding() const;
|
||||
void setLeftRightPadding(int newLeftRightPadding);
|
||||
|
||||
int topBottomPadding() const;
|
||||
void setTopBottomPadding(int newTopBottomPadding);
|
||||
|
||||
int imageWidth() const;
|
||||
void setImageWidth(int newImageWidth);
|
||||
|
||||
int imageSpace() const;
|
||||
void setImageSpace(int newImageSpace);
|
||||
|
||||
int normalHeight() const;
|
||||
void setNormalHeight(int newNormalHeight);
|
||||
|
||||
int radius() const;
|
||||
void setRadius(int newRadius);
|
||||
|
||||
const DTColor &normalBC() const;
|
||||
void setNormalBC(const DTColor &newNormalBC);
|
||||
|
||||
const DTColor &clickedBC() const;
|
||||
void setClickedBC(const DTColor &newClickedBC);
|
||||
|
||||
const DTColor &hoveredBC() const;
|
||||
void setHoveredBC(const DTColor &newHoveredBC);
|
||||
|
||||
const DTColor &disableBC() const;
|
||||
void setDisableBC(const DTColor &newDisableBC);
|
||||
|
||||
const DTColor &disableTextColor() const;
|
||||
void setDisableTextColor(const DTColor &newDisableTextColor);
|
||||
|
||||
const DTColor &normalTextColor() const;
|
||||
void setNormalTextColor(const DTColor &newNormalTextColor);
|
||||
|
||||
int borderWidth() const;
|
||||
void setBorderWidth(int newBorderWidth);
|
||||
|
||||
const DTColor &normalBorderColor() const;
|
||||
void setNormalBorderColor(const DTColor &newNormalBorderColor);
|
||||
|
||||
const DTColor &hoverBorderColor() const;
|
||||
void setHoverBorderColor(const DTColor &newHoverBorderColor);
|
||||
|
||||
const DTColor &clickBorderColor() const;
|
||||
void setClickBorderColor(const DTColor &newClickBorderColor);
|
||||
|
||||
const DTColor &disableBorderColor() const;
|
||||
void setDisableBorderColor(const DTColor &newDisableBorderColor);
|
||||
|
||||
signals:
|
||||
void leftRightPaddingChanged();
|
||||
|
||||
void topBottomPaddingChanged();
|
||||
|
||||
void imageWidthChanged();
|
||||
|
||||
void imageSpaceChanged();
|
||||
|
||||
void normalHeightChanged();
|
||||
|
||||
void RadiusChanged();
|
||||
|
||||
void normalBCChanged();
|
||||
|
||||
void clickedBCChanged();
|
||||
|
||||
void hoveredBCChanged();
|
||||
|
||||
void disableBCChanged();
|
||||
|
||||
void disableTextColorChanged();
|
||||
|
||||
void borderWidthChanged();
|
||||
|
||||
void normalBorderColorChanged();
|
||||
|
||||
void hoverBorderColorChanged();
|
||||
|
||||
void clickBorderColorChanged();
|
||||
|
||||
void disableBorderColorChanged();
|
||||
|
||||
private:
|
||||
int m_leftRightPadding = 8;
|
||||
int m_topBottomPadding = 6;
|
||||
int m_imageWidth = 16;
|
||||
int m_imageSpace = 4;
|
||||
int m_normalHeight = 36;
|
||||
int m_radius = 8;
|
||||
DTColor m_normalBC;
|
||||
DTColor m_clickedBC;
|
||||
DTColor m_hoveredBC;
|
||||
DTColor m_disableBC;
|
||||
DTColor m_disableTextColor;
|
||||
DTColor m_normalTextColor;
|
||||
int m_borderWidth;
|
||||
DTColor m_normalBorderColor;
|
||||
DTColor m_hoverBorderColor;
|
||||
DTColor m_clickBorderColor;
|
||||
DTColor m_disableBorderColor;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIMenuItem, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUIMENUITEM_H
|
|
@ -1,115 +0,0 @@
|
|||
#include "ukuipopup.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUIPopup::UKUIPopup(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
qDebug() << "UKUIMenuItem..............";
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUIPopup::~UKUIPopup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUIPopup::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setBackColor(instance->baseActive());
|
||||
setBackBorderColor(instance->kLineWindowAcitive());
|
||||
setRadius(instance->kradiusMenu());
|
||||
//setShadowColor(instance->kShadowMenu());
|
||||
}
|
||||
|
||||
UKUIPopup* UKUIPopup::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUIPopup(p);
|
||||
}
|
||||
|
||||
const DTColor &UKUIPopup::normalColor() const
|
||||
{
|
||||
return m_normalColor;
|
||||
}
|
||||
|
||||
void UKUIPopup::setNormalColor(const DTColor &newNormalColor)
|
||||
{
|
||||
if (m_normalColor == newNormalColor)
|
||||
return;
|
||||
m_normalColor = newNormalColor;
|
||||
emit normalColorChanged();
|
||||
}
|
||||
|
||||
|
||||
int UKUIPopup::padding() const
|
||||
{
|
||||
return m_padding;
|
||||
}
|
||||
|
||||
void UKUIPopup::setPadding(int newPadding)
|
||||
{
|
||||
if (m_padding == newPadding)
|
||||
return;
|
||||
m_padding = newPadding;
|
||||
emit paddingChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIPopup::backColor() const
|
||||
{
|
||||
return m_backColor;
|
||||
}
|
||||
|
||||
void UKUIPopup::setBackColor(const DTColor &newBackColor)
|
||||
{
|
||||
if (m_backColor == newBackColor)
|
||||
return;
|
||||
m_backColor = newBackColor;
|
||||
emit backColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIPopup::backBorderColor() const
|
||||
{
|
||||
return m_backBorderColor;
|
||||
}
|
||||
|
||||
void UKUIPopup::setBackBorderColor(const DTColor &newBackBorderColor)
|
||||
{
|
||||
if (m_backBorderColor == newBackBorderColor)
|
||||
return;
|
||||
m_backBorderColor = newBackBorderColor;
|
||||
emit backBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIPopup::shadowColor() const
|
||||
{
|
||||
return m_shadowColor;
|
||||
}
|
||||
|
||||
void UKUIPopup::setShadowColor(const DTColor &newShadowColor)
|
||||
{
|
||||
if (m_shadowColor == newShadowColor)
|
||||
return;
|
||||
m_shadowColor = newShadowColor;
|
||||
emit shadowColorChanged();
|
||||
}
|
||||
|
||||
int UKUIPopup::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUIPopup::setRadius(int newRadius)
|
||||
{
|
||||
if (m_radius == newRadius)
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit radiusChanged();
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUIPOPUP_H
|
||||
#define UKUIPOPUP_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUIPopup : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged)
|
||||
Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged)
|
||||
Q_PROPERTY(DTColor backColor READ backColor WRITE setBackColor NOTIFY backColorChanged)
|
||||
Q_PROPERTY(DTColor backBorderColor READ backBorderColor WRITE setBackBorderColor NOTIFY backBorderColorChanged)
|
||||
Q_PROPERTY(DTColor shadowColor READ shadowColor WRITE setShadowColor NOTIFY shadowColorChanged)
|
||||
|
||||
public:
|
||||
explicit UKUIPopup(QQuickItem *parent = nullptr);
|
||||
~UKUIPopup();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUIPopup* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
const DTColor &normalColor() const;
|
||||
void setNormalColor(const DTColor &newNormalColor);
|
||||
|
||||
int padding() const;
|
||||
void setPadding(int newPadding);
|
||||
|
||||
const DTColor &backColor() const;
|
||||
void setBackColor(const DTColor &newBackColor);
|
||||
|
||||
const DTColor &backBorderColor() const;
|
||||
void setBackBorderColor(const DTColor &newBackBorderColor);
|
||||
|
||||
const DTColor &shadowColor() const;
|
||||
void setShadowColor(const DTColor &newShadowColor);
|
||||
|
||||
int radius() const;
|
||||
void setRadius(int newRadius);
|
||||
|
||||
signals:
|
||||
void normalColorChanged();
|
||||
|
||||
void paddingChanged();
|
||||
|
||||
void backColorChanged();
|
||||
|
||||
void backBorderColorChanged();
|
||||
|
||||
void shadowColorChanged();
|
||||
|
||||
void radiusChanged();
|
||||
|
||||
private:
|
||||
DTColor m_normalColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.85));
|
||||
|
||||
int m_padding = 12;
|
||||
DTColor m_backColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.85));
|
||||
DTColor m_backBorderColor = DTColor(QColor::fromRgbF(1, 1, 1));
|
||||
DTColor m_shadowColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.3));
|
||||
int m_radius;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIPopup, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUIPOPUP_H
|
|
@ -1,170 +0,0 @@
|
|||
#include "ukuiprogressbar.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUIProgressBar::UKUIProgressBar(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUIProgressBar::~UKUIProgressBar()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUIProgressBar::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setRadius(instance->kradiusNormal());
|
||||
setNormalColor(instance->kComponentNormal());
|
||||
setChildrenColor(instance->highLightActive());
|
||||
setNormalWidth(243);
|
||||
setNormalHeight(30);
|
||||
setIndeterminateChildrenWidth(56);
|
||||
setBorderWidth(1);
|
||||
setBorderColor(instance->kLineComponentNormal());
|
||||
|
||||
}
|
||||
|
||||
UKUIProgressBar* UKUIProgressBar::qmlAttachedProperties(QObject *parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUIProgressBar(p);
|
||||
}
|
||||
|
||||
const DTColor &UKUIProgressBar::normalColor() const
|
||||
{
|
||||
return m_normalColor;
|
||||
}
|
||||
|
||||
void UKUIProgressBar::setNormalColor(const DTColor &newNormalColor)
|
||||
{
|
||||
if (m_normalColor == newNormalColor)
|
||||
return;
|
||||
m_normalColor = newNormalColor;
|
||||
emit normalColorChanged();
|
||||
}
|
||||
|
||||
int UKUIProgressBar::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUIProgressBar::setRadius(int newRadius)
|
||||
{
|
||||
if (m_radius == newRadius)
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit radiusChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIProgressBar::childrenColor() const
|
||||
{
|
||||
return m_childrenColor;
|
||||
}
|
||||
|
||||
void UKUIProgressBar::setChildrenColor(const DTColor &newChildrenColor)
|
||||
{
|
||||
if (m_childrenColor == newChildrenColor)
|
||||
return;
|
||||
m_childrenColor = newChildrenColor;
|
||||
emit childrenColorChanged();
|
||||
}
|
||||
|
||||
int UKUIProgressBar::normalWidth() const
|
||||
{
|
||||
return m_normalWidth;
|
||||
}
|
||||
|
||||
void UKUIProgressBar::setNormalWidth(int newNormalWidth)
|
||||
{
|
||||
if (m_normalWidth == newNormalWidth)
|
||||
return;
|
||||
m_normalWidth = newNormalWidth;
|
||||
emit normalWidthChanged();
|
||||
}
|
||||
|
||||
int UKUIProgressBar::normalHeight() const
|
||||
{
|
||||
return m_normalHeight;
|
||||
}
|
||||
|
||||
void UKUIProgressBar::setNormalHeight(int newNormalHeight)
|
||||
{
|
||||
if (m_normalHeight == newNormalHeight)
|
||||
return;
|
||||
m_normalHeight = newNormalHeight;
|
||||
emit normalHeightChanged();
|
||||
}
|
||||
|
||||
int UKUIProgressBar::indeterminateChildrenWidth() const
|
||||
{
|
||||
return m_indeterminateChildrenWidth;
|
||||
}
|
||||
|
||||
void UKUIProgressBar::setIndeterminateChildrenWidth(int newIndeterminateChildrenWidth)
|
||||
{
|
||||
if (m_indeterminateChildrenWidth == newIndeterminateChildrenWidth)
|
||||
return;
|
||||
m_indeterminateChildrenWidth = newIndeterminateChildrenWidth;
|
||||
emit indeterminateChildrenWidthChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIProgressBar::indeterminateChildrenStartColor() const
|
||||
{
|
||||
return m_indeterminateChildrenStartColor;
|
||||
}
|
||||
|
||||
void UKUIProgressBar::setIndeterminateChildrenStartColor(const DTColor &newIndeterminateChildrenStartColor)
|
||||
{
|
||||
if (m_indeterminateChildrenStartColor == newIndeterminateChildrenStartColor)
|
||||
return;
|
||||
m_indeterminateChildrenStartColor = newIndeterminateChildrenStartColor;
|
||||
emit indeterminateChildrenStartColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIProgressBar::indeterminateChildrenEndColor() const
|
||||
{
|
||||
return m_indeterminateChildrenEndColor;
|
||||
}
|
||||
|
||||
void UKUIProgressBar::setIndeterminateChildrenEndColor(const DTColor &newIndeterminateChildrenEndColor)
|
||||
{
|
||||
if (m_indeterminateChildrenEndColor == newIndeterminateChildrenEndColor)
|
||||
return;
|
||||
m_indeterminateChildrenEndColor = newIndeterminateChildrenEndColor;
|
||||
emit indeterminateChildrenEndColorChanged();
|
||||
}
|
||||
|
||||
int UKUIProgressBar::borderWidth() const
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
|
||||
void UKUIProgressBar::setBorderWidth(int newBorderWidth)
|
||||
{
|
||||
if (m_borderWidth == newBorderWidth)
|
||||
return;
|
||||
m_borderWidth = newBorderWidth;
|
||||
emit borderWidthChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIProgressBar::borderColor() const
|
||||
{
|
||||
return m_borderColor;
|
||||
}
|
||||
|
||||
void UKUIProgressBar::setBorderColor(const DTColor &newBorderColor)
|
||||
{
|
||||
if (m_borderColor == newBorderColor)
|
||||
return;
|
||||
m_borderColor = newBorderColor;
|
||||
emit borderColorChanged();
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUIPROGRESSBAR_H
|
||||
#define UKUIPROGRESSBAR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUIProgressBar : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
Q_PROPERTY(DTColor normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged)
|
||||
Q_PROPERTY(DTColor childrenColor READ childrenColor WRITE setChildrenColor NOTIFY childrenColorChanged)
|
||||
Q_PROPERTY(int normalWidth READ normalWidth WRITE setNormalWidth NOTIFY normalWidthChanged)
|
||||
Q_PROPERTY(int normalHeight READ normalHeight WRITE setNormalHeight NOTIFY normalHeightChanged)
|
||||
Q_PROPERTY(int indeterminateChildrenWidth READ indeterminateChildrenWidth WRITE setIndeterminateChildrenWidth NOTIFY indeterminateChildrenWidthChanged)
|
||||
Q_PROPERTY(DTColor indeterminateChildrenStartColor READ indeterminateChildrenStartColor WRITE setIndeterminateChildrenStartColor NOTIFY indeterminateChildrenStartColorChanged)
|
||||
Q_PROPERTY(DTColor indeterminateChildrenEndColor READ indeterminateChildrenEndColor WRITE setIndeterminateChildrenEndColor NOTIFY indeterminateChildrenEndColorChanged)
|
||||
|
||||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
|
||||
Q_PROPERTY(DTColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
|
||||
public:
|
||||
explicit UKUIProgressBar(QQuickItem *parent = nullptr);
|
||||
~UKUIProgressBar();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUIProgressBar* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
const DTColor &normalColor() const;
|
||||
void setNormalColor(const DTColor &newNormalColor);
|
||||
|
||||
int radius() const;
|
||||
void setRadius(int newRadius);
|
||||
|
||||
const DTColor &childrenColor() const;
|
||||
void setChildrenColor(const DTColor &newChildrenColor);
|
||||
|
||||
int normalWidth() const;
|
||||
void setNormalWidth(int newNormalWidth);
|
||||
|
||||
int normalHeight() const;
|
||||
void setNormalHeight(int newNormalHeight);
|
||||
|
||||
int indeterminateChildrenWidth() const;
|
||||
void setIndeterminateChildrenWidth(int newIndeterminateChildrenWidth);
|
||||
|
||||
const DTColor &indeterminateChildrenStartColor() const;
|
||||
void setIndeterminateChildrenStartColor(const DTColor &newIndeterminateChildrenStartColor);
|
||||
|
||||
const DTColor &indeterminateChildrenEndColor() const;
|
||||
void setIndeterminateChildrenEndColor(const DTColor &newIndeterminateChildrenEndColor);
|
||||
|
||||
int borderWidth() const;
|
||||
void setBorderWidth(int newBorderWidth);
|
||||
|
||||
const DTColor &borderColor() const;
|
||||
void setBorderColor(const DTColor &newBorderColor);
|
||||
|
||||
signals:
|
||||
void normalColorChanged();
|
||||
|
||||
void radiusChanged();
|
||||
|
||||
void childrenColorChanged();
|
||||
|
||||
void normalWidthChanged();
|
||||
|
||||
void normalHeightChanged();
|
||||
|
||||
void indeterminateChildrenWidthChanged();
|
||||
|
||||
void indeterminateChildrenStartColorChanged();
|
||||
|
||||
void indeterminateChildrenEndColorChanged();
|
||||
|
||||
void borderWidthChanged();
|
||||
|
||||
void borderColorChanged();
|
||||
|
||||
private:
|
||||
DTColor m_normalColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.85));
|
||||
|
||||
int m_radius;
|
||||
DTColor m_childrenColor;
|
||||
int m_normalWidth;
|
||||
int m_normalHeight;
|
||||
int m_indeterminateChildrenWidth;
|
||||
DTColor m_indeterminateChildrenStartColor;
|
||||
DTColor m_indeterminateChildrenEndColor;
|
||||
int m_borderWidth;
|
||||
DTColor m_borderColor;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIProgressBar, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUIPROGRESSBAR_H
|
|
@ -1,482 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "ukuiradiobutton.h"
|
||||
#include "qdebug.h"
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUIRadioButton::UKUIRadioButton(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
qDebug() << "UKUIRadioButton..............";
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUIRadioButton::~UKUIRadioButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UKUIRadioButton* UKUIRadioButton::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUIRadioButton(p);
|
||||
}
|
||||
|
||||
void UKUIRadioButton::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setNormalTextColor(instance->kFontPrimary());
|
||||
setDisableTextColor(instance->kFontPrimaryDisable());
|
||||
setNormalIndicatorColor(instance->buttonActive());
|
||||
setHoverIndicatorColor(instance->kComponentHover());
|
||||
setClickIndicatorColor(instance->kComponentClick());
|
||||
setDisableIndicatorColor(instance->buttonDisable());
|
||||
setNormalIndicatorBorderColor(instance->kLineNormal());
|
||||
setHoverIndicatorBorderColor(instance->kLineNormal());
|
||||
setClickIndicatorBorderColor(instance->kLineNormal());
|
||||
setDisableIndicatorBorderColor(instance->kLineDisable());
|
||||
|
||||
setChecked_NormalIndicatorColor(instance->highLightActive());
|
||||
setChecked_HoverIndicatorColor(instance->kBrandHover());
|
||||
setChecked_ClickIndicatorColor(instance->kBrandClick());
|
||||
setChecked_DisableIndicatorColor(instance->buttonDisable());
|
||||
setChecked_NormalIndicatorBorderColor(instance->kLineNormal());
|
||||
setChecked_HoverIndicatorBorderColor(instance->kLineNormal());
|
||||
setChecked_ClickIndicatorBorderColor(instance->kLineNormal());
|
||||
setChecked_DisableIndicatorBorderColor(instance->kLineDisable());
|
||||
|
||||
setChecked_NormalChildrenColor(instance->highLightedTextActive());
|
||||
setChecked_HoverChildrenColor(instance->highLightedTextActive());
|
||||
setChecked_ClickChildrenColor(instance->highLightedTextActive());
|
||||
setChecked_DisableChildrenColor(instance->highLightedTextDisable());
|
||||
|
||||
setBorderWidth(instance->normalline());
|
||||
setSpace(8);
|
||||
setIndicatorWidth(16);
|
||||
setChildrenWidth(8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
double UKUIRadioButton::leftRightMargin() const
|
||||
{
|
||||
return m_leftRightMargin;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setLeftRightMargin(double newLeftRightMargin)
|
||||
{
|
||||
if (qFuzzyCompare(m_leftRightMargin, newLeftRightMargin))
|
||||
return;
|
||||
m_leftRightMargin = newLeftRightMargin;
|
||||
emit leftRightMarginChanged();
|
||||
}
|
||||
|
||||
double UKUIRadioButton::upDownMargin() const
|
||||
{
|
||||
return m_upDownMargin;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setUpDownMargin(double newUpDownMargin)
|
||||
{
|
||||
if (qFuzzyCompare(m_upDownMargin, newUpDownMargin))
|
||||
return;
|
||||
m_upDownMargin = newUpDownMargin;
|
||||
emit upDownMarginChanged();
|
||||
}
|
||||
|
||||
double UKUIRadioButton::space() const
|
||||
{
|
||||
return m_space;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setSpace(double newSpace)
|
||||
{
|
||||
if (qFuzzyCompare(m_space, newSpace))
|
||||
return;
|
||||
m_space = newSpace;
|
||||
emit spaceChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::disableTextColor() const
|
||||
{
|
||||
return m_disableTextColor;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setDisableTextColor(const DTColor &newDisableTextColor)
|
||||
{
|
||||
if (m_disableTextColor == newDisableTextColor)
|
||||
return;
|
||||
m_disableTextColor = newDisableTextColor;
|
||||
emit disableTextColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::normalTextColor() const
|
||||
{
|
||||
return m_normalTextColor;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setNormalTextColor(const DTColor &newNormalTextColor)
|
||||
{
|
||||
if (m_normalTextColor == newNormalTextColor)
|
||||
return;
|
||||
m_normalTextColor = newNormalTextColor;
|
||||
emit normalTextColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::normalIndicatorColor() const
|
||||
{
|
||||
return m_normalIndicatorColor;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setNormalIndicatorColor(const DTColor &newNormalIndicatorColor)
|
||||
{
|
||||
if (m_normalIndicatorColor == newNormalIndicatorColor)
|
||||
return;
|
||||
m_normalIndicatorColor = newNormalIndicatorColor;
|
||||
emit normalIndicatorColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::hoverIndicatorColor() const
|
||||
{
|
||||
return m_hoverIndicatorColor;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setHoverIndicatorColor(const DTColor &newHoverIndicatorColor)
|
||||
{
|
||||
if (m_hoverIndicatorColor == newHoverIndicatorColor)
|
||||
return;
|
||||
m_hoverIndicatorColor = newHoverIndicatorColor;
|
||||
emit hoverIndicatorColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::clickIndicatorColor() const
|
||||
{
|
||||
return m_clickIndicatorColor;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setClickIndicatorColor(const DTColor &newClickIndicatorColor)
|
||||
{
|
||||
if (m_clickIndicatorColor == newClickIndicatorColor)
|
||||
return;
|
||||
m_clickIndicatorColor = newClickIndicatorColor;
|
||||
emit clickIndicatorColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::disableIndicatorColor() const
|
||||
{
|
||||
return m_disableIndicatorColor;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setDisableIndicatorColor(const DTColor &newDisableIndicatorColor)
|
||||
{
|
||||
if (m_disableIndicatorColor == newDisableIndicatorColor)
|
||||
return;
|
||||
m_disableIndicatorColor = newDisableIndicatorColor;
|
||||
emit disableIndicatorColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::normalIndicatorBorderColor() const
|
||||
{
|
||||
return m_normalIndicatorBorderColor;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setNormalIndicatorBorderColor(const DTColor &newNormalIndicatorBorderColor)
|
||||
{
|
||||
if (m_normalIndicatorBorderColor == newNormalIndicatorBorderColor)
|
||||
return;
|
||||
m_normalIndicatorBorderColor = newNormalIndicatorBorderColor;
|
||||
emit normalIndicatorBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::hoverIndicatorBorderColor() const
|
||||
{
|
||||
return m_hoverIndicatorBorderColor;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setHoverIndicatorBorderColor(const DTColor &newHoverIndicatorBorderColor)
|
||||
{
|
||||
if (m_hoverIndicatorBorderColor == newHoverIndicatorBorderColor)
|
||||
return;
|
||||
m_hoverIndicatorBorderColor = newHoverIndicatorBorderColor;
|
||||
emit hoverIndicatorBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::clickIndicatorBorderColor() const
|
||||
{
|
||||
return m_clickIndicatorBorderColor;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setClickIndicatorBorderColor(const DTColor &newClickIndicatorBorderColor)
|
||||
{
|
||||
if (m_clickIndicatorBorderColor == newClickIndicatorBorderColor)
|
||||
return;
|
||||
m_clickIndicatorBorderColor = newClickIndicatorBorderColor;
|
||||
emit clickIndicatorBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::disableIndicatorBorderColor() const
|
||||
{
|
||||
return m_disableIndicatorBorderColor;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setDisableIndicatorBorderColor(const DTColor &newDisableIndicatorBorderColor)
|
||||
{
|
||||
if (m_disableIndicatorBorderColor == newDisableIndicatorBorderColor)
|
||||
return;
|
||||
m_disableIndicatorBorderColor = newDisableIndicatorBorderColor;
|
||||
emit disableIndicatorBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_normalIndicatorColor() const
|
||||
{
|
||||
return m_checked_normalIndicatorColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_hoverIndicatorColor() const
|
||||
{
|
||||
return m_checked_hoverIndicatorColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_clickIndicatorColor() const
|
||||
{
|
||||
return m_checked_clickIndicatorColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_disableIndicatorColor() const
|
||||
{
|
||||
return m_checked_disableIndicatorColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_normalIndicatorBorderColor() const
|
||||
{
|
||||
return m_checked_normalIndicatorBorderColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_hoverIndicatorBorderColor() const
|
||||
{
|
||||
return m_checked_hoverIndicatorBorderColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_clickIndicatorBorderColor() const
|
||||
{
|
||||
return m_checked_clickIndicatorBorderColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_disableIndicatorBorderColor() const
|
||||
{
|
||||
return m_checked_disableIndicatorBorderColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_normalChildrenColor() const
|
||||
{
|
||||
return m_checked_normalChildrenColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_hoverChildrenColor() const
|
||||
{
|
||||
return m_checked_hoverChildrenColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_clickChildrenColor() const
|
||||
{
|
||||
return m_checked_clickChildrenColor;
|
||||
}
|
||||
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_disableChildrenColor() const
|
||||
{
|
||||
return m_checked_disableChildrenColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_normalChildrenBorderColor() const
|
||||
{
|
||||
return m_checked_normalChildrenBorderColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_hoverChildrenBorderColor() const
|
||||
{
|
||||
return m_checked_hoverChildrenBorderColor;
|
||||
}
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_clickChildrenBorderColor() const
|
||||
{
|
||||
return m_checked_clickChildrenBorderColor;
|
||||
}
|
||||
|
||||
|
||||
const DTColor &UKUIRadioButton::checked_disableChildrenBorderColor() const
|
||||
{
|
||||
return m_checked_disableChildrenBorderColor;
|
||||
}
|
||||
|
||||
|
||||
void UKUIRadioButton::setChecked_NormalIndicatorColor(const DTColor &newChecked_normalIndicatorColor)
|
||||
{
|
||||
if (m_checked_normalIndicatorColor == newChecked_normalIndicatorColor)
|
||||
return;
|
||||
m_checked_normalIndicatorColor = newChecked_normalIndicatorColor;
|
||||
emit checked_normalIndicatorColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_HoverIndicatorColor(const DTColor &newChecked_hoverIndicatorColor)
|
||||
{
|
||||
if (m_checked_hoverIndicatorColor == newChecked_hoverIndicatorColor)
|
||||
return;
|
||||
m_checked_hoverIndicatorColor = newChecked_hoverIndicatorColor;
|
||||
emit checked_hoverIndicatorColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_ClickIndicatorColor(const DTColor &newChecked_clickIndicatorColor)
|
||||
{
|
||||
if (m_checked_clickIndicatorColor == newChecked_clickIndicatorColor)
|
||||
return;
|
||||
m_checked_clickIndicatorColor = newChecked_clickIndicatorColor;
|
||||
emit checked_clickIndicatorColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_DisableIndicatorColor(const DTColor &newChecked_disableIndicatorColor)
|
||||
{
|
||||
if (m_checked_disableIndicatorColor == newChecked_disableIndicatorColor)
|
||||
return;
|
||||
m_checked_disableIndicatorColor = newChecked_disableIndicatorColor;
|
||||
emit checked_disableIndicatorColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_NormalIndicatorBorderColor(const DTColor &newChecked_normalIndicatorBorderColor)
|
||||
{
|
||||
if (m_checked_normalIndicatorBorderColor == newChecked_normalIndicatorBorderColor)
|
||||
return;
|
||||
m_checked_normalIndicatorBorderColor = newChecked_normalIndicatorBorderColor;
|
||||
emit checked_normalIndicatorBorderColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_HoverIndicatorBorderColor(const DTColor &newChecked_hoverIndicatorBorderColor)
|
||||
{
|
||||
if (m_checked_hoverIndicatorBorderColor == newChecked_hoverIndicatorBorderColor)
|
||||
return;
|
||||
m_checked_hoverIndicatorBorderColor = newChecked_hoverIndicatorBorderColor;
|
||||
emit checked_hoverIndicatorBorderColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_ClickIndicatorBorderColor(const DTColor &newChecked_clickIndicatorBorderColor)
|
||||
{
|
||||
if (m_checked_clickIndicatorBorderColor == newChecked_clickIndicatorBorderColor)
|
||||
return;
|
||||
m_checked_clickIndicatorBorderColor = newChecked_clickIndicatorBorderColor;
|
||||
emit checked_clickIndicatorBorderColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_DisableIndicatorBorderColor(const DTColor &newChecked_disableIndicatorBorderColor)
|
||||
{
|
||||
if (m_checked_disableIndicatorBorderColor == newChecked_disableIndicatorBorderColor)
|
||||
return;
|
||||
m_checked_disableIndicatorBorderColor = newChecked_disableIndicatorBorderColor;
|
||||
emit checked_disableIndicatorBorderColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_NormalChildrenColor(const DTColor &newChecked_normalChildrenColor)
|
||||
{
|
||||
if (m_checked_normalChildrenColor == newChecked_normalChildrenColor)
|
||||
return;
|
||||
m_checked_normalChildrenColor = newChecked_normalChildrenColor;
|
||||
emit checked_normalChildrenColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_HoverChildrenColor(const DTColor &newChecked_hoverChildrenColor)
|
||||
{
|
||||
if (m_checked_hoverChildrenColor == newChecked_hoverChildrenColor)
|
||||
return;
|
||||
m_checked_hoverChildrenColor = newChecked_hoverChildrenColor;
|
||||
emit checked_hoverChildrenColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_ClickChildrenColor(const DTColor &newChecked_clickChildrenColor)
|
||||
{
|
||||
if (m_checked_clickChildrenColor == newChecked_clickChildrenColor)
|
||||
return;
|
||||
m_checked_clickChildrenColor = newChecked_clickChildrenColor;
|
||||
emit checked_clickChildrenColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_DisableChildrenColor(const DTColor &newChecked_disableChildrenColor)
|
||||
{
|
||||
if (m_checked_disableChildrenColor == newChecked_disableChildrenColor)
|
||||
return;
|
||||
m_checked_disableChildrenColor = newChecked_disableChildrenColor;
|
||||
emit checked_disableChildrenColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_NormalChildrenBorderColor(const DTColor &newChecked_normalChildrenBorderColor)
|
||||
{
|
||||
if (m_checked_normalChildrenBorderColor == newChecked_normalChildrenBorderColor)
|
||||
return;
|
||||
m_checked_normalChildrenBorderColor = newChecked_normalChildrenBorderColor;
|
||||
emit checked_normalChildrenBorderColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_HoverChildrenBorderColor(const DTColor &newChecked_hoverChildrenBorderColor)
|
||||
{
|
||||
if (m_checked_hoverChildrenBorderColor == newChecked_hoverChildrenBorderColor)
|
||||
return;
|
||||
m_checked_hoverChildrenBorderColor = newChecked_hoverChildrenBorderColor;
|
||||
emit checked_hoverChildrenBorderColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_ClickChildrenBorderColor(const DTColor &newChecked_clickChildrenBorderColor)
|
||||
{
|
||||
if (m_checked_clickChildrenBorderColor == newChecked_clickChildrenBorderColor)
|
||||
return;
|
||||
m_checked_clickChildrenBorderColor = newChecked_clickChildrenBorderColor;
|
||||
emit checked_clickChildrenBorderColorChanged();
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChecked_DisableChildrenBorderColor(const DTColor &newChecked_disableChildrenBorderColor)
|
||||
{
|
||||
if (m_checked_disableChildrenBorderColor == newChecked_disableChildrenBorderColor)
|
||||
return;
|
||||
m_checked_disableChildrenBorderColor = newChecked_disableChildrenBorderColor;
|
||||
emit checked_disableChildrenBorderColorChanged();
|
||||
}
|
||||
|
||||
int UKUIRadioButton::borderWidth() const
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setBorderWidth(int newBorderWidth)
|
||||
{
|
||||
if (m_borderWidth == newBorderWidth)
|
||||
return;
|
||||
m_borderWidth = newBorderWidth;
|
||||
emit borderWidthChanged();
|
||||
}
|
||||
|
||||
int UKUIRadioButton::indicatorWidth() const
|
||||
{
|
||||
return m_indicatorWidth;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setIndicatorWidth(int newIndicatorWidth)
|
||||
{
|
||||
if (m_indicatorWidth == newIndicatorWidth)
|
||||
return;
|
||||
m_indicatorWidth = newIndicatorWidth;
|
||||
emit indicatorWidthChanged();
|
||||
}
|
||||
|
||||
int UKUIRadioButton::childrenWidth() const
|
||||
{
|
||||
return m_childrenWidth;
|
||||
}
|
||||
|
||||
void UKUIRadioButton::setChildrenWidth(int newChildrenWidth)
|
||||
{
|
||||
if (m_childrenWidth == newChildrenWidth)
|
||||
return;
|
||||
m_childrenWidth = newChildrenWidth;
|
||||
emit childrenWidthChanged();
|
||||
}
|
|
@ -1,290 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUIRADIOBUTTON_H
|
||||
#define UKUIRADIOBUTTON_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUIRadioButton : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(double leftRightMargin READ leftRightMargin WRITE setLeftRightMargin NOTIFY leftRightMarginChanged)
|
||||
Q_PROPERTY(double upDownMargin READ upDownMargin WRITE setUpDownMargin NOTIFY upDownMarginChanged)
|
||||
Q_PROPERTY(double space READ space WRITE setSpace NOTIFY spaceChanged)
|
||||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
|
||||
|
||||
|
||||
Q_PROPERTY(DTColor disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged)
|
||||
Q_PROPERTY(DTColor normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalIndicatorColor READ normalIndicatorColor WRITE setNormalIndicatorColor NOTIFY normalIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor hoverIndicatorColor READ hoverIndicatorColor WRITE setHoverIndicatorColor NOTIFY hoverIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor clickIndicatorColor READ clickIndicatorColor WRITE setClickIndicatorColor NOTIFY clickIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor disableIndicatorColor READ disableIndicatorColor WRITE setDisableIndicatorColor NOTIFY disableIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor normalIndicatorBorderColor READ normalIndicatorBorderColor WRITE setNormalIndicatorBorderColor NOTIFY normalIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor hoverIndicatorBorderColor READ hoverIndicatorBorderColor WRITE setHoverIndicatorBorderColor NOTIFY hoverIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor clickIndicatorBorderColor READ clickIndicatorBorderColor WRITE setClickIndicatorBorderColor NOTIFY clickIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor disableIndicatorBorderColor READ disableIndicatorBorderColor WRITE setDisableIndicatorBorderColor NOTIFY disableIndicatorBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor checked_normalIndicatorColor READ checked_normalIndicatorColor WRITE setChecked_NormalIndicatorColor NOTIFY checked_normalIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor checked_hoverIndicatorColor READ checked_hoverIndicatorColor WRITE setChecked_HoverIndicatorColor NOTIFY checked_hoverIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor checked_clickIndicatorColor READ checked_clickIndicatorColor WRITE setChecked_ClickIndicatorColor NOTIFY checked_clickIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor checked_disableIndicatorColor READ checked_disableIndicatorColor WRITE setChecked_DisableIndicatorColor NOTIFY checked_disableIndicatorColorChanged)
|
||||
Q_PROPERTY(DTColor checked_normalIndicatorBorderColor READ checked_normalIndicatorBorderColor WRITE setChecked_NormalIndicatorBorderColor NOTIFY checked_normalIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_hoverIndicatorBorderColor READ checked_hoverIndicatorBorderColor WRITE setChecked_HoverIndicatorBorderColor NOTIFY checked_hoverIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_clickIndicatorBorderColor READ checked_clickIndicatorBorderColor WRITE setChecked_ClickIndicatorBorderColor NOTIFY checked_clickIndicatorBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_disableIndicatorBorderColor READ checked_disableIndicatorBorderColor WRITE setChecked_DisableIndicatorBorderColor NOTIFY checked_disableIndicatorBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor checked_normalChildrenColor READ checked_normalChildrenColor WRITE setChecked_NormalChildrenColor NOTIFY checked_normalChildrenColorChanged)
|
||||
Q_PROPERTY(DTColor checked_hoverChildrenColor READ checked_hoverChildrenColor WRITE setChecked_HoverChildrenColor NOTIFY checked_hoverChildrenColorChanged)
|
||||
Q_PROPERTY(DTColor checked_clickChildrenColor READ checked_clickChildrenColor WRITE setChecked_ClickChildrenColor NOTIFY checked_clickChildrenColorChanged)
|
||||
Q_PROPERTY(DTColor checked_disableChildrenColor READ checked_disableChildrenColor WRITE setChecked_DisableChildrenColor NOTIFY checked_disableChildrenColorChanged)
|
||||
Q_PROPERTY(DTColor checked_normalChildrenBorderColor READ checked_normalChildrenBorderColor WRITE setChecked_NormalChildrenBorderColor NOTIFY checked_normalChildrenBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_hoverChildrenBorderColor READ checked_hoverChildrenBorderColor WRITE setChecked_HoverChildrenBorderColor NOTIFY checked_hoverChildrenBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_clickChildrenBorderColor READ checked_clickChildrenBorderColor WRITE setChecked_ClickChildrenBorderColor NOTIFY checked_clickChildrenBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checked_disableChildrenBorderColor READ checked_disableChildrenBorderColor WRITE setChecked_DisableChildrenBorderColor NOTIFY checked_disableChildrenBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(int indicatorWidth READ indicatorWidth WRITE setIndicatorWidth NOTIFY indicatorWidthChanged)
|
||||
Q_PROPERTY(int childrenWidth READ childrenWidth WRITE setChildrenWidth NOTIFY childrenWidthChanged)
|
||||
|
||||
|
||||
public:
|
||||
explicit UKUIRadioButton(QQuickItem *parent = nullptr);
|
||||
~UKUIRadioButton();
|
||||
|
||||
static UKUIRadioButton* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
double leftRightMargin() const;
|
||||
void setLeftRightMargin(double newLeftRightMargin);
|
||||
|
||||
double upDownMargin() const;
|
||||
void setUpDownMargin(double newUpDownMargin);
|
||||
|
||||
double space() const;
|
||||
void setSpace(double newSpace);
|
||||
|
||||
const DTColor &disableTextColor() const;
|
||||
void setDisableTextColor(const DTColor &newDisableTextColor);
|
||||
|
||||
const DTColor &normalTextColor() const;
|
||||
void setNormalTextColor(const DTColor &newNormalTextColor);
|
||||
|
||||
const DTColor &normalIndicatorColor() const;
|
||||
void setNormalIndicatorColor(const DTColor &newNormalIndicatorColor);
|
||||
|
||||
const DTColor &hoverIndicatorColor() const;
|
||||
void setHoverIndicatorColor(const DTColor &newHoverIndicatorColor);
|
||||
|
||||
const DTColor &clickIndicatorColor() const;
|
||||
void setClickIndicatorColor(const DTColor &newClickIndicatorColor);
|
||||
|
||||
const DTColor &disableIndicatorColor() const;
|
||||
void setDisableIndicatorColor(const DTColor &newDisableIndicatorColor);
|
||||
|
||||
const DTColor &normalIndicatorBorderColor() const;
|
||||
void setNormalIndicatorBorderColor(const DTColor &newNormalIndicatorBorderColor);
|
||||
|
||||
const DTColor &hoverIndicatorBorderColor() const;
|
||||
void setHoverIndicatorBorderColor(const DTColor &newHoverIndicatorBorderColor);
|
||||
|
||||
const DTColor &clickIndicatorBorderColor() const;
|
||||
void setClickIndicatorBorderColor(const DTColor &newClickIndicatorBorderColor);
|
||||
|
||||
const DTColor &disableIndicatorBorderColor() const;
|
||||
void setDisableIndicatorBorderColor(const DTColor &newDisableIndicatorBorderColor);
|
||||
|
||||
const DTColor &checked_normalIndicatorColor() const;
|
||||
void setChecked_NormalIndicatorColor(const DTColor &newChecked_normalIndicatorColor);
|
||||
|
||||
const DTColor &checked_hoverIndicatorColor() const;
|
||||
void setChecked_HoverIndicatorColor(const DTColor &newChecked_hoverIndicatorColor);
|
||||
|
||||
const DTColor &checked_clickIndicatorColor() const;
|
||||
void setChecked_ClickIndicatorColor(const DTColor &newChecked_clickIndicatorColor);
|
||||
|
||||
const DTColor &checked_disableIndicatorColor() const;
|
||||
void setChecked_DisableIndicatorColor(const DTColor &newChecked_disableIndicatorColor);
|
||||
|
||||
const DTColor &checked_normalIndicatorBorderColor() const;
|
||||
void setChecked_NormalIndicatorBorderColor(const DTColor &newChecked_normalIndicatorBorderColor);
|
||||
|
||||
const DTColor &checked_hoverIndicatorBorderColor() const;
|
||||
void setChecked_HoverIndicatorBorderColor(const DTColor &newChecked_hoverIndicatorBorderColor);
|
||||
|
||||
const DTColor &checked_clickIndicatorBorderColor() const;
|
||||
void setChecked_ClickIndicatorBorderColor(const DTColor &newChecked_clickIndicatorBorderColor);
|
||||
|
||||
const DTColor &checked_disableIndicatorBorderColor() const;
|
||||
void setChecked_DisableIndicatorBorderColor(const DTColor &newChecked_disableIndicatorBorderColor);
|
||||
|
||||
const DTColor &checked_normalChildrenColor() const;
|
||||
void setChecked_NormalChildrenColor(const DTColor &newChecked_normalChildrenColor);
|
||||
|
||||
const DTColor &checked_hoverChildrenColor() const;
|
||||
void setChecked_HoverChildrenColor(const DTColor &newChecked_hoverChildrenColor);
|
||||
|
||||
const DTColor &checked_clickChildrenColor() const;
|
||||
void setChecked_ClickChildrenColor(const DTColor &newChecked_clickChildrenColor);
|
||||
|
||||
const DTColor &checked_disableChildrenColor() const;
|
||||
void setChecked_DisableChildrenColor(const DTColor &newChecked_disableChildrenColor);
|
||||
|
||||
const DTColor &checked_normalChildrenBorderColor() const;
|
||||
void setChecked_NormalChildrenBorderColor(const DTColor &newChecked_normalChildrenBorderColor);
|
||||
|
||||
const DTColor &checked_hoverChildrenBorderColor() const;
|
||||
void setChecked_HoverChildrenBorderColor(const DTColor &newChecked_hoverChildrenBorderColor);
|
||||
|
||||
const DTColor &checked_clickChildrenBorderColor() const;
|
||||
void setChecked_ClickChildrenBorderColor(const DTColor &newChecked_clickChildrenBorderColor);
|
||||
|
||||
const DTColor &checked_disableChildrenBorderColor() const;
|
||||
void setChecked_DisableChildrenBorderColor(const DTColor &newChecked_disableChildrenBorderColor);
|
||||
|
||||
int borderWidth() const;
|
||||
void setBorderWidth(int newBorderWidth);
|
||||
|
||||
int indicatorWidth() const;
|
||||
void setIndicatorWidth(int newIndicatorWidth);
|
||||
|
||||
int childrenWidth() const;
|
||||
void setChildrenWidth(int newChildrenWidth);
|
||||
|
||||
signals:
|
||||
|
||||
void leftRightMarginChanged();
|
||||
|
||||
void upDownMarginChanged();
|
||||
|
||||
void spaceChanged();
|
||||
|
||||
void disableTextColorChanged();
|
||||
|
||||
void normalTextColorChanged();
|
||||
|
||||
void normalIndicatorColorChanged();
|
||||
|
||||
void hoverIndicatorColorChanged();
|
||||
|
||||
void clickIndicatorColorChanged();
|
||||
|
||||
void disableIndicatorColorChanged();
|
||||
|
||||
void normalIndicatorBorderColorChanged();
|
||||
|
||||
void hoverIndicatorBorderColorChanged();
|
||||
|
||||
void clickIndicatorBorderColorChanged();
|
||||
|
||||
void disableIndicatorBorderColorChanged();
|
||||
|
||||
void checked_normalIndicatorColorChanged();
|
||||
|
||||
void checked_hoverIndicatorColorChanged();
|
||||
|
||||
void checked_clickIndicatorColorChanged();
|
||||
|
||||
void checked_disableIndicatorColorChanged();
|
||||
|
||||
void checked_normalIndicatorBorderColorChanged();
|
||||
|
||||
void checked_hoverIndicatorBorderColorChanged();
|
||||
|
||||
void checked_clickIndicatorBorderColorChanged();
|
||||
|
||||
void checked_disableIndicatorBorderColorChanged();
|
||||
|
||||
void checked_normalChildrenColorChanged();
|
||||
|
||||
void checked_hoverChildrenColorChanged();
|
||||
|
||||
void checked_clickChildrenColorChanged();
|
||||
|
||||
void checked_disableChildrenColorChanged();
|
||||
|
||||
void checked_normalChildrenBorderColorChanged();
|
||||
|
||||
void checked_hoverChildrenBorderColorChanged();
|
||||
|
||||
void checked_clickChildrenBorderColorChanged();
|
||||
|
||||
void checked_disableChildrenBorderColorChanged();
|
||||
|
||||
void borderWidthChanged();
|
||||
|
||||
void indicatorWidthChanged();
|
||||
|
||||
void childrenWidthChanged();
|
||||
|
||||
private:
|
||||
double m_leftRightMargin;
|
||||
double m_upDownMargin;
|
||||
double m_space;
|
||||
DTColor m_disableTextColor;
|
||||
DTColor m_normalTextColor;
|
||||
DTColor m_normalIndicatorColor;
|
||||
DTColor m_hoverIndicatorColor;
|
||||
DTColor m_clickIndicatorColor;
|
||||
DTColor m_disableIndicatorColor;
|
||||
DTColor m_normalIndicatorBorderColor;
|
||||
DTColor m_hoverIndicatorBorderColor;
|
||||
DTColor m_clickIndicatorBorderColor;
|
||||
DTColor m_disableIndicatorBorderColor;
|
||||
DTColor m_checked_normalIndicatorColor;
|
||||
DTColor m_checked_hoverIndicatorColor;
|
||||
DTColor m_checked_clickIndicatorColor;
|
||||
DTColor m_checked_disableIndicatorColor;
|
||||
DTColor m_checked_normalIndicatorBorderColor;
|
||||
DTColor m_checked_hoverIndicatorBorderColor;
|
||||
DTColor m_checked_clickIndicatorBorderColor;
|
||||
DTColor m_checked_disableIndicatorBorderColor;
|
||||
DTColor m_checked_normalChildrenColor;
|
||||
DTColor m_checked_hoverChildrenColor;
|
||||
DTColor m_checked_clickChildrenColor;
|
||||
DTColor m_checked_disableChildrenColor;
|
||||
DTColor m_checked_normalChildrenBorderColor;
|
||||
DTColor m_checked_hoverChildrenBorderColor;
|
||||
DTColor m_checked_clickChildrenBorderColor;
|
||||
DTColor m_checked_disableChildrenBorderColor;
|
||||
int m_borderWidth;
|
||||
int m_indicatorWidth;
|
||||
int m_childrenWidth;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIRadioButton, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
//Q_DECLARE_METATYPE(UKUIQQC2Style::UKUIButton);
|
||||
//Q_DECLARE_METATYPE(std::shared_ptr<UKUIQQC2Style::UKUIButton>)
|
||||
|
||||
#endif // UKUIRADIOBUTTON_H
|
|
@ -1,102 +0,0 @@
|
|||
#include "ukuiscrollbar.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUIScrollBar::UKUIScrollBar(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
UKUIScrollBar::~UKUIScrollBar()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUIScrollBar::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setNormalColor(instance->kGray6());
|
||||
setHoverColor(instance->kComponentHover());
|
||||
setClickColor(instance->kComponentClick());
|
||||
setDisableColor(instance->kGray3());
|
||||
}
|
||||
|
||||
UKUIScrollBar* UKUIScrollBar::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUIScrollBar(p);
|
||||
}
|
||||
|
||||
const DTColor &UKUIScrollBar::normalColor() const
|
||||
{
|
||||
return m_normalColor;
|
||||
}
|
||||
|
||||
void UKUIScrollBar::setNormalColor(const DTColor &newNormalColor)
|
||||
{
|
||||
if (m_normalColor == newNormalColor)
|
||||
return;
|
||||
m_normalColor = newNormalColor;
|
||||
emit normalColorChanged();
|
||||
}
|
||||
|
||||
|
||||
int UKUIScrollBar::padding() const
|
||||
{
|
||||
return m_padding;
|
||||
}
|
||||
|
||||
void UKUIScrollBar::setPadding(int newPadding)
|
||||
{
|
||||
if (m_padding == newPadding)
|
||||
return;
|
||||
m_padding = newPadding;
|
||||
emit paddingChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIScrollBar::hoverColor() const
|
||||
{
|
||||
return m_hoverColor;
|
||||
}
|
||||
|
||||
void UKUIScrollBar::setHoverColor(const DTColor &newHoverColor)
|
||||
{
|
||||
if (m_hoverColor == newHoverColor)
|
||||
return;
|
||||
m_hoverColor = newHoverColor;
|
||||
emit hoverColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIScrollBar::clickColor() const
|
||||
{
|
||||
return m_clickColor;
|
||||
}
|
||||
|
||||
void UKUIScrollBar::setClickColor(const DTColor &newClickColor)
|
||||
{
|
||||
if (m_clickColor == newClickColor)
|
||||
return;
|
||||
m_clickColor = newClickColor;
|
||||
emit clickColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIScrollBar::disableColor() const
|
||||
{
|
||||
return m_disableColor;
|
||||
}
|
||||
|
||||
void UKUIScrollBar::setDisableColor(const DTColor &newDisableColor)
|
||||
{
|
||||
if (m_disableColor == newDisableColor)
|
||||
return;
|
||||
m_disableColor = newDisableColor;
|
||||
emit disableColorChanged();
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUISCROLLBAR_H
|
||||
#define UKUISCROLLBAR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUIScrollBar : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(DTColor normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged)
|
||||
Q_PROPERTY(DTColor hoverColor READ hoverColor WRITE setHoverColor NOTIFY hoverColorChanged)
|
||||
Q_PROPERTY(DTColor clickColor READ clickColor WRITE setClickColor NOTIFY clickColorChanged)
|
||||
Q_PROPERTY(DTColor disableColor READ disableColor WRITE setDisableColor NOTIFY disableColorChanged)
|
||||
|
||||
Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged)
|
||||
|
||||
public:
|
||||
explicit UKUIScrollBar(QQuickItem *parent = nullptr);
|
||||
~UKUIScrollBar();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUIScrollBar* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
const DTColor &normalColor() const;
|
||||
void setNormalColor(const DTColor &newNormalColor);
|
||||
|
||||
int padding() const;
|
||||
void setPadding(int newPadding);
|
||||
|
||||
const DTColor &hoverColor() const;
|
||||
void setHoverColor(const DTColor &newHoverColor);
|
||||
|
||||
const DTColor &clickColor() const;
|
||||
void setClickColor(const DTColor &newClickColor);
|
||||
|
||||
const DTColor &disableColor() const;
|
||||
void setDisableColor(const DTColor &newDisableColor);
|
||||
|
||||
signals:
|
||||
void normalColorChanged();
|
||||
|
||||
void paddingChanged();
|
||||
|
||||
void hoverColorChanged();
|
||||
|
||||
void clickColorChanged();
|
||||
|
||||
void disableColorChanged();
|
||||
|
||||
private:
|
||||
DTColor m_normalColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.85));
|
||||
|
||||
int m_padding = 2;
|
||||
DTColor m_hoverColor;
|
||||
DTColor m_clickColor;
|
||||
DTColor m_disableColor;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIScrollBar, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUISCROLLBAR_H
|
|
@ -1,378 +0,0 @@
|
|||
#include "ukuislider.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUISlider::UKUISlider(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUISlider::~UKUISlider()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUISlider::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
if(!instance && qApp->property("qqc2-globaltoken").isValid()){
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
if(token){
|
||||
instance = token->getInstance();
|
||||
}
|
||||
}
|
||||
setNormalWidth(243);
|
||||
setNormalHeight(24);
|
||||
setGrooveHeight(4);
|
||||
setHandleHeight(20);
|
||||
setFocusBorderWidth(instance->focusline());
|
||||
setFocusBorderColor(instance->kBrandFocus());
|
||||
|
||||
setNormalGrooveColor(instance->kBrandClick());
|
||||
setDisableGrooveColor(instance->kGray12());
|
||||
setNormalGrooveBorderColor(instance->kLineBrandClick());
|
||||
setDisableGrooveBorderColor(instance->kLineBrandDisable());
|
||||
setGrooveBorderWidth(1);
|
||||
|
||||
setNormalUnGrooveColor(instance->buttonActive());
|
||||
setDisableUnGrooveColor(instance->buttonDisable());
|
||||
setNormalUnGrooveBorderColor(instance->kLineComponentNormal());
|
||||
setDisableUnGrooveColor(instance->kLineComponentDisable());
|
||||
|
||||
|
||||
setNormalHandleColor(instance->highLightActive());
|
||||
setHoverHandleColor(instance->kBrandHover());
|
||||
setClickHandleColor(instance->kBrandClick());
|
||||
setDisableHandleColor(instance->kGray11());
|
||||
setNormalHandleBorderColor(instance->kLineBrandNormal());
|
||||
setHoverHandleBorderColor(instance->kLineBrandNormal());
|
||||
setClickHandleBorderColor(instance->kLineBrandNormal());
|
||||
setDisableHandleBorderColor(instance->kLineBrandDisable());
|
||||
setHandleBorderWidth(1);
|
||||
}
|
||||
|
||||
UKUISlider* UKUISlider::qmlAttachedProperties(QObject *parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUISlider(p);
|
||||
}
|
||||
|
||||
|
||||
int UKUISlider::normalWidth() const
|
||||
{
|
||||
return m_normalWidth;
|
||||
}
|
||||
|
||||
void UKUISlider::setNormalWidth(int newNormalWidth)
|
||||
{
|
||||
if (m_normalWidth == newNormalWidth)
|
||||
return;
|
||||
m_normalWidth = newNormalWidth;
|
||||
emit normalWidthChanged();
|
||||
}
|
||||
|
||||
int UKUISlider::normalHeight() const
|
||||
{
|
||||
return m_normalHeight;
|
||||
}
|
||||
|
||||
void UKUISlider::setNormalHeight(int newNormalHeight)
|
||||
{
|
||||
if (m_normalHeight == newNormalHeight)
|
||||
return;
|
||||
m_normalHeight = newNormalHeight;
|
||||
emit normalHeightChanged();
|
||||
}
|
||||
|
||||
int UKUISlider::grooveHeight() const
|
||||
{
|
||||
return m_grooveHeight;
|
||||
}
|
||||
|
||||
void UKUISlider::setGrooveHeight(int newGrooveHeight)
|
||||
{
|
||||
if (m_grooveHeight == newGrooveHeight)
|
||||
return;
|
||||
m_grooveHeight = newGrooveHeight;
|
||||
emit grooveHeightChanged();
|
||||
}
|
||||
|
||||
int UKUISlider::handleHeight() const
|
||||
{
|
||||
return m_handleHeight;
|
||||
}
|
||||
|
||||
void UKUISlider::setHandleHeight(int newHandleHeight)
|
||||
{
|
||||
if (m_handleHeight == newHandleHeight)
|
||||
return;
|
||||
m_handleHeight = newHandleHeight;
|
||||
emit handleHeightChanged();
|
||||
}
|
||||
|
||||
int UKUISlider::focusBorderWidth() const
|
||||
{
|
||||
return m_focusBorderWidth;
|
||||
}
|
||||
|
||||
void UKUISlider::setFocusBorderWidth(int newFocusBorderWidth)
|
||||
{
|
||||
if (m_focusBorderWidth == newFocusBorderWidth)
|
||||
return;
|
||||
m_focusBorderWidth = newFocusBorderWidth;
|
||||
emit focusBorderWidthChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::focusBorderColor() const
|
||||
{
|
||||
return m_focusBorderColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setFocusBorderColor(const DTColor &newFocusBorderColor)
|
||||
{
|
||||
if (m_focusBorderColor == newFocusBorderColor)
|
||||
return;
|
||||
m_focusBorderColor = newFocusBorderColor;
|
||||
emit focusBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::normalGrooveColor() const
|
||||
{
|
||||
return m_normalGrooveColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setNormalGrooveColor(const DTColor &newNormalGrooveColor)
|
||||
{
|
||||
if (m_normalGrooveColor == newNormalGrooveColor)
|
||||
return;
|
||||
m_normalGrooveColor = newNormalGrooveColor;
|
||||
emit normalGrooveColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::disableGrooveColor() const
|
||||
{
|
||||
return m_disableGrooveColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setDisableGrooveColor(const DTColor &newDisableGrooveColor)
|
||||
{
|
||||
if (m_disableGrooveColor == newDisableGrooveColor)
|
||||
return;
|
||||
m_disableGrooveColor = newDisableGrooveColor;
|
||||
emit disableGrooveColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::normalHandleColor() const
|
||||
{
|
||||
return m_normalHandleColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setNormalHandleColor(const DTColor &newNormalHandleColor)
|
||||
{
|
||||
if (m_normalHandleColor == newNormalHandleColor)
|
||||
return;
|
||||
m_normalHandleColor = newNormalHandleColor;
|
||||
emit normalHandleColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::disableHandleColor() const
|
||||
{
|
||||
return m_disableHandleColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setDisableHandleColor(const DTColor &newDisableHandleColor)
|
||||
{
|
||||
if (m_disableHandleColor == newDisableHandleColor)
|
||||
return;
|
||||
m_disableHandleColor = newDisableHandleColor;
|
||||
emit DisableHandleColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::normalGrooveBorderColor() const
|
||||
{
|
||||
return m_normalGrooveBorderColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setNormalGrooveBorderColor(const DTColor &newNormalGrooveBorderColor)
|
||||
{
|
||||
if (m_normalGrooveBorderColor == newNormalGrooveBorderColor)
|
||||
return;
|
||||
m_normalGrooveBorderColor = newNormalGrooveBorderColor;
|
||||
emit normalGrooveBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::disableGrooveBorderColor() const
|
||||
{
|
||||
return m_disableGrooveBorderColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setDisableGrooveBorderColor(const DTColor &newDisableGrooveBorderColor)
|
||||
{
|
||||
if (m_disableGrooveBorderColor == newDisableGrooveBorderColor)
|
||||
return;
|
||||
m_disableGrooveBorderColor = newDisableGrooveBorderColor;
|
||||
emit disableGrooveBorderColorChanged();
|
||||
}
|
||||
|
||||
int UKUISlider::grooveBorderWidth() const
|
||||
{
|
||||
return m_grooveBorderWidth;
|
||||
}
|
||||
|
||||
void UKUISlider::setGrooveBorderWidth(int newGrooveBorderWidth)
|
||||
{
|
||||
if (m_grooveBorderWidth == newGrooveBorderWidth)
|
||||
return;
|
||||
m_grooveBorderWidth = newGrooveBorderWidth;
|
||||
emit grooveBorderWidthChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::normalHandleBorderColor() const
|
||||
{
|
||||
return m_normalHandleBorderColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setNormalHandleBorderColor(const DTColor &newNormalHandleBorderColor)
|
||||
{
|
||||
if (m_normalHandleBorderColor == newNormalHandleBorderColor)
|
||||
return;
|
||||
m_normalHandleBorderColor = newNormalHandleBorderColor;
|
||||
emit normalHandleBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::disableHandleBorderColor() const
|
||||
{
|
||||
return m_disableHandleBorderColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setDisableHandleBorderColor(const DTColor &newDisableHandleBorderColor)
|
||||
{
|
||||
if (m_disableHandleBorderColor == newDisableHandleBorderColor)
|
||||
return;
|
||||
m_disableHandleBorderColor = newDisableHandleBorderColor;
|
||||
emit disableHandleBorderColorChanged();
|
||||
}
|
||||
|
||||
int UKUISlider::handleBorderWidth() const
|
||||
{
|
||||
return m_handleBorderWidth;
|
||||
}
|
||||
|
||||
void UKUISlider::setHandleBorderWidth(int newHandleBorderWidth)
|
||||
{
|
||||
if (m_handleBorderWidth == newHandleBorderWidth)
|
||||
return;
|
||||
m_handleBorderWidth = newHandleBorderWidth;
|
||||
emit handleBorderWidthChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::normalUnGrooveColor() const
|
||||
{
|
||||
return m_normalUnGrooveColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setNormalUnGrooveColor(const DTColor &newNormalUnGrooveColor)
|
||||
{
|
||||
if (m_normalUnGrooveColor == newNormalUnGrooveColor)
|
||||
return;
|
||||
m_normalUnGrooveColor = newNormalUnGrooveColor;
|
||||
emit normalUnGrooveColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::disableUnGrooveColor() const
|
||||
{
|
||||
return m_disableUnGrooveColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setDisableUnGrooveColor(const DTColor &newDisableUnGrooveColor)
|
||||
{
|
||||
if (m_disableUnGrooveColor == newDisableUnGrooveColor)
|
||||
return;
|
||||
m_disableUnGrooveColor = newDisableUnGrooveColor;
|
||||
emit disableUnGrooveColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::normalUnGrooveBorderColor() const
|
||||
{
|
||||
return m_normalUnGrooveBorderColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setNormalUnGrooveBorderColor(const DTColor &newNormalUnGrooveBorderColor)
|
||||
{
|
||||
if (m_normalUnGrooveBorderColor == newNormalUnGrooveBorderColor)
|
||||
return;
|
||||
m_normalUnGrooveBorderColor = newNormalUnGrooveBorderColor;
|
||||
emit normalUnGrooveBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::disableUnGrooveBorderColor() const
|
||||
{
|
||||
return m_disableUnGrooveBorderColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setDisableUnGrooveBorderColor(const DTColor &newDisableUnGrooveBorderColor)
|
||||
{
|
||||
if (m_disableUnGrooveBorderColor == newDisableUnGrooveBorderColor)
|
||||
return;
|
||||
m_disableUnGrooveBorderColor = newDisableUnGrooveBorderColor;
|
||||
emit disableUnGrooveBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::hoverHandleColor() const
|
||||
{
|
||||
return m_hoverHandleColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setHoverHandleColor(const DTColor &newHoverHandleColor)
|
||||
{
|
||||
if (m_hoverHandleColor == newHoverHandleColor)
|
||||
return;
|
||||
m_hoverHandleColor = newHoverHandleColor;
|
||||
emit hoverHandleColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::clickHandleColor() const
|
||||
{
|
||||
return m_clickHandleColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setClickHandleColor(const DTColor &newClickHandleColor)
|
||||
{
|
||||
if (m_clickHandleColor == newClickHandleColor)
|
||||
return;
|
||||
m_clickHandleColor = newClickHandleColor;
|
||||
emit clickHandleColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::hoverHandleBorderColor() const
|
||||
{
|
||||
return m_hoverHandleBorderColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setHoverHandleBorderColor(const DTColor &newHoverHandleBorderColor)
|
||||
{
|
||||
if (m_hoverHandleBorderColor == newHoverHandleBorderColor)
|
||||
return;
|
||||
m_hoverHandleBorderColor = newHoverHandleBorderColor;
|
||||
emit hoverHandleBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISlider::clickHandleBorderColor() const
|
||||
{
|
||||
return m_clickHandleBorderColor;
|
||||
}
|
||||
|
||||
void UKUISlider::setClickHandleBorderColor(const DTColor &newClickHandleBorderColor)
|
||||
{
|
||||
if (m_clickHandleBorderColor == newClickHandleBorderColor)
|
||||
return;
|
||||
m_clickHandleBorderColor = newClickHandleBorderColor;
|
||||
emit clickHandleBorderColorChanged();
|
||||
}
|
|
@ -1,231 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUISLIDER_H
|
||||
#define UKUISLIDER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUISlider : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int normalWidth READ normalWidth WRITE setNormalWidth NOTIFY normalWidthChanged)
|
||||
Q_PROPERTY(int normalHeight READ normalHeight WRITE setNormalHeight NOTIFY normalHeightChanged)
|
||||
Q_PROPERTY(int grooveHeight READ grooveHeight WRITE setGrooveHeight NOTIFY grooveHeightChanged)
|
||||
Q_PROPERTY(int handleHeight READ handleHeight WRITE setHandleHeight NOTIFY handleHeightChanged)
|
||||
Q_PROPERTY(int focusBorderWidth READ focusBorderWidth WRITE setFocusBorderWidth NOTIFY focusBorderWidthChanged)
|
||||
Q_PROPERTY(DTColor focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalGrooveColor READ normalGrooveColor WRITE setNormalGrooveColor NOTIFY normalGrooveColorChanged)
|
||||
Q_PROPERTY(DTColor disableGrooveColor READ disableGrooveColor WRITE setDisableGrooveColor NOTIFY disableGrooveColorChanged)
|
||||
Q_PROPERTY(DTColor normalGrooveBorderColor READ normalGrooveBorderColor WRITE setNormalGrooveBorderColor NOTIFY normalGrooveBorderColorChanged)
|
||||
Q_PROPERTY(DTColor disableGrooveBorderColor READ disableGrooveBorderColor WRITE setDisableGrooveBorderColor NOTIFY disableGrooveBorderColorChanged)
|
||||
Q_PROPERTY(int grooveBorderWidth READ grooveBorderWidth WRITE setGrooveBorderWidth NOTIFY grooveBorderWidthChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalUnGrooveColor READ normalUnGrooveColor WRITE setNormalUnGrooveColor NOTIFY normalUnGrooveColorChanged)
|
||||
Q_PROPERTY(DTColor disableUnGrooveColor READ disableUnGrooveColor WRITE setDisableUnGrooveColor NOTIFY disableUnGrooveColorChanged)
|
||||
Q_PROPERTY(DTColor normalUnGrooveBorderColor READ normalUnGrooveBorderColor WRITE setNormalUnGrooveBorderColor NOTIFY normalUnGrooveBorderColorChanged)
|
||||
Q_PROPERTY(DTColor disableUnGrooveBorderColor READ disableUnGrooveBorderColor WRITE setDisableUnGrooveBorderColor NOTIFY disableUnGrooveBorderColorChanged)
|
||||
|
||||
|
||||
Q_PROPERTY(DTColor normalHandleColor READ normalHandleColor WRITE setNormalHandleColor NOTIFY normalHandleColorChanged)
|
||||
Q_PROPERTY(DTColor hoverHandleColor READ hoverHandleColor WRITE setHoverHandleColor NOTIFY hoverHandleColorChanged)
|
||||
Q_PROPERTY(DTColor clickHandleColor READ clickHandleColor WRITE setClickHandleColor NOTIFY clickHandleColorChanged)
|
||||
Q_PROPERTY(DTColor disableHandleColor READ disableHandleColor WRITE setDisableHandleColor NOTIFY DisableHandleColorChanged)
|
||||
Q_PROPERTY(DTColor normalHandleBorderColor READ normalHandleBorderColor WRITE setNormalHandleBorderColor NOTIFY normalHandleBorderColorChanged)
|
||||
Q_PROPERTY(DTColor hoverHandleBorderColor READ hoverHandleBorderColor WRITE setHoverHandleBorderColor NOTIFY hoverHandleBorderColorChanged)
|
||||
Q_PROPERTY(DTColor clickHandleBorderColor READ clickHandleBorderColor WRITE setClickHandleBorderColor NOTIFY clickHandleBorderColorChanged)
|
||||
Q_PROPERTY(DTColor disableHandleBorderColor READ disableHandleBorderColor WRITE setDisableHandleBorderColor NOTIFY disableHandleBorderColorChanged)
|
||||
Q_PROPERTY(int handleBorderWidth READ handleBorderWidth WRITE setHandleBorderWidth NOTIFY handleBorderWidthChanged)
|
||||
|
||||
public:
|
||||
explicit UKUISlider(QQuickItem *parent = nullptr);
|
||||
~UKUISlider();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUISlider* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
int normalWidth() const;
|
||||
void setNormalWidth(int newNormalWidth);
|
||||
|
||||
int normalHeight() const;
|
||||
void setNormalHeight(int newNormalHeight);
|
||||
|
||||
int grooveHeight() const;
|
||||
void setGrooveHeight(int newGrooveHeight);
|
||||
|
||||
int handleHeight() const;
|
||||
void setHandleHeight(int newHandleHeight);
|
||||
|
||||
int focusBorderWidth() const;
|
||||
void setFocusBorderWidth(int newFocusBorderWidth);
|
||||
|
||||
const DTColor &focusBorderColor() const;
|
||||
void setFocusBorderColor(const DTColor &newFocusBorderColor);
|
||||
|
||||
const DTColor &normalGrooveColor() const;
|
||||
void setNormalGrooveColor(const DTColor &newNormalGrooveColor);
|
||||
|
||||
const DTColor &disableGrooveColor() const;
|
||||
void setDisableGrooveColor(const DTColor &newDisableGrooveColor);
|
||||
|
||||
const DTColor &normalHandleColor() const;
|
||||
void setNormalHandleColor(const DTColor &newNormalHandleColor);
|
||||
|
||||
const DTColor &disableHandleColor() const;
|
||||
void setDisableHandleColor(const DTColor &newDisableHandleColor);
|
||||
|
||||
const DTColor &normalGrooveBorderColor() const;
|
||||
void setNormalGrooveBorderColor(const DTColor &newNormalGrooveBorderColor);
|
||||
|
||||
const DTColor &disableGrooveBorderColor() const;
|
||||
void setDisableGrooveBorderColor(const DTColor &newDisableGrooveBorderColor);
|
||||
|
||||
int grooveBorderWidth() const;
|
||||
void setGrooveBorderWidth(int newGrooveBorderWidth);
|
||||
|
||||
const DTColor &normalHandleBorderColor() const;
|
||||
void setNormalHandleBorderColor(const DTColor &newNormalHandleBorderColor);
|
||||
|
||||
const DTColor &disableHandleBorderColor() const;
|
||||
void setDisableHandleBorderColor(const DTColor &newDisableHandleBorderColor);
|
||||
|
||||
int handleBorderWidth() const;
|
||||
void setHandleBorderWidth(int newHandleBorderWidth);
|
||||
|
||||
const DTColor &normalUnGrooveColor() const;
|
||||
void setNormalUnGrooveColor(const DTColor &newNormalUnGrooveColor);
|
||||
|
||||
const DTColor &disableUnGrooveColor() const;
|
||||
void setDisableUnGrooveColor(const DTColor &newDisableUnGrooveColor);
|
||||
|
||||
const DTColor &normalUnGrooveBorderColor() const;
|
||||
void setNormalUnGrooveBorderColor(const DTColor &newNormalUnGrooveBorderColor);
|
||||
|
||||
const DTColor &disableUnGrooveBorderColor() const;
|
||||
void setDisableUnGrooveBorderColor(const DTColor &newDisableUnGrooveBorderColor);
|
||||
|
||||
const DTColor &hoverHandleColor() const;
|
||||
void setHoverHandleColor(const DTColor &newHoverHandleColor);
|
||||
|
||||
const DTColor &clickHandleColor() const;
|
||||
void setClickHandleColor(const DTColor &newClickHandleColor);
|
||||
|
||||
const DTColor &hoverHandleBorderColor() const;
|
||||
void setHoverHandleBorderColor(const DTColor &newHoverHandleBorderColor);
|
||||
|
||||
const DTColor &clickHandleBorderColor() const;
|
||||
void setClickHandleBorderColor(const DTColor &newClickHandleBorderColor);
|
||||
|
||||
signals:
|
||||
void normalWidthChanged();
|
||||
|
||||
void normalHeightChanged();
|
||||
|
||||
void grooveHeightChanged();
|
||||
|
||||
void handleHeightChanged();
|
||||
|
||||
void focusBorderWidthChanged();
|
||||
|
||||
void focusBorderColorChanged();
|
||||
|
||||
void normalGrooveColorChanged();
|
||||
|
||||
void disableGrooveColorChanged();
|
||||
|
||||
void normalHandleColorChanged();
|
||||
|
||||
void DisableHandleColorChanged();
|
||||
|
||||
void normalGrooveBorderColorChanged();
|
||||
|
||||
void disableGrooveBorderColorChanged();
|
||||
|
||||
void grooveBorderWidthChanged();
|
||||
|
||||
void normalHandleBorderColorChanged();
|
||||
|
||||
void disableHandleBorderColorChanged();
|
||||
|
||||
void handleBorderWidthChanged();
|
||||
|
||||
void normalUnGrooveColorChanged();
|
||||
|
||||
void disableUnGrooveColorChanged();
|
||||
|
||||
void normalUnGrooveBorderColorChanged();
|
||||
|
||||
void disableUnGrooveBorderColorChanged();
|
||||
|
||||
void hoverHandleColorChanged();
|
||||
|
||||
void clickHandleColorChanged();
|
||||
|
||||
void hoverHandleBorderColorChanged();
|
||||
|
||||
void clickHandleBorderColorChanged();
|
||||
|
||||
private:
|
||||
int m_normalWidth;
|
||||
int m_normalHeight;
|
||||
int m_grooveHeight;
|
||||
int m_handleHeight;
|
||||
int m_focusBorderWidth;
|
||||
DTColor m_focusBorderColor;
|
||||
DTColor m_normalGrooveColor;
|
||||
DTColor m_disableGrooveColor;
|
||||
DTColor m_normalHandleColor;
|
||||
DTColor m_disableHandleColor;
|
||||
DTColor m_normalGrooveBorderColor;
|
||||
DTColor m_disableGrooveBorderColor;
|
||||
int m_grooveBorderWidth;
|
||||
DTColor m_normalHandleBorderColor;
|
||||
DTColor m_disableHandleBorderColor;
|
||||
int m_handleBorderWidth;
|
||||
DTColor m_normalUnGrooveColor;
|
||||
DTColor m_disableUnGrooveColor;
|
||||
DTColor m_normalUnGrooveBorderColor;
|
||||
DTColor m_disableUnGrooveBorderColor;
|
||||
DTColor m_hoverHandleColor;
|
||||
DTColor m_clickHandleColor;
|
||||
DTColor m_hoverHandleBorderColor;
|
||||
DTColor m_clickHandleBorderColor;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUISlider, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUISLIDER_H
|
|
@ -1,465 +0,0 @@
|
|||
#include "ukuispinbox.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUISpinBox::UKUISpinBox(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUISpinBox::~UKUISpinBox()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUISpinBox::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setNormalColor(instance->buttonActive());
|
||||
setHoverColor(instance->kComponentHover());
|
||||
setClickColor(instance->kComponentClick());
|
||||
setDisableColor(instance->buttonDisable());
|
||||
setNormalTextColor(instance->buttonTextActive());
|
||||
setDisableTextColor(instance->buttonTextDisable());
|
||||
setNormalBorderColor(instance->kLineComponentNormal());
|
||||
setHoverBorderColor(instance->kLineComponentHover());
|
||||
setClickBorderColor(instance->kLineComponentClick());
|
||||
setDisableBorderColor(instance->kLineComponentDisable());
|
||||
setFocusBorderColor(instance->highLightActive());
|
||||
setFocusColor(instance->kContainGeneralNormal());
|
||||
|
||||
setBtnNormalColor(instance->buttonActive());
|
||||
setBtnHoverColor(instance->kComponentHover());
|
||||
setBtnClickColor(instance->kComponentClick());
|
||||
setBtnDisableColor(instance->kComponentDisable());
|
||||
setBtnNormalBorderColor(instance->kLineComponentNormal());
|
||||
setBtnHoverBorderColor(instance->kLineComponentHover());
|
||||
setBtnClickBorderColor(instance->kLineComponentClick());
|
||||
setBtnDisableBorderColor(instance->kLineComponentDisable());
|
||||
|
||||
setNormalWidth(160);
|
||||
setNormalHeight(36);
|
||||
setBtnNormalWidth(36);
|
||||
setBtnNormalHeight(18);
|
||||
setRadius(instance->kradiusNormal());
|
||||
setNormalBorderWidth(instance->normalline());
|
||||
setFocusBorderWidth(instance->focusline());
|
||||
setPadding(instance->kmarginNormal());
|
||||
setBtnBorderWidth(instance->normalline());
|
||||
}
|
||||
|
||||
UKUISpinBox* UKUISpinBox::qmlAttachedProperties(QObject *parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUISpinBox(p);
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::normalColor() const
|
||||
{
|
||||
return m_normalColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setNormalColor(const DTColor &newNormalColor)
|
||||
{
|
||||
if (m_normalColor == newNormalColor)
|
||||
return;
|
||||
m_normalColor = newNormalColor;
|
||||
emit normalColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::disableColor() const
|
||||
{
|
||||
return m_disableColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setDisableColor(const DTColor &newDisableColor)
|
||||
{
|
||||
if (m_disableColor == newDisableColor)
|
||||
return;
|
||||
m_disableColor = newDisableColor;
|
||||
emit disableColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::hoverColor() const
|
||||
{
|
||||
return m_hoverColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setHoverColor(const DTColor &newHoverColor)
|
||||
{
|
||||
if (m_hoverColor == newHoverColor)
|
||||
return;
|
||||
m_hoverColor = newHoverColor;
|
||||
emit hoverColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::clickColor() const
|
||||
{
|
||||
return m_clickColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setClickColor(const DTColor &newClickColor)
|
||||
{
|
||||
if (m_clickColor == newClickColor)
|
||||
return;
|
||||
m_clickColor = newClickColor;
|
||||
emit clickColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::normalTextColor() const
|
||||
{
|
||||
return m_normalTextColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setNormalTextColor(const DTColor &newNormalTextColor)
|
||||
{
|
||||
if (m_normalTextColor == newNormalTextColor)
|
||||
return;
|
||||
m_normalTextColor = newNormalTextColor;
|
||||
emit normalTextColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::disableTextColor() const
|
||||
{
|
||||
return m_disableTextColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setDisableTextColor(const DTColor &newDisableTextColor)
|
||||
{
|
||||
if (m_disableTextColor == newDisableTextColor)
|
||||
return;
|
||||
m_disableTextColor = newDisableTextColor;
|
||||
emit disableTextColorChanged();
|
||||
}
|
||||
|
||||
int UKUISpinBox::normalWidth() const
|
||||
{
|
||||
return m_normalWidth;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setNormalWidth(int newNormalWidth)
|
||||
{
|
||||
if (m_normalWidth == newNormalWidth)
|
||||
return;
|
||||
m_normalWidth = newNormalWidth;
|
||||
emit normalWidthChanged();
|
||||
}
|
||||
|
||||
int UKUISpinBox::normalHeight() const
|
||||
{
|
||||
return m_normalHeight;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setNormalHeight(int newNormalHeight)
|
||||
{
|
||||
if (m_normalHeight == newNormalHeight)
|
||||
return;
|
||||
m_normalHeight = newNormalHeight;
|
||||
emit normalHeightChanged();
|
||||
}
|
||||
|
||||
int UKUISpinBox::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setRadius(int newRadius)
|
||||
{
|
||||
if (m_radius == newRadius)
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit radiusChanged();
|
||||
}
|
||||
|
||||
int UKUISpinBox::btnNormalWidth() const
|
||||
{
|
||||
return m_btnNormalWidth;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnNormalWidth(int newBtnNormalWidth)
|
||||
{
|
||||
if (m_btnNormalWidth == newBtnNormalWidth)
|
||||
return;
|
||||
m_btnNormalWidth = newBtnNormalWidth;
|
||||
emit btnNormalWidthChanged();
|
||||
}
|
||||
|
||||
int UKUISpinBox::btnNormalHeight() const
|
||||
{
|
||||
return m_btnNormalHeight;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnNormalHeight(int newBtnNormalHeight)
|
||||
{
|
||||
if (m_btnNormalHeight == newBtnNormalHeight)
|
||||
return;
|
||||
m_btnNormalHeight = newBtnNormalHeight;
|
||||
emit btnNormalHeightChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::normalBorderColor() const
|
||||
{
|
||||
return m_normalBorderColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setNormalBorderColor(const DTColor &newNormalBorderColor)
|
||||
{
|
||||
if (m_normalBorderColor == newNormalBorderColor)
|
||||
return;
|
||||
m_normalBorderColor = newNormalBorderColor;
|
||||
emit normalBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::hoverBorderColor() const
|
||||
{
|
||||
return m_hoverBorderColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setHoverBorderColor(const DTColor &newHoverBorderColor)
|
||||
{
|
||||
if (m_hoverBorderColor == newHoverBorderColor)
|
||||
return;
|
||||
m_hoverBorderColor = newHoverBorderColor;
|
||||
emit hoverColorBorderChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::clickBorderColor() const
|
||||
{
|
||||
return m_clickBorderColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setClickBorderColor(const DTColor &newClickBorderColor)
|
||||
{
|
||||
if (m_clickBorderColor == newClickBorderColor)
|
||||
return;
|
||||
m_clickBorderColor = newClickBorderColor;
|
||||
emit clickColorBorderChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::disableBorderColor() const
|
||||
{
|
||||
return m_disableBorderColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setDisableBorderColor(const DTColor &newDisableBorderColor)
|
||||
{
|
||||
if (m_disableBorderColor == newDisableBorderColor)
|
||||
return;
|
||||
m_disableBorderColor = newDisableBorderColor;
|
||||
emit disableBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::focusBorderColor() const
|
||||
{
|
||||
return m_focusBorderColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setFocusBorderColor(const DTColor &newFocusBorderColor)
|
||||
{
|
||||
if (m_focusBorderColor == newFocusBorderColor)
|
||||
return;
|
||||
m_focusBorderColor = newFocusBorderColor;
|
||||
emit focusBorderColorChanged();
|
||||
}
|
||||
|
||||
int UKUISpinBox::focusBorderWidth() const
|
||||
{
|
||||
return m_focusBorderWidth;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setFocusBorderWidth(int newFocusBorderWidth)
|
||||
{
|
||||
if (m_focusBorderWidth == newFocusBorderWidth)
|
||||
return;
|
||||
m_focusBorderWidth = newFocusBorderWidth;
|
||||
emit focusBorderWidthChanged();
|
||||
}
|
||||
|
||||
int UKUISpinBox::normalBorderWidth() const
|
||||
{
|
||||
return m_normalBorderWidth;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setNormalBorderWidth(int newNormalBorderWidth)
|
||||
{
|
||||
if (m_normalBorderWidth == newNormalBorderWidth)
|
||||
return;
|
||||
m_normalBorderWidth = newNormalBorderWidth;
|
||||
emit normalBorderWidthChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::focusColor() const
|
||||
{
|
||||
return m_focusColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setFocusColor(const DTColor &newFocusColor)
|
||||
{
|
||||
if (m_focusColor == newFocusColor)
|
||||
return;
|
||||
m_focusColor = newFocusColor;
|
||||
emit focusColorChanged();
|
||||
}
|
||||
|
||||
int UKUISpinBox::padding() const
|
||||
{
|
||||
return m_padding;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setPadding(int newPadding)
|
||||
{
|
||||
if (m_padding == newPadding)
|
||||
return;
|
||||
m_padding = newPadding;
|
||||
emit paddingChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::btnNormalColor() const
|
||||
{
|
||||
return m_btnNormalColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnNormalColor(const DTColor &newBtnNormalColor)
|
||||
{
|
||||
if (m_btnNormalColor == newBtnNormalColor)
|
||||
return;
|
||||
m_btnNormalColor = newBtnNormalColor;
|
||||
emit btnNormalColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::btnHoverColor() const
|
||||
{
|
||||
return m_btnHoverColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnHoverColor(const DTColor &newBtnHoverColor)
|
||||
{
|
||||
if (m_btnHoverColor == newBtnHoverColor)
|
||||
return;
|
||||
m_btnHoverColor = newBtnHoverColor;
|
||||
emit btnHoverColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::btnClickColor() const
|
||||
{
|
||||
return m_btnClickColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnClickColor(const DTColor &newBtnClickColor)
|
||||
{
|
||||
if (m_btnClickColor == newBtnClickColor)
|
||||
return;
|
||||
m_btnClickColor = newBtnClickColor;
|
||||
emit btnClickColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::btnDisableColor() const
|
||||
{
|
||||
return m_btnDisableColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnDisableColor(const DTColor &newBtnDisableColor)
|
||||
{
|
||||
if (m_btnDisableColor == newBtnDisableColor)
|
||||
return;
|
||||
m_btnDisableColor = newBtnDisableColor;
|
||||
emit btnDisableColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::btnFocusColor() const
|
||||
{
|
||||
return m_btnFocusColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnFocusColor(const DTColor &newBtnFocusColor)
|
||||
{
|
||||
if (m_btnFocusColor == newBtnFocusColor)
|
||||
return;
|
||||
m_btnFocusColor = newBtnFocusColor;
|
||||
emit btnFocusColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::btnNormalBorderColor() const
|
||||
{
|
||||
return m_btnNormalBorderColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnNormalBorderColor(const DTColor &newBtnNormalBorderColor)
|
||||
{
|
||||
if (m_btnNormalBorderColor == newBtnNormalBorderColor)
|
||||
return;
|
||||
m_btnNormalBorderColor = newBtnNormalBorderColor;
|
||||
emit btnNormalBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::btnHoverBorderColor() const
|
||||
{
|
||||
return m_btnHoverBorderColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnHoverBorderColor(const DTColor &newBtnHoverBorderColor)
|
||||
{
|
||||
if (m_btnHoverBorderColor == newBtnHoverBorderColor)
|
||||
return;
|
||||
m_btnHoverBorderColor = newBtnHoverBorderColor;
|
||||
emit btnHoverBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::btnClickBorderColor() const
|
||||
{
|
||||
return m_btnClickBorderColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnClickBorderColor(const DTColor &newBtnClickBorderColor)
|
||||
{
|
||||
if (m_btnClickBorderColor == newBtnClickBorderColor)
|
||||
return;
|
||||
m_btnClickBorderColor = newBtnClickBorderColor;
|
||||
emit btnClickBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::btnDisableBorderColor() const
|
||||
{
|
||||
return m_btnDisableBorderColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnDisableBorderColor(const DTColor &newBtnDisableBorderColor)
|
||||
{
|
||||
if (m_btnDisableBorderColor == newBtnDisableBorderColor)
|
||||
return;
|
||||
m_btnDisableBorderColor = newBtnDisableBorderColor;
|
||||
emit btnDisableBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUISpinBox::btnFocusBorderColor() const
|
||||
{
|
||||
return m_btnFocusBorderColor;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnFocusBorderColor(const DTColor &newBtnFocusBorderColor)
|
||||
{
|
||||
if (m_btnFocusBorderColor == newBtnFocusBorderColor)
|
||||
return;
|
||||
m_btnFocusBorderColor = newBtnFocusBorderColor;
|
||||
emit btnFocusBorderColorChanged();
|
||||
}
|
||||
|
||||
int UKUISpinBox::btnBorderWidth() const
|
||||
{
|
||||
return m_btnBorderWidth;
|
||||
}
|
||||
|
||||
void UKUISpinBox::setBtnBorderWidth(int newBtnBorderWidth)
|
||||
{
|
||||
if (m_btnBorderWidth == newBtnBorderWidth)
|
||||
return;
|
||||
m_btnBorderWidth = newBtnBorderWidth;
|
||||
emit btnBorderWidthChanged();
|
||||
}
|
|
@ -1,286 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUISPINBOX_H
|
||||
#define UKUISPINBOX_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUISpinBox : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(DTColor normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged)
|
||||
Q_PROPERTY(DTColor hoverColor READ hoverColor WRITE setHoverColor NOTIFY hoverColorChanged)
|
||||
Q_PROPERTY(DTColor clickColor READ clickColor WRITE setClickColor NOTIFY clickColorChanged)
|
||||
Q_PROPERTY(DTColor disableColor READ disableColor WRITE setDisableColor NOTIFY disableColorChanged)
|
||||
Q_PROPERTY(DTColor focusColor READ focusColor WRITE setFocusColor NOTIFY focusColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged)
|
||||
Q_PROPERTY(DTColor hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverColorBorderChanged)
|
||||
Q_PROPERTY(DTColor clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickColorBorderChanged)
|
||||
Q_PROPERTY(DTColor disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged)
|
||||
Q_PROPERTY(DTColor focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged)
|
||||
Q_PROPERTY(DTColor disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor btnNormalColor READ btnNormalColor WRITE setBtnNormalColor NOTIFY btnNormalColorChanged)
|
||||
Q_PROPERTY(DTColor btnHoverColor READ btnHoverColor WRITE setBtnHoverColor NOTIFY btnHoverColorChanged)
|
||||
Q_PROPERTY(DTColor btnClickColor READ btnClickColor WRITE setBtnClickColor NOTIFY btnClickColorChanged)
|
||||
Q_PROPERTY(DTColor btnDisableColor READ btnDisableColor WRITE setBtnDisableColor NOTIFY btnDisableColorChanged)
|
||||
Q_PROPERTY(DTColor btnFocusColor READ btnFocusColor WRITE setBtnFocusColor NOTIFY btnFocusColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor btnNormalBorderColor READ btnNormalBorderColor WRITE setBtnNormalBorderColor NOTIFY btnNormalBorderColorChanged)
|
||||
Q_PROPERTY(DTColor btnHoverBorderColor READ btnHoverBorderColor WRITE setBtnHoverBorderColor NOTIFY btnHoverBorderColorChanged)
|
||||
Q_PROPERTY(DTColor btnClickBorderColor READ btnClickBorderColor WRITE setBtnClickBorderColor NOTIFY btnClickBorderColorChanged)
|
||||
Q_PROPERTY(DTColor btnDisableBorderColor READ btnDisableBorderColor WRITE setBtnDisableBorderColor NOTIFY btnDisableBorderColorChanged)
|
||||
Q_PROPERTY(DTColor btnFocusBorderColor READ btnFocusBorderColor WRITE setBtnFocusBorderColor NOTIFY btnFocusBorderColorChanged)
|
||||
|
||||
|
||||
Q_PROPERTY(int normalWidth READ normalWidth WRITE setNormalWidth NOTIFY normalWidthChanged)
|
||||
Q_PROPERTY(int normalHeight READ normalHeight WRITE setNormalHeight NOTIFY normalHeightChanged)
|
||||
Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
Q_PROPERTY(int btnNormalWidth READ btnNormalWidth WRITE setBtnNormalWidth NOTIFY btnNormalWidthChanged)
|
||||
Q_PROPERTY(int btnNormalHeight READ btnNormalHeight WRITE setBtnNormalHeight NOTIFY btnNormalHeightChanged)
|
||||
Q_PROPERTY(int focusBorderWidth READ focusBorderWidth WRITE setFocusBorderWidth NOTIFY focusBorderWidthChanged)
|
||||
Q_PROPERTY(int normalBorderWidth READ normalBorderWidth WRITE setNormalBorderWidth NOTIFY normalBorderWidthChanged)
|
||||
|
||||
Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged)
|
||||
|
||||
Q_PROPERTY(int btnBorderWidth READ btnBorderWidth WRITE setBtnBorderWidth NOTIFY btnBorderWidthChanged)
|
||||
|
||||
public:
|
||||
explicit UKUISpinBox(QQuickItem *parent = nullptr);
|
||||
~UKUISpinBox();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUISpinBox* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
const DTColor &normalColor() const;
|
||||
void setNormalColor(const DTColor &newNormalColor);
|
||||
|
||||
const DTColor &disableColor() const;
|
||||
void setDisableColor(const DTColor &newDisableColor);
|
||||
|
||||
const DTColor &hoverColor() const;
|
||||
void setHoverColor(const DTColor &newHoverColor);
|
||||
|
||||
const DTColor &clickColor() const;
|
||||
void setClickColor(const DTColor &newClickColor);
|
||||
|
||||
const DTColor &normalTextColor() const;
|
||||
void setNormalTextColor(const DTColor &newNormalTextColor);
|
||||
|
||||
const DTColor &disableTextColor() const;
|
||||
void setDisableTextColor(const DTColor &newDisableTextColor);
|
||||
|
||||
int normalWidth() const;
|
||||
void setNormalWidth(int newNormalWidth);
|
||||
|
||||
int normalHeight() const;
|
||||
void setNormalHeight(int newNormalHeight);
|
||||
|
||||
int radius() const;
|
||||
void setRadius(int newRadius);
|
||||
|
||||
int btnNormalWidth() const;
|
||||
void setBtnNormalWidth(int newBtnNormalWidth);
|
||||
|
||||
int btnNormalHeight() const;
|
||||
void setBtnNormalHeight(int newBtnNormalHeight);
|
||||
|
||||
const DTColor &normalBorderColor() const;
|
||||
void setNormalBorderColor(const DTColor &newNormalBorderColor);
|
||||
|
||||
const DTColor &hoverBorderColor() const;
|
||||
void setHoverBorderColor(const DTColor &newHoverBorderColor);
|
||||
|
||||
const DTColor &clickBorderColor() const;
|
||||
void setClickBorderColor(const DTColor &newClickBorderColor);
|
||||
|
||||
const DTColor &disableBorderColor() const;
|
||||
void setDisableBorderColor(const DTColor &newDisableBorderColor);
|
||||
|
||||
const DTColor &focusBorderColor() const;
|
||||
void setFocusBorderColor(const DTColor &newFocusBorderColor);
|
||||
|
||||
int focusBorderWidth() const;
|
||||
void setFocusBorderWidth(int newFocusBorderWidth);
|
||||
|
||||
int normalBorderWidth() const;
|
||||
void setNormalBorderWidth(int newNormalBorderWidth);
|
||||
|
||||
const DTColor &focusColor() const;
|
||||
void setFocusColor(const DTColor &newFocusColor);
|
||||
|
||||
int padding() const;
|
||||
void setPadding(int newPadding);
|
||||
|
||||
const DTColor &btnNormalColor() const;
|
||||
void setBtnNormalColor(const DTColor &newBtnNormalColor);
|
||||
|
||||
const DTColor &btnHoverColor() const;
|
||||
void setBtnHoverColor(const DTColor &newBtnHoverColor);
|
||||
|
||||
const DTColor &btnClickColor() const;
|
||||
void setBtnClickColor(const DTColor &newBtnClickColor);
|
||||
|
||||
const DTColor &btnDisableColor() const;
|
||||
void setBtnDisableColor(const DTColor &newBtnDisableColor);
|
||||
|
||||
const DTColor &btnFocusColor() const;
|
||||
void setBtnFocusColor(const DTColor &newBtnFocusColor);
|
||||
|
||||
const DTColor &btnNormalBorderColor() const;
|
||||
void setBtnNormalBorderColor(const DTColor &newBtnNormalBorderColor);
|
||||
|
||||
const DTColor &btnHoverBorderColor() const;
|
||||
void setBtnHoverBorderColor(const DTColor &newBtnHoverBorderColor);
|
||||
|
||||
const DTColor &btnClickBorderColor() const;
|
||||
void setBtnClickBorderColor(const DTColor &newBtnClickBorderColor);
|
||||
|
||||
const DTColor &btnDisableBorderColor() const;
|
||||
void setBtnDisableBorderColor(const DTColor &newBtnDisableBorderColor);
|
||||
|
||||
const DTColor &btnFocusBorderColor() const;
|
||||
void setBtnFocusBorderColor(const DTColor &newBtnFocusBorderColor);
|
||||
|
||||
int btnBorderWidth() const;
|
||||
void setBtnBorderWidth(int newBtnBorderWidth);
|
||||
|
||||
signals:
|
||||
void normalColorChanged();
|
||||
|
||||
void linkColorChanged();
|
||||
|
||||
void disableColorChanged();
|
||||
|
||||
void hoverColorChanged();
|
||||
|
||||
void clickColorChanged();
|
||||
|
||||
void normalTextColorChanged();
|
||||
|
||||
void disableTextColorChanged();
|
||||
|
||||
void normalWidthChanged();
|
||||
|
||||
void normalHeightChanged();
|
||||
|
||||
void radiusChanged();
|
||||
|
||||
void btnNormalWidthChanged();
|
||||
|
||||
void btnNormalHeightChanged();
|
||||
|
||||
void normalBorderColorChanged();
|
||||
|
||||
void hoverColorBorderChanged();
|
||||
|
||||
void clickColorBorderChanged();
|
||||
|
||||
void disableBorderColorChanged();
|
||||
|
||||
void focusBorderColorChanged();
|
||||
|
||||
void focusBorderWidthChanged();
|
||||
|
||||
void normalBorderWidthChanged();
|
||||
|
||||
void focusColorChanged();
|
||||
|
||||
void paddingChanged();
|
||||
|
||||
void btnNormalColorChanged();
|
||||
|
||||
void btnHoverColorChanged();
|
||||
|
||||
void btnClickColorChanged();
|
||||
|
||||
void btnDisableColorChanged();
|
||||
|
||||
void btnFocusColorChanged();
|
||||
|
||||
void btnNormalBorderColorChanged();
|
||||
|
||||
void btnHoverBorderColorChanged();
|
||||
|
||||
void btnClickBorderColorChanged();
|
||||
|
||||
void btnDisableBorderColorChanged();
|
||||
|
||||
void btnFocusBorderColorChanged();
|
||||
|
||||
void btnBorderWidthChanged();
|
||||
|
||||
private:
|
||||
DTColor m_normalColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.85));
|
||||
DTColor m_disableColor;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
DTColor m_hoverColor;
|
||||
DTColor m_clickColor;
|
||||
DTColor m_normalTextColor;
|
||||
DTColor m_disableTextColor;
|
||||
int m_normalWidth;
|
||||
int m_normalHeight;
|
||||
int m_radius;
|
||||
int m_btnNormalWidth;
|
||||
int m_btnNormalHeight;
|
||||
DTColor m_normalBorderColor;
|
||||
DTColor m_hoverBorderColor;
|
||||
DTColor m_clickBorderColor;
|
||||
DTColor m_disableBorderColor;
|
||||
DTColor m_focusBorderColor;
|
||||
int m_focusBorderWidth;
|
||||
int m_normalBorderWidth;
|
||||
DTColor m_focusColor;
|
||||
int m_padding;
|
||||
DTColor m_btnNormalColor;
|
||||
DTColor m_btnHoverColor;
|
||||
DTColor m_btnClickColor;
|
||||
DTColor m_btnDisableColor;
|
||||
DTColor m_btnFocusColor;
|
||||
DTColor m_btnNormalBorderColor;
|
||||
DTColor m_btnHoverBorderColor;
|
||||
DTColor m_btnClickBorderColor;
|
||||
DTColor m_btnDisableBorderColor;
|
||||
DTColor m_btnFocusBorderColor;
|
||||
int m_btnBorderWidth;
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUISpinBox, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUISPINBOX_H
|
|
@ -1,45 +0,0 @@
|
|||
#include "ukuitabbar.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUITabBar::UKUITabBar(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUITabBar::~UKUITabBar()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUITabBar::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setNormalColor(instance->kContainSecondaryNormal());
|
||||
}
|
||||
|
||||
UKUITabBar* UKUITabBar::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUITabBar(p);
|
||||
}
|
||||
|
||||
const DTColor &UKUITabBar::normalColor() const
|
||||
{
|
||||
return m_normalColor;
|
||||
}
|
||||
|
||||
void UKUITabBar::setNormalColor(const DTColor &newNormalColor)
|
||||
{
|
||||
if (m_normalColor == newNormalColor)
|
||||
return;
|
||||
m_normalColor = newNormalColor;
|
||||
emit normalColorChanged();
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUITABBAR_H
|
||||
#define UKUITABBAR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUITabBar : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(DTColor normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged)
|
||||
|
||||
public:
|
||||
explicit UKUITabBar(QQuickItem *parent = nullptr);
|
||||
~UKUITabBar();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUITabBar* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
const DTColor &normalColor() const;
|
||||
void setNormalColor(const DTColor &newNormalColor);
|
||||
|
||||
signals:
|
||||
void normalColorChanged();
|
||||
|
||||
private:
|
||||
DTColor m_normalColor = DTColor(QColor("#FFFFFF"));
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUITabBar, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUITABBAR_H
|
|
@ -1,171 +0,0 @@
|
|||
#include "ukuitabbutton.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUITabButton::UKUITabButton(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUITabButton::~UKUITabButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUITabButton::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setNormalColor(DTColor(QColor(0,0,0,0)));
|
||||
setHoverColor(instance->kContainHover());
|
||||
setClickedColor(instance->kContainClick());
|
||||
setCheckedColor(instance->kContainGeneralNormal());
|
||||
setBorderWidth(1);
|
||||
setNormalBorderColor(instance->kLineComponentNormal());
|
||||
setHoverBorderColor(instance->kLineComponentHover());
|
||||
setClickBorderColor(instance->kLineComponentClick());
|
||||
setCheckedBorderColor(instance->kLineComponentNormal());
|
||||
setNormalTextColor(instance->kFontPrimary());
|
||||
}
|
||||
|
||||
UKUITabButton* UKUITabButton::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUITabButton(p);
|
||||
}
|
||||
|
||||
const DTColor &UKUITabButton::normalColor() const
|
||||
{
|
||||
return m_normalColor;
|
||||
}
|
||||
|
||||
void UKUITabButton::setNormalColor(const DTColor &newNormalColor)
|
||||
{
|
||||
if (m_normalColor == newNormalColor)
|
||||
return;
|
||||
m_normalColor = newNormalColor;
|
||||
emit normalColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITabButton::hoverColor() const
|
||||
{
|
||||
return m_hoverColor;
|
||||
}
|
||||
|
||||
void UKUITabButton::setHoverColor(const DTColor &newHoverColor)
|
||||
{
|
||||
if (m_hoverColor == newHoverColor)
|
||||
return;
|
||||
m_hoverColor = newHoverColor;
|
||||
emit hoverColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITabButton::checkedColor() const
|
||||
{
|
||||
return m_checkedColor;
|
||||
}
|
||||
|
||||
void UKUITabButton::setCheckedColor(const DTColor &newCheckedColor)
|
||||
{
|
||||
if (m_checkedColor == newCheckedColor)
|
||||
return;
|
||||
m_checkedColor = newCheckedColor;
|
||||
emit checkedColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITabButton::clickedColor() const
|
||||
{
|
||||
return m_clickedColor;
|
||||
}
|
||||
|
||||
void UKUITabButton::setClickedColor(const DTColor &newClickedColor)
|
||||
{
|
||||
if (m_clickedColor == newClickedColor)
|
||||
return;
|
||||
m_clickedColor = newClickedColor;
|
||||
emit clickedColorChanged();
|
||||
}
|
||||
|
||||
int UKUITabButton::borderWidth() const
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
|
||||
void UKUITabButton::setBorderWidth(int newBorderWidth)
|
||||
{
|
||||
if (m_borderWidth == newBorderWidth)
|
||||
return;
|
||||
m_borderWidth = newBorderWidth;
|
||||
emit borderWidthChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITabButton::normalBorderColor() const
|
||||
{
|
||||
return m_normalBorderColor;
|
||||
}
|
||||
|
||||
void UKUITabButton::setNormalBorderColor(const DTColor &newNormalBorderColor)
|
||||
{
|
||||
if (m_normalBorderColor == newNormalBorderColor)
|
||||
return;
|
||||
m_normalBorderColor = newNormalBorderColor;
|
||||
emit normalBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITabButton::hoverBorderColor() const
|
||||
{
|
||||
return m_hoverBorderColor;
|
||||
}
|
||||
|
||||
void UKUITabButton::setHoverBorderColor(const DTColor &newHoverBorderColor)
|
||||
{
|
||||
if (m_hoverBorderColor == newHoverBorderColor)
|
||||
return;
|
||||
m_hoverBorderColor = newHoverBorderColor;
|
||||
emit hoverBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITabButton::clickBorderColor() const
|
||||
{
|
||||
return m_clickBorderColor;
|
||||
}
|
||||
|
||||
void UKUITabButton::setClickBorderColor(const DTColor &newClickBorderColor)
|
||||
{
|
||||
if (m_clickBorderColor == newClickBorderColor)
|
||||
return;
|
||||
m_clickBorderColor = newClickBorderColor;
|
||||
emit clickBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITabButton::checkedBorderColor() const
|
||||
{
|
||||
return m_checkedBorderColor;
|
||||
}
|
||||
|
||||
void UKUITabButton::setCheckedBorderColor(const DTColor &newCheckedBorderColor)
|
||||
{
|
||||
if (m_checkedBorderColor == newCheckedBorderColor)
|
||||
return;
|
||||
m_checkedBorderColor = newCheckedBorderColor;
|
||||
emit checkedBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITabButton::normalTextColor() const
|
||||
{
|
||||
return m_normalTextColor;
|
||||
}
|
||||
|
||||
void UKUITabButton::setNormalTextColor(const DTColor &newNormalTextColor)
|
||||
{
|
||||
if (m_normalTextColor == newNormalTextColor)
|
||||
return;
|
||||
m_normalTextColor = newNormalTextColor;
|
||||
emit disableTextColorChanged();
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUITABBUTTON_H
|
||||
#define UKUITABBUTTON_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUITabButton : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(DTColor normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged)
|
||||
Q_PROPERTY(DTColor hoverColor READ hoverColor WRITE setHoverColor NOTIFY hoverColorChanged)
|
||||
Q_PROPERTY(DTColor checkedColor READ checkedColor WRITE setCheckedColor NOTIFY checkedColorChanged)
|
||||
Q_PROPERTY(DTColor clickedColor READ clickedColor WRITE setClickedColor NOTIFY clickedColorChanged)
|
||||
Q_PROPERTY(DTColor checkedColor READ checkedColor WRITE setCheckedColor NOTIFY checkedColorColorChanged)
|
||||
|
||||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
|
||||
Q_PROPERTY(DTColor normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged)
|
||||
Q_PROPERTY(DTColor hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged)
|
||||
Q_PROPERTY(DTColor clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged)
|
||||
Q_PROPERTY(DTColor checkedBorderColor READ checkedBorderColor WRITE setCheckedBorderColor NOTIFY checkedBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY disableTextColorChanged)
|
||||
|
||||
public:
|
||||
explicit UKUITabButton(QQuickItem *parent = nullptr);
|
||||
~UKUITabButton();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUITabButton* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
const DTColor &normalColor() const;
|
||||
void setNormalColor(const DTColor &newNormalColor);
|
||||
|
||||
const DTColor &hoverColor() const;
|
||||
void setHoverColor(const DTColor &newHoverColor);
|
||||
|
||||
const DTColor &checkedColor() const;
|
||||
void setCheckedColor(const DTColor &newCheckedColor);
|
||||
|
||||
const DTColor &clickedColor() const;
|
||||
void setClickedColor(const DTColor &newClickedColor);
|
||||
|
||||
int borderWidth() const;
|
||||
void setBorderWidth(int newBorderWidth);
|
||||
|
||||
const DTColor &normalBorderColor() const;
|
||||
void setNormalBorderColor(const DTColor &newNormalBorderColor);
|
||||
|
||||
const DTColor &hoverBorderColor() const;
|
||||
void setHoverBorderColor(const DTColor &newHoverBorderColor);
|
||||
|
||||
const DTColor &clickBorderColor() const;
|
||||
void setClickBorderColor(const DTColor &newClickBorderColor);
|
||||
|
||||
const DTColor &checkedBorderColor() const;
|
||||
void setCheckedBorderColor(const DTColor &newCheckedBorderColor);
|
||||
|
||||
const DTColor &normalTextColor() const;
|
||||
void setNormalTextColor(const DTColor &newNormalTextColor);
|
||||
|
||||
signals:
|
||||
void normalColorChanged();
|
||||
|
||||
void hoverColorChanged();
|
||||
|
||||
void checkedColorChanged();
|
||||
|
||||
void clickedColorChanged();
|
||||
|
||||
void checkedColorColorChanged();
|
||||
|
||||
void borderWidthChanged();
|
||||
|
||||
void normalBorderColorChanged();
|
||||
|
||||
void hoverBorderColorChanged();
|
||||
|
||||
void clickBorderColorChanged();
|
||||
|
||||
void checkedBorderColorChanged();
|
||||
|
||||
void disableTextColorChanged();
|
||||
|
||||
private:
|
||||
DTColor m_normalColor = DTColor("#FFFFFF");
|
||||
DTColor m_hoverColor = DTColor("#F2F2F2");
|
||||
DTColor m_checkedColor = DTColor("#F2F2F2");
|
||||
DTColor m_clickedColor = DTColor("#EEEEEE");
|
||||
int m_borderWidth;
|
||||
DTColor m_normalBorderColor;
|
||||
DTColor m_hoverBorderColor;
|
||||
DTColor m_clickBorderColor;
|
||||
DTColor m_checkedBorderColor;
|
||||
DTColor m_normalTextColor;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUITabButton, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUITABBUTTON_H
|
|
@ -1,392 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "ukuitextfiled.h"
|
||||
#include "qdebug.h"
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUITextFiled::UKUITextFiled(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
qDebug() << "UKUITextFiled..............";
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUITextFiled::~UKUITextFiled()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UKUITextFiled* UKUITextFiled::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUITextFiled(p);
|
||||
}
|
||||
|
||||
void UKUITextFiled::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setLeftRightPadding(instance->kmarginNormal());
|
||||
setRadius(instance->kradiusNormal());
|
||||
setBorderWidth(instance->normalline());
|
||||
setFocusBorderWidth(instance->focusline());
|
||||
setNormalWidth(180);
|
||||
setNormalHeight(36);
|
||||
|
||||
setNormalBC(instance->kComponentNormal());
|
||||
setInputNormalBC(instance->kContainGeneralNormal());
|
||||
setPlaceHolderNormalBC(instance->buttonActive());
|
||||
setPlaceHolderHoveredBC(instance->kComponentHover());
|
||||
setPlaceHolderClickedBC(instance->kComponentClick());
|
||||
setPlaceHolderDisableBC(instance->buttonDisable());
|
||||
setNormalBorderColor(instance->kLineComponentNormal());
|
||||
setHoverBorderColor(instance->kLineComponentHover());
|
||||
setDisableBorderColor(instance->kLineComponentDisable());
|
||||
setFocusBorderColor(instance->kBrandFocus());
|
||||
|
||||
setPlaceHolderNormalTextColor(instance->placeholderTextActive());
|
||||
setPlaceHolderDisableTextColor(instance->placeholderTextDisable());
|
||||
setNormalTextColor(instance->buttonTextActive());
|
||||
setDisableTextColor(instance->placeholderTextDisable());
|
||||
}
|
||||
|
||||
double UKUITextFiled::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setRadius(double newRadius)
|
||||
{
|
||||
if (qFuzzyCompare(m_radius, newRadius))
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit radiusChanged();
|
||||
}
|
||||
|
||||
double UKUITextFiled::leftRightPadding() const
|
||||
{
|
||||
return m_leftRightPadding;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setLeftRightPadding(double newLeftRightPadding)
|
||||
{
|
||||
if (qFuzzyCompare(m_leftRightPadding, newLeftRightPadding))
|
||||
return;
|
||||
m_leftRightPadding = newLeftRightPadding;
|
||||
emit leftRightPaddingChanged();
|
||||
}
|
||||
|
||||
double UKUITextFiled::upDownMargin() const
|
||||
{
|
||||
return m_upDownMargin;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setUpDownMargin(double newUpDownMargin)
|
||||
{
|
||||
if (qFuzzyCompare(m_upDownMargin, newUpDownMargin))
|
||||
return;
|
||||
m_upDownMargin = newUpDownMargin;
|
||||
emit upDownMarginChanged();
|
||||
}
|
||||
|
||||
double UKUITextFiled::space() const
|
||||
{
|
||||
return m_space;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setSpace(double newSpace)
|
||||
{
|
||||
if (qFuzzyCompare(m_space, newSpace))
|
||||
return;
|
||||
m_space = newSpace;
|
||||
emit spaceChange();
|
||||
}
|
||||
|
||||
int UKUITextFiled::normalWidth() const
|
||||
{
|
||||
return m_normalWidth;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setNormalWidth(int newNormalWidth)
|
||||
{
|
||||
if (m_normalWidth == newNormalWidth)
|
||||
return;
|
||||
m_normalWidth = newNormalWidth;
|
||||
emit normalWidthChanged();
|
||||
}
|
||||
|
||||
int UKUITextFiled::normalHeight() const
|
||||
{
|
||||
return m_normalHeight;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setNormalHeight(int newNormalHeight)
|
||||
{
|
||||
if (m_normalHeight == newNormalHeight)
|
||||
return;
|
||||
m_normalHeight = newNormalHeight;
|
||||
emit normalHeightChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::normalBC() const
|
||||
{
|
||||
return m_normalBC;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setNormalBC(const DTColor &newNormalBC)
|
||||
{
|
||||
if (m_normalBC == newNormalBC)
|
||||
return;
|
||||
m_normalBC = newNormalBC;
|
||||
emit normalBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::clickedBC() const
|
||||
{
|
||||
return m_clickedBC;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setClickedBC(const DTColor &newClickedBC)
|
||||
{
|
||||
if (m_clickedBC == newClickedBC)
|
||||
return;
|
||||
m_clickedBC = newClickedBC;
|
||||
emit clickedBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::hoveredBC() const
|
||||
{
|
||||
return m_hoveredBC;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setHoveredBC(const DTColor &newHoveredBC)
|
||||
{
|
||||
if (m_hoveredBC == newHoveredBC)
|
||||
return;
|
||||
m_hoveredBC = newHoveredBC;
|
||||
emit hoveredBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::disableBC() const
|
||||
{
|
||||
return m_disableBC;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setDisableBC(const DTColor &newDisableBC)
|
||||
{
|
||||
if (m_disableBC == newDisableBC)
|
||||
return;
|
||||
m_disableBC = newDisableBC;
|
||||
emit disableBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::disableTextColor() const
|
||||
{
|
||||
return m_disableTextColor;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setDisableTextColor(const DTColor &newDisableTextColor)
|
||||
{
|
||||
if (m_disableTextColor == newDisableTextColor)
|
||||
return;
|
||||
m_disableTextColor = newDisableTextColor;
|
||||
emit disableTextColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::normalTextColor() const
|
||||
{
|
||||
return m_normalTextColor;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setNormalTextColor(const DTColor &newNormalTextColor)
|
||||
{
|
||||
if (m_normalTextColor == newNormalTextColor)
|
||||
return;
|
||||
m_normalTextColor = newNormalTextColor;
|
||||
emit normalTextColorChanged();
|
||||
}
|
||||
|
||||
int UKUITextFiled::borderWidth() const
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setBorderWidth(int newBorderWidth)
|
||||
{
|
||||
if (m_borderWidth == newBorderWidth)
|
||||
return;
|
||||
m_borderWidth = newBorderWidth;
|
||||
emit borderWidthChanged();
|
||||
}
|
||||
|
||||
int UKUITextFiled::focusBorderWidth() const
|
||||
{
|
||||
return m_focusBorderWidth;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setFocusBorderWidth(int newFocusBorderWidth)
|
||||
{
|
||||
if (m_focusBorderWidth == newFocusBorderWidth)
|
||||
return;
|
||||
m_focusBorderWidth = newFocusBorderWidth;
|
||||
emit focusBorderWidthChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::normalBorderColor() const
|
||||
{
|
||||
return m_normalBorderColor;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setNormalBorderColor(const DTColor &newNormalBorderColor)
|
||||
{
|
||||
if (m_normalBorderColor == newNormalBorderColor)
|
||||
return;
|
||||
m_normalBorderColor = newNormalBorderColor;
|
||||
emit normalBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::clickBorderColor() const
|
||||
{
|
||||
return m_clickBorderColor;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setClickBorderColor(const DTColor &newClickBorderColor)
|
||||
{
|
||||
if (m_clickBorderColor == newClickBorderColor)
|
||||
return;
|
||||
m_clickBorderColor = newClickBorderColor;
|
||||
emit clickBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::disableBorderColor() const
|
||||
{
|
||||
return m_disableBorderColor;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setDisableBorderColor(const DTColor &newDisableBorderColor)
|
||||
{
|
||||
if (m_disableBorderColor == newDisableBorderColor)
|
||||
return;
|
||||
m_disableBorderColor = newDisableBorderColor;
|
||||
emit disableBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::focusBorderColor() const
|
||||
{
|
||||
return m_focusBorderColor;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setFocusBorderColor(const DTColor &newFocusBorderColor)
|
||||
{
|
||||
if (m_focusBorderColor == newFocusBorderColor)
|
||||
return;
|
||||
m_focusBorderColor = newFocusBorderColor;
|
||||
emit focusBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::hoverBorderColor() const
|
||||
{
|
||||
return m_hoverBorderColor;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setHoverBorderColor(const DTColor &newHoverBorderColor)
|
||||
{
|
||||
if (m_hoverBorderColor == newHoverBorderColor)
|
||||
return;
|
||||
m_hoverBorderColor = newHoverBorderColor;
|
||||
emit hoverBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::placeHolderNormalTextColor() const
|
||||
{
|
||||
return m_placeHolderNormalTextColor;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setPlaceHolderNormalTextColor(const DTColor &newPlaceHolderNormalTextColor)
|
||||
{
|
||||
if (m_placeHolderNormalTextColor == newPlaceHolderNormalTextColor)
|
||||
return;
|
||||
m_placeHolderNormalTextColor = newPlaceHolderNormalTextColor;
|
||||
emit placeHolderNormalTextColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::placeHolderDisableTextColor() const
|
||||
{
|
||||
return m_placeHolderDisableTextColor;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setPlaceHolderDisableTextColor(const DTColor &newPlaceHolderDisableTextColor)
|
||||
{
|
||||
if (m_placeHolderDisableTextColor == newPlaceHolderDisableTextColor)
|
||||
return;
|
||||
m_placeHolderDisableTextColor = newPlaceHolderDisableTextColor;
|
||||
emit placeHolderDisableTextColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::placeHolderNormalBC() const
|
||||
{
|
||||
return m_placeHolderNormalBC;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setPlaceHolderNormalBC(const DTColor &newPlaceHolderNormalBC)
|
||||
{
|
||||
if (m_placeHolderNormalBC == newPlaceHolderNormalBC)
|
||||
return;
|
||||
m_placeHolderNormalBC = newPlaceHolderNormalBC;
|
||||
emit placeHolderNormalBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::placeHolderClickedBC() const
|
||||
{
|
||||
return m_placeHolderClickedBC;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setPlaceHolderClickedBC(const DTColor &newPlaceHolderClickedBC)
|
||||
{
|
||||
if (m_placeHolderClickedBC == newPlaceHolderClickedBC)
|
||||
return;
|
||||
m_placeHolderClickedBC = newPlaceHolderClickedBC;
|
||||
emit placeHolderClickedBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::placeHolderHoveredBC() const
|
||||
{
|
||||
return m_placeHolderHoveredBC;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setPlaceHolderHoveredBC(const DTColor &newPlaceHolderHoveredBC)
|
||||
{
|
||||
if (m_placeHolderHoveredBC == newPlaceHolderHoveredBC)
|
||||
return;
|
||||
m_placeHolderHoveredBC = newPlaceHolderHoveredBC;
|
||||
emit placeHolderHoveredBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::placeHolderDisableBC() const
|
||||
{
|
||||
return m_placeHolderDisableBC;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setPlaceHolderDisableBC(const DTColor &newPlaceHolderDisableBC)
|
||||
{
|
||||
if (m_placeHolderDisableBC == newPlaceHolderDisableBC)
|
||||
return;
|
||||
m_placeHolderDisableBC = newPlaceHolderDisableBC;
|
||||
emit placeHolderDisableBCChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUITextFiled::inputNormalBC() const
|
||||
{
|
||||
return m_inputNormalBC;
|
||||
}
|
||||
|
||||
void UKUITextFiled::setInputNormalBC(const DTColor &newInputNormalBC)
|
||||
{
|
||||
if (m_inputNormalBC == newInputNormalBC)
|
||||
return;
|
||||
m_inputNormalBC = newInputNormalBC;
|
||||
emit inputNormalBCChanged();
|
||||
}
|
|
@ -1,248 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUITEXTFILED_H
|
||||
#define UKUITEXTFILED_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUITextFiled : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(double radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
Q_PROPERTY(double leftRightPadding READ leftRightPadding WRITE setLeftRightPadding NOTIFY leftRightPaddingChanged)
|
||||
Q_PROPERTY(double upDownMargin READ upDownMargin WRITE setUpDownMargin NOTIFY upDownMarginChanged)
|
||||
Q_PROPERTY(double space READ space WRITE setSpace NOTIFY spaceChange)
|
||||
|
||||
Q_PROPERTY(int normalWidth READ normalWidth WRITE setNormalWidth NOTIFY normalWidthChanged)
|
||||
Q_PROPERTY(int normalHeight READ normalHeight WRITE setNormalHeight NOTIFY normalHeightChanged)
|
||||
Q_PROPERTY(DTColor normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged)
|
||||
Q_PROPERTY(DTColor inputNormalBC READ inputNormalBC WRITE setInputNormalBC NOTIFY inputNormalBCChanged)
|
||||
|
||||
Q_PROPERTY(DTColor clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged)
|
||||
Q_PROPERTY(DTColor hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged)
|
||||
Q_PROPERTY(DTColor disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged)
|
||||
|
||||
Q_PROPERTY(DTColor placeHolderNormalBC READ placeHolderNormalBC WRITE setPlaceHolderNormalBC NOTIFY placeHolderNormalBCChanged)
|
||||
Q_PROPERTY(DTColor placeHolderClickedBC READ placeHolderClickedBC WRITE setPlaceHolderClickedBC NOTIFY placeHolderClickedBCChanged)
|
||||
Q_PROPERTY(DTColor placeHolderHoveredBC READ placeHolderHoveredBC WRITE setPlaceHolderHoveredBC NOTIFY placeHolderHoveredBCChanged)
|
||||
Q_PROPERTY(DTColor placeHolderDisableBC READ placeHolderDisableBC WRITE setPlaceHolderDisableBC NOTIFY placeHolderDisableBCChanged)
|
||||
|
||||
Q_PROPERTY(DTColor placeHolderNormalTextColor READ placeHolderNormalTextColor WRITE setPlaceHolderNormalTextColor NOTIFY placeHolderNormalTextColorChanged)
|
||||
Q_PROPERTY(DTColor placeHolderDisableTextColor READ placeHolderDisableTextColor WRITE setPlaceHolderDisableTextColor NOTIFY placeHolderDisableTextColorChanged)
|
||||
Q_PROPERTY(DTColor disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged)
|
||||
Q_PROPERTY(DTColor normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged)
|
||||
|
||||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
|
||||
Q_PROPERTY(int focusBorderWidth READ focusBorderWidth WRITE setFocusBorderWidth NOTIFY focusBorderWidthChanged)
|
||||
Q_PROPERTY(DTColor normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged)
|
||||
Q_PROPERTY(DTColor hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged)
|
||||
|
||||
Q_PROPERTY(DTColor clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged)
|
||||
Q_PROPERTY(DTColor disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged)
|
||||
Q_PROPERTY(DTColor focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged)
|
||||
|
||||
|
||||
public:
|
||||
explicit UKUITextFiled(QQuickItem *parent = nullptr);
|
||||
~UKUITextFiled();
|
||||
|
||||
static UKUITextFiled* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
|
||||
double radius() const;
|
||||
void setRadius(double newRadius);
|
||||
|
||||
double leftRightPadding() const;
|
||||
void setLeftRightPadding(double newLeftRightPadding);
|
||||
|
||||
double upDownMargin() const;
|
||||
void setUpDownMargin(double newUpDownMargin);
|
||||
|
||||
double space() const;
|
||||
void setSpace(double newSpace);
|
||||
|
||||
int normalWidth() const;
|
||||
void setNormalWidth(int newNormalWidth);
|
||||
|
||||
int normalHeight() const;
|
||||
void setNormalHeight(int newNormalHeight);
|
||||
|
||||
const DTColor &normalBC() const;
|
||||
void setNormalBC(const DTColor &newNormalBC);
|
||||
|
||||
const DTColor &clickedBC() const;
|
||||
void setClickedBC(const DTColor &newClickedBC);
|
||||
|
||||
const DTColor &hoveredBC() const;
|
||||
void setHoveredBC(const DTColor &newHoveredBC);
|
||||
|
||||
const DTColor &disableBC() const;
|
||||
void setDisableBC(const DTColor &newDisableBC);
|
||||
|
||||
const DTColor &disableTextColor() const;
|
||||
void setDisableTextColor(const DTColor &newDisableTextColor);
|
||||
|
||||
const DTColor &normalTextColor() const;
|
||||
void setNormalTextColor(const DTColor &newNormalTextColor);
|
||||
|
||||
int borderWidth() const;
|
||||
void setBorderWidth(int newBorderWidth);
|
||||
|
||||
int focusBorderWidth() const;
|
||||
void setFocusBorderWidth(int newFocusBorderWidth);
|
||||
|
||||
const DTColor &normalBorderColor() const;
|
||||
void setNormalBorderColor(const DTColor &newNormalBorderColor);
|
||||
|
||||
const DTColor &clickBorderColor() const;
|
||||
void setClickBorderColor(const DTColor &newClickBorderColor);
|
||||
|
||||
const DTColor &disableBorderColor() const;
|
||||
void setDisableBorderColor(const DTColor &newDisableBorderColor);
|
||||
|
||||
const DTColor &focusBorderColor() const;
|
||||
void setFocusBorderColor(const DTColor &newFocusBorderColor);
|
||||
|
||||
const DTColor &hoverBorderColor() const;
|
||||
void setHoverBorderColor(const DTColor &newHoverBorderColor);
|
||||
|
||||
const DTColor &placeHolderNormalTextColor() const;
|
||||
void setPlaceHolderNormalTextColor(const DTColor &newPlaceHolderNormalTextColor);
|
||||
|
||||
const DTColor &placeHolderDisableTextColor() const;
|
||||
void setPlaceHolderDisableTextColor(const DTColor &newPlaceHolderDisableTextColor);
|
||||
|
||||
const DTColor &placeHolderNormalBC() const;
|
||||
void setPlaceHolderNormalBC(const DTColor &newPlaceHolderNormalBC);
|
||||
|
||||
const DTColor &placeHolderClickedBC() const;
|
||||
void setPlaceHolderClickedBC(const DTColor &newPlaceHolderClickedBC);
|
||||
|
||||
const DTColor &placeHolderHoveredBC() const;
|
||||
void setPlaceHolderHoveredBC(const DTColor &newPlaceHolderHoveredBC);
|
||||
|
||||
const DTColor &placeHolderDisableBC() const;
|
||||
void setPlaceHolderDisableBC(const DTColor &newPlaceHolderDisableBC);
|
||||
|
||||
const DTColor &inputNormalBC() const;
|
||||
void setInputNormalBC(const DTColor &newInputNormalBC);
|
||||
|
||||
signals:
|
||||
|
||||
void radiusChanged();
|
||||
|
||||
void leftRightPaddingChanged();
|
||||
|
||||
void upDownMarginChanged();
|
||||
|
||||
void spaceChange();
|
||||
|
||||
void normalWidthChanged();
|
||||
|
||||
void normalHeightChanged();
|
||||
|
||||
void normalBCChanged();
|
||||
|
||||
void clickedBCChanged();
|
||||
|
||||
void hoveredBCChanged();
|
||||
|
||||
void disableBCChanged();
|
||||
|
||||
void disableTextColorChanged();
|
||||
|
||||
void normalTextColorChanged();
|
||||
|
||||
void borderWidthChanged();
|
||||
|
||||
void focusBorderWidthChanged();
|
||||
|
||||
void normalBorderColorChanged();
|
||||
|
||||
void clickBorderColorChanged();
|
||||
|
||||
void disableBorderColorChanged();
|
||||
|
||||
void focusBorderColorChanged();
|
||||
|
||||
void hoverBorderColorChanged();
|
||||
|
||||
void placeHolderNormalTextColorChanged();
|
||||
|
||||
void placeHolderDisableTextColorChanged();
|
||||
|
||||
void placeHolderNormalBCChanged();
|
||||
|
||||
void placeHolderClickedBCChanged();
|
||||
|
||||
void placeHolderHoveredBCChanged();
|
||||
|
||||
void placeHolderDisableBCChanged();
|
||||
|
||||
void inputNormalBCChanged();
|
||||
|
||||
private:
|
||||
|
||||
double m_radius;
|
||||
double m_leftRightPadding;
|
||||
double m_upDownMargin;
|
||||
double m_space;
|
||||
int m_normalWidth;
|
||||
int m_normalHeight;
|
||||
DTColor m_normalBC;
|
||||
DTColor m_clickedBC;
|
||||
DTColor m_hoveredBC;
|
||||
DTColor m_disableBC;
|
||||
DTColor m_disableTextColor;
|
||||
DTColor m_normalTextColor;
|
||||
int m_borderWidth;
|
||||
int m_focusBorderWidth;
|
||||
DTColor m_normalBorderColor;
|
||||
DTColor m_clickBorderColor;
|
||||
DTColor m_disableBorderColor;
|
||||
DTColor m_focusBorderColor;
|
||||
DTColor m_hoverBorderColor;
|
||||
DTColor m_placeHolderNormalTextColor;
|
||||
DTColor m_placeHolderDisableTextColor;
|
||||
DTColor m_placeHolderNormalBC;
|
||||
DTColor m_placeHolderClickedBC;
|
||||
DTColor m_placeHolderHoveredBC;
|
||||
DTColor m_placeHolderDisableBC;
|
||||
DTColor m_inputNormalBC;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUITextFiled, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUITEXTFILED_H
|
|
@ -1,128 +0,0 @@
|
|||
#include "ukuitooltip.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
using namespace UKUIQQC2Style;
|
||||
|
||||
UKUIToolTip::UKUIToolTip(QQuickItem *parent) : QQuickItem(parent)
|
||||
{
|
||||
if(!qApp || !qApp->property("qqc2-globaltoken").isValid())
|
||||
return;
|
||||
TokenParameter * token = qApp->property("qqc2-globaltoken").value<TokenParameter *>();
|
||||
m_instance = token->getInstance();
|
||||
initParam(m_instance);
|
||||
connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, [=](){
|
||||
initParam(m_instance);
|
||||
});
|
||||
}
|
||||
|
||||
UKUIToolTip::~UKUIToolTip()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UKUIToolTip::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance)
|
||||
{
|
||||
setPadding(12);
|
||||
setBackColor(instance->baseActive());
|
||||
setBackBorderColor(instance->kLineWindowAcitive());
|
||||
//setShadowColor(instance->kShadowMin());
|
||||
setTextColor(instance->windowTextActive());
|
||||
setRadius(6);
|
||||
}
|
||||
|
||||
UKUIToolTip* UKUIToolTip::qmlAttachedProperties(QObject* parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new UKUIToolTip(p);
|
||||
}
|
||||
|
||||
int UKUIToolTip::padding() const
|
||||
{
|
||||
return m_padding;
|
||||
}
|
||||
|
||||
void UKUIToolTip::setPadding(int newPadding)
|
||||
{
|
||||
if (m_padding == newPadding)
|
||||
return;
|
||||
m_padding = newPadding;
|
||||
emit paddingChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIToolTip::backColor() const
|
||||
{
|
||||
return m_backColor;
|
||||
}
|
||||
|
||||
void UKUIToolTip::setBackColor(const DTColor &newBackColor)
|
||||
{
|
||||
if (m_backColor == newBackColor)
|
||||
return;
|
||||
m_backColor = newBackColor;
|
||||
emit backColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIToolTip::backBorderColor() const
|
||||
{
|
||||
return m_backBorderColor;
|
||||
}
|
||||
|
||||
void UKUIToolTip::setBackBorderColor(const DTColor &newBackBorderColor)
|
||||
{
|
||||
if (m_backBorderColor == newBackBorderColor)
|
||||
return;
|
||||
m_backBorderColor = newBackBorderColor;
|
||||
emit backBorderColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIToolTip::shadowColor() const
|
||||
{
|
||||
return m_shadowColor;
|
||||
}
|
||||
|
||||
void UKUIToolTip::setShadowColor(const DTColor &newShadowColor)
|
||||
{
|
||||
if (m_shadowColor == newShadowColor)
|
||||
return;
|
||||
m_shadowColor = newShadowColor;
|
||||
emit shadowColorChanged();
|
||||
}
|
||||
|
||||
const DTColor &UKUIToolTip::textColor() const
|
||||
{
|
||||
return m_textColor;
|
||||
}
|
||||
|
||||
void UKUIToolTip::setTextColor(const DTColor &newTextColor)
|
||||
{
|
||||
if (m_textColor == newTextColor)
|
||||
return;
|
||||
m_textColor = newTextColor;
|
||||
emit textColorChanged();
|
||||
}
|
||||
|
||||
int UKUIToolTip::radius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
void UKUIToolTip::setRadius(int newRadius)
|
||||
{
|
||||
if (m_radius == newRadius)
|
||||
return;
|
||||
m_radius = newRadius;
|
||||
emit radiusChanged();
|
||||
}
|
||||
|
||||
int UKUIToolTip::margins() const
|
||||
{
|
||||
return m_margins;
|
||||
}
|
||||
|
||||
void UKUIToolTip::setMargins(int newMargins)
|
||||
{
|
||||
if (m_margins == newMargins)
|
||||
return;
|
||||
m_margins = newMargins;
|
||||
emit marginsChanged();
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2023, KylinSoft Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Yan Wang <wangyan@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUITOOLTIP_H
|
||||
#define UKUITOOLTIP_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickItem>
|
||||
#include "tokenparameter.h"
|
||||
|
||||
namespace UKUIQQC2Style {
|
||||
|
||||
class UKUIToolTip : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged)
|
||||
Q_PROPERTY(DTColor backColor READ backColor WRITE setBackColor NOTIFY backColorChanged)
|
||||
Q_PROPERTY(DTColor backBorderColor READ backBorderColor WRITE setBackBorderColor NOTIFY backBorderColorChanged)
|
||||
Q_PROPERTY(DTColor shadowColor READ shadowColor WRITE setShadowColor NOTIFY shadowColorChanged)
|
||||
Q_PROPERTY(DTColor textColor READ textColor WRITE setTextColor NOTIFY textColorChanged)
|
||||
Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
Q_PROPERTY(int margins READ margins WRITE setMargins NOTIFY marginsChanged)
|
||||
|
||||
public:
|
||||
explicit UKUIToolTip(QQuickItem *parent = nullptr);
|
||||
~UKUIToolTip();
|
||||
|
||||
void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance);
|
||||
|
||||
static UKUIToolTip* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
int padding() const;
|
||||
void setPadding(int newPadding);
|
||||
|
||||
const DTColor &backColor() const;
|
||||
void setBackColor(const DTColor &newBackColor);
|
||||
|
||||
const DTColor &backBorderColor() const;
|
||||
void setBackBorderColor(const DTColor &newBackBorderColor);
|
||||
|
||||
const DTColor &shadowColor() const;
|
||||
void setShadowColor(const DTColor &newShadowColor);
|
||||
|
||||
const DTColor &textColor() const;
|
||||
void setTextColor(const DTColor &newTextColor);
|
||||
|
||||
int radius() const;
|
||||
void setRadius(int newRadius);
|
||||
|
||||
int margins() const;
|
||||
void setMargins(int newMargins);
|
||||
|
||||
signals:
|
||||
void paddingChanged();
|
||||
|
||||
void backColorChanged();
|
||||
|
||||
void backBorderColorChanged();
|
||||
|
||||
void shadowColorChanged();
|
||||
|
||||
void textColorChanged();
|
||||
|
||||
void radiusChanged();
|
||||
|
||||
void marginsChanged();
|
||||
|
||||
private:
|
||||
int m_padding = 12;
|
||||
DTColor m_backColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.85));
|
||||
DTColor m_backBorderColor = DTColor(QColor::fromRgbF(1, 1, 1));
|
||||
DTColor m_shadowColor = DTColor(QColor::fromRgbF(0, 0, 0, 0.3));
|
||||
DTColor m_textColor;
|
||||
int m_radius = 6;
|
||||
int m_margins = 6;
|
||||
|
||||
UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIToolTip, QML_HAS_ATTACHED_PROPERTIES)
|
||||
|
||||
#endif // UKUITOOLTIP_H
|
|
@ -11,15 +11,13 @@ find_package(Qt5 CONFIG REQUIRED COMPONENTS
|
|||
Gui
|
||||
)
|
||||
|
||||
file(GLOB QML_FILES "org.ukui.style/*.qml" "qml/*.qml")
|
||||
file(GLOB QML_FILES "org.ukui.style/*.qml")
|
||||
file(GLOB PRIVATE_FILES "org.ukui.style/private/*")
|
||||
file(GLOB_RECURSE OTHER_FILES qmldir qml.qrc)
|
||||
|
||||
SOURCE_GROUP("QMLFiles" FILES ${QML_FILES})
|
||||
SOURCE_GROUP("QMLPrivateFiles" FILES ${PRIVATE_FILES})
|
||||
SOURCE_GROUP("other files" FILES ${OTHER_FILES})
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${QMLFiles} ${QMLPrivateFiles} ${OTHER_FILES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${QMLFiles} ${QMLPrivateFiles} )
|
||||
|
||||
if(UNIX)
|
||||
# file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/org.ukui.style/*.qml)
|
||||
|
|
|
@ -6,49 +6,36 @@ import org.ukui.qqc2style.private 1.0 as StylePrivate
|
|||
|
||||
T.Button {
|
||||
id: controlRoot
|
||||
implicitWidth: {
|
||||
var contentwidth = implicitContentWidth + leftPadding + rightPadding
|
||||
return Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
contentwidth)
|
||||
}
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
|
||||
leftPadding: StylePrivate.UKUIButton.margin
|
||||
rightPadding: StylePrivate.UKUIButton.margin
|
||||
/* The value type of buttonType are "CloseButton","MaxButton","MinButton","blueButton","Default". */
|
||||
StylePrivate.StyleHelper.buttonType: state
|
||||
|
||||
|
||||
implicitWidth: background.implicitWidth
|
||||
implicitHeight: background.implicitHeight
|
||||
|
||||
hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7?
|
||||
|
||||
contentItem: Item {}
|
||||
|
||||
font: StylePrivate.APPParameter.font
|
||||
|
||||
NormalControlColor{
|
||||
id:ncColor
|
||||
// onControlColorChanged:{
|
||||
// console.log("onControlColorChanged...........", controlRoot.text, ncColor.controlColor)
|
||||
// }
|
||||
background: StylePrivate.StyleItem {
|
||||
id: styleitem
|
||||
anchors.fill: parent
|
||||
buttonType: controlRoot.StylePrivate.StyleHelper.buttonType
|
||||
control: controlRoot
|
||||
elementType: "button"
|
||||
sunken: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)
|
||||
raised: !(controlRoot.pressed || (controlRoot.checkable && controlRoot.checked))
|
||||
hover: controlRoot.hovered
|
||||
text: controlRoot.text
|
||||
hasFocus: controlRoot.activeFocus
|
||||
activeControl: controlRoot.isDefault ? "default" : "f"
|
||||
properties: {
|
||||
"icon": controlRoot.icon && controlRoot.display !== T.AbstractButton.TextOnly ? (controlRoot.icon.name || controlRoot.icon.source) : "",
|
||||
"iconWidth": controlRoot.icon && controlRoot.icon.width ? controlRoot.icon.width : 0,
|
||||
"iconHeight": controlRoot.icon && controlRoot.icon.height ? controlRoot.icon.height : 0,
|
||||
"flat": controlRoot.flat
|
||||
}
|
||||
}
|
||||
|
||||
// StylePrivate.UKUIButton{
|
||||
// id: btn
|
||||
// Component.onCompleted: console.log("UKUIButton 1122333", btn.normalHBC)
|
||||
|
||||
// }
|
||||
// StylePrivate.APPParameter{
|
||||
// id: appP
|
||||
|
||||
// Component.onCompleted: console.log("APPParameter 1122333")
|
||||
// }
|
||||
contentItem: IconLabelContent {
|
||||
controlRoot: controlRoot
|
||||
anchors.centerIn: controlRoot
|
||||
//onWidthChanged: console.log(controlRoot.text, width)
|
||||
}
|
||||
background: BackGroundRectangle{
|
||||
controlRoot: controlRoot
|
||||
_radius: StylePrivate.UKUIButton.radius
|
||||
//Component.onCompleted: console.log("BackGroundRectangle radius", StylePrivate.UKUIButton.radius, StylePrivate.UKUIButton.normalBC)
|
||||
}
|
||||
//Component.onCompleted: console.log("Button radius", StylePrivate.UKUIButton.radius, StylePrivate.UKUIButton.normalBC, StylePrivate.UKUIPopup.shadowColor)
|
||||
|
||||
}
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
|
||||
T.CheckBox {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding,
|
||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: 6
|
||||
spacing: StylePrivate.UKUICheckBox.space
|
||||
|
||||
// keep in sync with CheckDelegate.qml (shared CheckIndicator.qml was removed for performance reasons)
|
||||
indicator: Rectangle {
|
||||
implicitWidth: StylePrivate.UKUICheckBox.indicatorWidth
|
||||
implicitHeight: StylePrivate.UKUICheckBox.indicatorWidth
|
||||
|
||||
x: control.text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
|
||||
y: control.topPadding + (control.availableHeight - height) / 2
|
||||
radius: StylePrivate.UKUICheckBox.radius
|
||||
|
||||
border.width: StylePrivate.UKUICheckBox.borderWidth
|
||||
border.color: control.checked ? (!control.enabled ? StylePrivate.UKUICheckBox.checked_disableIndicatorBorderColor :
|
||||
control.pressed ? StylePrivate.UKUICheckBox.checked_clickIndicatorBorderColor : control.hovered ?
|
||||
StylePrivate.UKUICheckBox.checked_hoverIndicatorBorderColor : StylePrivate.UKUICheckBox.checked_normalIndicatorBorderColor) :
|
||||
(!control.enabled ? StylePrivate.UKUICheckBox.disableIndicatorBorderColor : control.pressed ?
|
||||
StylePrivate.UKUICheckBox.clickIndicatorBorderColor : control.hovered ?
|
||||
StylePrivate.UKUICheckBox.hoverIndicatorBorderColor : StylePrivate.UKUICheckBox.normalIndicatorBorderColor)
|
||||
color: control.checked ? (!control.enabled ? StylePrivate.UKUICheckBox.checked_disableIndicatorColor :
|
||||
control.pressed ? StylePrivate.UKUICheckBox.checked_clickIndicatorColor : control.hovered ?
|
||||
StylePrivate.UKUICheckBox.checked_hoverIndicatorColor : StylePrivate.UKUICheckBox.checked_normalIndicatorColor) :
|
||||
(!control.enabled ? StylePrivate.UKUICheckBox.disableIndicatorColor : control.pressed ?
|
||||
StylePrivate.UKUICheckBox.clickIndicatorColor : control.hovered ?
|
||||
StylePrivate.UKUICheckBox.hoverIndicatorColor : StylePrivate.UKUICheckBox.normalIndicatorColor)
|
||||
|
||||
Image {
|
||||
x: (parent.width - width) / 2
|
||||
y: (parent.height - height) / 2
|
||||
width: 14
|
||||
height: 12
|
||||
// defaultColor: "#353637"
|
||||
// color: control.palette.text
|
||||
source: {
|
||||
var model = !control.enabled ? "disenable" : control.checked ? "clicked" : "normal"
|
||||
return "image://imageProvider/" + "object-select-symbolic" + "/" + model;
|
||||
}
|
||||
visible: control.checkState === Qt.Checked
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
x: (parent.width - width) / 2
|
||||
y: (parent.height - height) / 2
|
||||
width: 9
|
||||
height: 1
|
||||
color: {
|
||||
!control.enabled ? StylePrivate.UKUICheckBox.checked_disableChildrenColor :
|
||||
control.pressed ? StylePrivate.UKUICheckBox.checked_clickChildrenColor:
|
||||
control.hovered ? StylePrivate.UKUICheckBox.checked_hoverChildrenColor:
|
||||
StylePrivate.UKUICheckBox.checked_normalChildrenColor
|
||||
}
|
||||
visible: control.checkState === Qt.PartiallyChecked
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: Label {
|
||||
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
|
||||
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
|
||||
|
||||
text: control.text
|
||||
font: StylePrivate.APPParameter.font
|
||||
color: control.enabled ? StylePrivate.UKUICheckBox.normalTextColor : StylePrivate.UKUICheckBox.disableTextColor
|
||||
}
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL3$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or later as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 2.0 requirements will be
|
||||
** met: http://www.gnu.org/licenses/gpl-2.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Controls.impl 2.15
|
||||
import QtQuick.Templates 2.15 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.ComboBox {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding,
|
||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||
padding: StylePrivate.UKUIComboBox.leftRightPadding
|
||||
leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
|
||||
rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
|
||||
hoverEnabled: true
|
||||
delegate: ItemDelegate {
|
||||
width: ListView.view.width - scrollbar.width
|
||||
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
|
||||
hoverEnabled: control.hoverEnabled
|
||||
}
|
||||
|
||||
indicator: Image {
|
||||
x: control.mirrored ? control.padding : control.width - width - control.padding
|
||||
y: control.topPadding + (control.availableHeight - height) / 2
|
||||
width: StylePrivate.APPParameter.iconWidth
|
||||
height: width
|
||||
source: {
|
||||
var model = !control.enabled ? "disenable" : "normal"
|
||||
|
||||
if(!popup.visible){
|
||||
return "image://imageProvider/" + "ukui-down-symbolic" + "/" + model;
|
||||
}
|
||||
else{
|
||||
return "image://imageProvider/" + "ukui-up-symbolic" + "/" + model;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: T.TextField {
|
||||
leftPadding: 0//!control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
|
||||
rightPadding:0// control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
|
||||
anchors.verticalCenter: control.verticalCenter
|
||||
|
||||
text: control.editable ? control.editText : control.displayText
|
||||
|
||||
enabled: control.editable
|
||||
autoScroll: control.editable
|
||||
readOnly: control.down
|
||||
inputMethodHints: control.inputMethodHints
|
||||
validator: control.validator
|
||||
selectByMouse: control.selectTextByMouse
|
||||
|
||||
font: StylePrivate.APPParameter.font
|
||||
color: !control.enabled ? StylePrivate.UKUIComboBox.disableTextColor : StylePrivate.UKUIComboBox.normalTextColor
|
||||
selectionColor: control.palette.highlight
|
||||
selectedTextColor: control.palette.highlightedText
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
implicitWidth: StylePrivate.UKUIComboBox.normalWidth
|
||||
implicitHeight: StylePrivate.UKUIComboBox.normalHeight
|
||||
radius: StylePrivate.UKUIComboBox.radius
|
||||
|
||||
color: StylePrivate.UKUIComboBox.normalBC
|
||||
border.color: !control.enabled ? StylePrivate.UKUIComboBox.disableBorderColor : control.focus ? StylePrivate.UKUIComboBox.focusBorderColor : StylePrivate.UKUIComboBox.normalBorderColor
|
||||
border.width: control.focus ? StylePrivate.UKUIComboBox.focusBorderWidth : StylePrivate.UKUIComboBox.borderWidth;
|
||||
}
|
||||
|
||||
popup: Popup {
|
||||
y: control.height
|
||||
width: control.width
|
||||
height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin)
|
||||
topMargin: 6
|
||||
bottomMargin: 6
|
||||
|
||||
contentItem: ListView {
|
||||
clip: true
|
||||
implicitHeight: contentHeight
|
||||
model: control.delegateModel
|
||||
currentIndex: control.highlightedIndex
|
||||
highlightMoveDuration: 0
|
||||
interactive: true
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
id: scrollbar
|
||||
active: hovered || pressed
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL3$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or later as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 2.0 requirements will be
|
||||
** met: http://www.gnu.org/licenses/gpl-2.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.impl 2.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.ItemDelegate {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding,
|
||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: 12
|
||||
spacing: StylePrivate.APPParameter.space
|
||||
|
||||
icon.width: StylePrivate.APPParameter.iconWidth
|
||||
icon.height: StylePrivate.APPParameter.iconWidth
|
||||
// icon.color: control.palette.text
|
||||
|
||||
contentItem: IconLabel {
|
||||
spacing: control.spacing
|
||||
mirrored: control.mirrored
|
||||
display: control.display
|
||||
alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft
|
||||
|
||||
icon: control.icon
|
||||
text: control.text
|
||||
font: StylePrivate.APPParameter.font
|
||||
color: control.enabled ? StylePrivate.UKUIItemDelegate.normalTextColor : StylePrivate.UKUIItemDelegate.disableTextColor
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
anchors.fill: control
|
||||
radius: StylePrivate.UKUIItemDelegate.radius
|
||||
border.width: StylePrivate.UKUIItemDelegate.borderWidth
|
||||
border.color: !control.enabled ? StylePrivate.UKUIItemDelegate.disableBorderColor : control.pressed ? StylePrivate.UKUIItemDelegate.clickBorderColor :
|
||||
control.hovered ? StylePrivate.UKUIItemDelegate.hoverBorderColor : StylePrivate.UKUIItemDelegate.normalBorderColor
|
||||
// implicitWidth: 100
|
||||
// implicitHeight: 40
|
||||
// visible: control.down || control.highlighted || control.visualFocus
|
||||
color: !control.enabled ? StylePrivate.UKUIItemDelegate.disableBC : control.pressed ? StylePrivate.UKUIItemDelegate.clickedBC :
|
||||
control.hovered ? StylePrivate.UKUIItemDelegate.hoveredBC : StylePrivate.UKUIItemDelegate.normalBC
|
||||
}
|
||||
}
|
|
@ -8,8 +8,10 @@ import org.ukui.qqc2style.private 1.0 as StylePrivate
|
|||
|
||||
T.Label {
|
||||
id:control
|
||||
color: enabled ? StylePrivate.UKUILabel.normalColor : StylePrivate.UKUILabel.disableColor//StylePrivate.UKUILable.normalColor
|
||||
linkColor: StylePrivate.UKUILabel.linkColor
|
||||
|
||||
font: StylePrivate.APPParameter.font//appP.font
|
||||
color:StylePrivate.StyleHelper.windowtextcolorrole
|
||||
linkColor: control.palette.link
|
||||
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
}
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 2.5 as Controls
|
||||
import QtQuick.Controls 2.5
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.Menu {
|
||||
id: control
|
||||
// StylePrivate.APPParameter{
|
||||
// id: appP
|
||||
// }
|
||||
palette: StylePrivate.APPParameter.palette
|
||||
font: StylePrivate.APPParameter.font
|
||||
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
|
||||
|
@ -22,18 +19,8 @@ T.Menu {
|
|||
|
||||
margins: 0
|
||||
|
||||
leftPadding: StylePrivate.UKUIMenu.leftRightPadding
|
||||
rightPadding: StylePrivate.UKUIMenu.leftRightPadding
|
||||
topPadding: StylePrivate.UKUIMenu.topBottomPadding
|
||||
bottomPadding: StylePrivate.UKUIMenu.topBottomPadding
|
||||
delegate: MenuItem { onImplicitWidthChanged: control.contentItem.contentItem.childrenChanged() }
|
||||
|
||||
// StylePrivate.UKUIMenu{
|
||||
// id: uMenu
|
||||
// }
|
||||
|
||||
delegate: MenuItem {
|
||||
id: item
|
||||
}
|
||||
contentItem: ListView {
|
||||
implicitHeight: contentHeight
|
||||
property bool hasCheckables: false
|
||||
|
@ -43,73 +30,31 @@ T.Menu {
|
|||
implicitWidth: {
|
||||
var maxWidth = 0;
|
||||
for (var i = 0; i < contentItem.children.length; ++i) {
|
||||
if(!(contentItem.children[i] instanceof Controls.MenuSeparator))
|
||||
maxWidth = Math.max(maxWidth, contentItem.children[i].width);
|
||||
//console.log("maxwidth..... iiiii,,,", contentItem.children[i].text, contentItem.children[i], contentItem.children[i].width, contentItem.children[i].implicitWidth)
|
||||
maxWidth = Math.max(maxWidth, contentItem.children[i].implicitWidth);
|
||||
}
|
||||
return maxWidth + scrollbar.width;
|
||||
return maxWidth;
|
||||
}
|
||||
|
||||
//todo why ApplicationWindow.window is null
|
||||
interactive: true//ApplicationWindow.window ? contentHeight > ApplicationWindow.window.height : false
|
||||
clip: true//interactive
|
||||
interactive: ApplicationWindow.window ? contentHeight > ApplicationWindow.window.height : false
|
||||
clip: true
|
||||
currentIndex: control.currentIndex || 0
|
||||
keyNavigationEnabled: true
|
||||
keyNavigationWraps: true
|
||||
|
||||
//Component.onCompleted: console.log("listview......", ApplicationWindow.window.height)
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
id: scrollbar
|
||||
active: hovered || pressed
|
||||
}
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("componenttttttttttttttttttt");
|
||||
console.log("listview height....", count, title, ApplicationWindow.window, Window.window, ApplicationWindow, Window, contentHeight)
|
||||
}
|
||||
Connections {
|
||||
target: control.contentItem.contentItem
|
||||
function onChildrenChanged() {
|
||||
console.log("onChildrenChanged............", control.contentItem, control.contentItem.contentItem)
|
||||
var checkable = false;
|
||||
var needIcon = false;
|
||||
onChildrenChanged: {
|
||||
for (var i in control.contentItem.contentItem.children) {
|
||||
var child = control.contentItem.contentItem.children[i];
|
||||
if (child.checkable) {
|
||||
control.contentItem.hasCheckables = true;
|
||||
checkable = true;
|
||||
}
|
||||
if (child.icon && child.icon.hasOwnProperty("name") && (child.icon.name.length > 0 || child.icon.source.toString().length > 0)) {
|
||||
if (child.icon && child.icon.hasOwnProperty("name") && (child.icon.name.length > 0 || child.icon.source.length > 0)) {
|
||||
control.contentItem.hasIcons = true;
|
||||
needIcon = true;
|
||||
}
|
||||
}
|
||||
if(checkable){
|
||||
for (var k in control.contentItem.contentItem.children) {
|
||||
var childk = control.contentItem.contentItem.children[k];
|
||||
if(childk.hasOwnProperty("itemLeftSpace")){
|
||||
childk.itemLeftSpace = 20 + childk.leftPadding;
|
||||
console.log("itemLeftSpace........", childk.text, childk.itemLeftSpace)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(needIcon){
|
||||
for (var j in control.contentItem.contentItem.children) {
|
||||
var childj = control.contentItem.contentItem.children[j];
|
||||
var b = childj.icon && childj.icon.hasOwnProperty("name") && (childj.icon.name.length > 0 || childj.icon.source.toString().length > 0);
|
||||
if(childj.hasOwnProperty("labelLeftSpace"))
|
||||
childj.labelLeftSpace = b ? 4 : 20;
|
||||
}
|
||||
}
|
||||
var maxWidth = 0;
|
||||
for (var l in control.contentItem.contentItem.children) {
|
||||
maxWidth = Math.max(maxWidth, control.contentItem.contentItem.children[l].width)
|
||||
}
|
||||
for (var m in control.contentItem.contentItem.children) {
|
||||
control.contentItem.contentItem.children[m].width = maxWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,20 +79,19 @@ T.Menu {
|
|||
}
|
||||
|
||||
background: Rectangle {
|
||||
radius: StylePrivate.UKUIMenu.radius
|
||||
radius: 2
|
||||
|
||||
color: control.palette.window
|
||||
|
||||
color: StylePrivate.UKUIMenu.normalBC
|
||||
border.color: StylePrivate.UKUIMenu.normalBorderColor
|
||||
border.width: StylePrivate.UKUIMenu.border
|
||||
layer.enabled: true
|
||||
|
||||
layer.effect: DropShadow {
|
||||
transparentBorder: true
|
||||
radius: StylePrivate.UKUIMenu.radius
|
||||
samples: StylePrivate.UKUIMenu.radius
|
||||
radius: 8
|
||||
samples: 8
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 2
|
||||
color: enabled ? StylePrivate.UKUIMenu.shadowNormalColor : StylePrivate.UKUIMenu.shadowDisableColor
|
||||
color: Qt.rgba(0, 0, 0, 0.3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,46 +8,30 @@ import QtQuick.Controls 2.5
|
|||
T.MenuItem {
|
||||
id: controlRoot
|
||||
|
||||
palette: StylePrivate.APPParameter.palette
|
||||
font: StylePrivate.APPParameter.font
|
||||
|
||||
|
||||
width: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
image.width + label.width + labelLeftSpace + leftPadding + rightPadding +
|
||||
(controlRoot.checkable ? /*arrow.implicitWidth*/StylePrivate.UKUIMenuItem.imageWidth + StylePrivate.UKUIMenuItem.imageSpace : 0) +
|
||||
(controlRoot.subMenu ? /*indicator.implicitWidth*/StylePrivate.UKUIMenuItem.imageWidth + StylePrivate.UKUIMenuItem.imageSpace : 0) + itemLeftSpace)
|
||||
implicitHeight: visible ? Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
Math.max(contentItem.height,
|
||||
controlRoot.subMenu ? indicator.implicitHeight : 0) + topPadding + bottomPadding, StylePrivate.UKUIMenuItem.normalHeight) : 0
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
contentItem.implicitWidth + leftPadding + rightPadding + (arrow ? arrow.implicitWidth : 0))
|
||||
implicitHeight: visible ? Math.max(background ? background.implicitHeight : 0,
|
||||
Math.max(contentItem.implicitHeight,
|
||||
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) : 0
|
||||
baselineOffset: contentItem.y + contentItem.baselineOffset
|
||||
|
||||
// Layout.fillWidth: true
|
||||
padding: StylePrivate.UKUIMenuItem.topBottomPadding
|
||||
width: parent ? parent.width : implicitWidth
|
||||
|
||||
Layout.fillWidth: true
|
||||
padding: 6
|
||||
|
||||
|
||||
property int gridUnit: fontMetrics.height
|
||||
property int labelLeftSpace: 0
|
||||
property int itemLeftSpace: (!controlRoot.checkable/* && !controlRoot.subMenu*/) ? controlRoot.leftPadding : 20 + controlRoot.leftPadding
|
||||
property alias backColor: backrect.color
|
||||
property string icontype: "default"
|
||||
|
||||
|
||||
leftPadding: StylePrivate.UKUIMenuItem.leftRightPadding/* : Math.floor(gridUnit/4)*2*/
|
||||
rightPadding: StylePrivate.UKUIMenuItem.leftRightPadding// Math.floor(gridUnit/4)*2
|
||||
leftPadding: Math.floor(gridUnit/4)*2
|
||||
rightPadding: Math.floor(gridUnit/4)*2
|
||||
hoverEnabled: true
|
||||
|
||||
|
||||
// StylePrivate.APPParameter{
|
||||
// id: appP
|
||||
// }
|
||||
// StylePrivate.UKUIButton{
|
||||
// id: btn
|
||||
// }
|
||||
// StylePrivate.UKUIMenuItem{
|
||||
// id: mItem
|
||||
// }
|
||||
NormalControlColor{
|
||||
id:ncColor
|
||||
}
|
||||
Shortcut {
|
||||
//in case of explicit & the button manages it by itself
|
||||
enabled: !(RegExp(/\&[^\&]/).test(controlRoot.text))
|
||||
|
@ -61,110 +45,60 @@ T.MenuItem {
|
|||
}
|
||||
}
|
||||
|
||||
contentItem:Item{
|
||||
anchors.left: controlRoot.left
|
||||
anchors.leftMargin: itemLeftSpace
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: controlRoot.rightPadding
|
||||
Image {
|
||||
id: image
|
||||
source: //controlRoot.icon.source
|
||||
{
|
||||
if((controlRoot.icon.source.toString() === "" && controlRoot.icon.name.toString() === ""))
|
||||
return controlRoot.icon.source
|
||||
contentItem: RowLayout {
|
||||
Item {
|
||||
Layout.preferredWidth: (controlRoot.ListView.view && controlRoot.ListView.view.hasCheckables) || controlRoot.checkable ? controlRoot.indicator.width : Math.floor(gridUnit/4)
|
||||
}
|
||||
|
||||
var model = !controlRoot.enabled ? "disenable" : controlRoot.pressed ? "clicked" : controlRoot.hovered ? "hover" : "normal"
|
||||
|
||||
let s = controlRoot.icon.source.toString()
|
||||
return "image://imageProvider/" + s + "/" + model;
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: (controlRoot.display !== AbstractButton.TextOnly && source !== "" && status != Image.Null) ? StylePrivate.UKUIMenuItem.imageWidth : 0
|
||||
visible: controlRoot.display !== AbstractButton.TextOnly && source !== "" && status != Image.Null
|
||||
StylePrivate.KyIcon {
|
||||
iconName: controlRoot.icon.name
|
||||
width: controlRoot.icon.width
|
||||
height: controlRoot.icon.height
|
||||
sunken: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)
|
||||
hover: controlRoot.hovered
|
||||
hasFocus: controlRoot.activeFocus
|
||||
icontype: controlRoot.icontype
|
||||
}
|
||||
Label {
|
||||
id:label
|
||||
id: label
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: controlRoot.text
|
||||
font:controlRoot.font
|
||||
color: controlRoot.enabled ? StylePrivate.UKUIMenuItem.normalTextColor : StylePrivate.UKUIMenuItem.disableTextColor
|
||||
visible: controlRoot.display !== AbstractButton.IconOnly && text !== ""
|
||||
font: controlRoot.font
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Component.onCompleted: {
|
||||
// console.log(".............", label.text, image.visible, controlRoot.icon, controlRoot.icon.status === Image.Null, image.status == Image.Null)
|
||||
}
|
||||
anchors.left: image.right
|
||||
anchors.leftMargin: labelLeftSpace//(image.visible && image.status !== Image.Null) ? 4 : labelLeftSpace
|
||||
elide: Text.ElideRight
|
||||
visible: controlRoot.text
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
Label {
|
||||
id: shortcut
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
visible: controlRoot.action && controlRoot.action.hasOwnProperty("shortcut") && controlRoot.action.shortcut !== undefined
|
||||
text: visible ? controlRoot.action.shortcut : ""
|
||||
font: controlRoot.font
|
||||
color: label.color
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
Item {
|
||||
Layout.preferredWidth: Math.floor(gridUnit/4)
|
||||
}
|
||||
}
|
||||
|
||||
indicator: Image {
|
||||
x: controlRoot.mirrored ? controlRoot.width - width - controlRoot.rightPadding : controlRoot.leftPadding
|
||||
y: controlRoot.topPadding + (controlRoot.availableHeight - height) / 2
|
||||
background: Item {
|
||||
anchors.fill: parent
|
||||
implicitWidth: gridUnit * 8
|
||||
|
||||
visible: controlRoot.checked
|
||||
source: controlRoot.checkable ? "image://imageProvider/object-select-symbolic" : ""
|
||||
|
||||
width: StylePrivate.UKUIMenuItem.imageWidth
|
||||
height: StylePrivate.UKUIMenuItem.imageWidth
|
||||
}
|
||||
|
||||
arrow: Image {
|
||||
x: controlRoot.mirrored ? controlRoot.leftPadding : controlRoot.width - width - controlRoot.rightPadding
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: StylePrivate.UKUIMenuItem.imageWidth
|
||||
height: StylePrivate.UKUIMenuItem.imageWidth
|
||||
|
||||
visible: controlRoot.subMenu
|
||||
mirror: controlRoot.mirrored
|
||||
source: controlRoot.subMenu ? "image://imageProvider/ukui-end-symbolic" : ""
|
||||
}
|
||||
|
||||
background:
|
||||
Rectangle {
|
||||
id: backrect
|
||||
width: controlRoot.width
|
||||
height: controlRoot.height
|
||||
radius: StylePrivate.UKUIMenuItem.radius
|
||||
//opacity: (controlRoot.highlighted || controlRoot.hovered || controlRoot.pressed || controlRoot.checked) ? 1 : 0
|
||||
border.width: 1
|
||||
anchors.fill: parent
|
||||
opacity: (controlRoot.highlighted || controlRoot.hovered) ? 1 : 0
|
||||
|
||||
color: controlRoot.palette.highlight
|
||||
}
|
||||
}
|
||||
|
||||
onPressedChanged: {
|
||||
stateChange()
|
||||
}
|
||||
onHoveredChanged: {
|
||||
stateChange()
|
||||
|
||||
}
|
||||
Component.onCompleted: {
|
||||
stateChange()
|
||||
}
|
||||
|
||||
function stateChange()
|
||||
{
|
||||
//controlColor = !enable ? StylePrivate.UKUIButton.disableHBC : click ? StylePrivate.UKUIButton.clickedHBC : hover ? StylePrivate.UKUIButton.hoveredHBC : StylePrivate.UKUIButton.normalHBC
|
||||
|
||||
backColor = !controlRoot.enabled ? StylePrivate.UKUIMenuItem.disableBC :
|
||||
controlRoot.pressed ? StylePrivate.UKUIMenuItem.clickedBC :
|
||||
controlRoot.hovered ? StylePrivate.UKUIMenuItem.hoveredBC : StylePrivate.UKUIMenuItem.normalBC;
|
||||
|
||||
backrect.border.color = !controlRoot.enabled ? StylePrivate.UKUIMenuItem.disableBorderColor :
|
||||
controlRoot.pressed ? StylePrivate.UKUIMenuItem.clickBorderColor :
|
||||
controlRoot.hovered ? StylePrivate.UKUIMenuItem.hoverBorderColor : StylePrivate.UKUIMenuItem.normalBorderColor;
|
||||
}
|
||||
// onVisibleChanged: {
|
||||
// if(visible){
|
||||
// var backWidth = implicitBackgroundWidth + leftInset + rightInset;
|
||||
// var itemWidth = iconLabel.width + leftPadding + rightPadding +
|
||||
// (arrow.visible ? arrow.implicitWidth : 0) +
|
||||
// (indicator.visible ? indicator.implicitWidth : 0)
|
||||
// width = Math.max(backWidth, itemWidth)
|
||||
// console.log("menuitem visible..........", controlRoot.text, width, backWidth, itemWidth, iconLabel.width, implicitBackgroundWidth)
|
||||
|
||||
// }
|
||||
// }
|
||||
property variant fontMetrics: TextMetrics {
|
||||
text: "M"
|
||||
function roundedIconSize(size) {
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.ukui.qqc2style.private 1.0 as StylePrivate
|
|||
T.Popup {
|
||||
id: control
|
||||
|
||||
palette: StylePrivate.APPParameter.palette
|
||||
font: StylePrivate.APPParameter.font
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
|
||||
|
@ -18,15 +18,9 @@ T.Popup {
|
|||
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
|
||||
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
|
||||
|
||||
padding: StylePrivate.UKUIPopup.padding
|
||||
clip: false
|
||||
padding: 12
|
||||
clip: true
|
||||
|
||||
// StylePrivate.APPParameter{
|
||||
// id: appP
|
||||
// }
|
||||
// StylePrivate.UKUIPopup{
|
||||
// id: popup
|
||||
// }
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
|
@ -50,22 +44,18 @@ T.Popup {
|
|||
contentItem: Item { }
|
||||
|
||||
background: Rectangle {
|
||||
radius: StylePrivate.UKUIPopup.radius
|
||||
color: StylePrivate.UKUIPopup.backColor
|
||||
border.color: StylePrivate.UKUIPopup.backBorderColor
|
||||
radius: 2
|
||||
color: control.palette.window
|
||||
border.color: control.palette.dark
|
||||
layer.enabled: true
|
||||
|
||||
layer.effect: DropShadow {
|
||||
transparentBorder: true
|
||||
radius: StylePrivate.UKUIPopup.radius
|
||||
radius: 8
|
||||
samples: 16
|
||||
horizontalOffset: -4
|
||||
verticalOffset: -4
|
||||
width: background.width + 8
|
||||
height: background.height + 8
|
||||
color: StylePrivate.UKUIPopup.shadowColor
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 4
|
||||
color: Qt.rgba(0, 0, 0, 0.3)
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: console.log("popup....", StylePrivate.UKUIPopup.shadowColor, StylePrivate.UKUIPopup.padding)
|
||||
}
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL3$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or later as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 2.0 requirements will be
|
||||
** met: http://www.gnu.org/licenses/gpl-2.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.impl 2.12
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.ProgressBar {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
|
||||
background: Rectangle {
|
||||
radius: StylePrivate.UKUIProgressBar.radius
|
||||
implicitWidth: StylePrivate.UKUIProgressBar.normalWidth
|
||||
implicitHeight: StylePrivate.UKUIProgressBar.normalHeight
|
||||
|
||||
height: StylePrivate.UKUIProgressBar.normalHeight
|
||||
|
||||
color: StylePrivate.UKUIProgressBar.normalColor
|
||||
border.width: StylePrivate.UKUIProgressBar.borderWidth
|
||||
border.color: StylePrivate.UKUIProgressBar.borderColor
|
||||
}
|
||||
|
||||
contentItem: Item{
|
||||
implicitHeight: background.height
|
||||
implicitWidth: background.width
|
||||
Rectangle {
|
||||
x: !control.mirrored ? 0 : (control.width * (1.0 - control.position))
|
||||
implicitHeight: StylePrivate.UKUIProgressBar.normalHeight
|
||||
implicitWidth: control.width * control.position
|
||||
visible: !control.indeterminate
|
||||
//indeterminate: control.visible && control.indeterminate
|
||||
color: StylePrivate.UKUIProgressBar.childrenColor
|
||||
radius: StylePrivate.UKUIProgressBar.radius
|
||||
}
|
||||
Label{
|
||||
visible: !control.indeterminate
|
||||
anchors.centerIn: parent
|
||||
text: (control.position * 100).toString() + "%"
|
||||
}
|
||||
Rectangle {
|
||||
id:rec
|
||||
implicitHeight: StylePrivate.UKUIProgressBar.normalHeight
|
||||
implicitWidth: StylePrivate.UKUIProgressBar.indeterminateChildrenWidth
|
||||
visible: control.indeterminate
|
||||
//indeterminate: control.visible && control.indeterminate
|
||||
color: StylePrivate.UKUIProgressBar.childrenColor
|
||||
radius: StylePrivate.UKUIProgressBar.radius
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: slideTimer
|
||||
interval: 1
|
||||
running: control.indeterminate
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
slideAnimation.start()
|
||||
}
|
||||
}
|
||||
|
||||
PropertyAnimation {
|
||||
id: slideAnimation
|
||||
target: rec
|
||||
property: "x"
|
||||
to: rec.x + rec.width >= control.width ? 0 : control.width - rec.width
|
||||
duration: 500 + control.width
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
|
||||
T.RadioButton {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding,
|
||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||
|
||||
property alias indicatorColor: indicatorRec.color
|
||||
property alias childrenColor: childrenRec.color
|
||||
|
||||
padding: 6
|
||||
spacing: StylePrivate.UKUIRadioButton.space
|
||||
|
||||
// keep in sync with RadioDelegate.qml (shared RadioIndicator.qml was removed for performance reasons)
|
||||
indicator: Rectangle {
|
||||
id: indicatorRec
|
||||
implicitWidth: StylePrivate.UKUIRadioButton.indicatorWidth
|
||||
implicitHeight: implicitWidth
|
||||
|
||||
x: control.text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
|
||||
y: control.topPadding + (control.availableHeight - height) / 2
|
||||
|
||||
radius: width / 2
|
||||
border.width: StylePrivate.UKUIRadioButton.borderWidth
|
||||
border.color: control.checked ? (!control.enabled ? StylePrivate.UKUIRadioButton.checked_disableIndicatorBorderColor :
|
||||
control.pressed ? StylePrivate.UKUIRadioButton.checked_clickIndicatorBorderColor : control.hovered ?
|
||||
StylePrivate.UKUIRadioButton.checked_hoverIndicatorBorderColor : StylePrivate.UKUIRadioButton.checked_normalIndicatorBorderColor) :
|
||||
(!control.enabled ? StylePrivate.UKUIRadioButton.disableIndicatorBorderColor : control.pressed ?
|
||||
StylePrivate.UKUIRadioButton.clickIndicatorBorderColor : control.hovered ?
|
||||
StylePrivate.UKUIRadioButton.hoverIndicatorBorderColor : StylePrivate.UKUIRadioButton.normalIndicatorBorderColor)
|
||||
color: control.checked ? (!control.enabled ? StylePrivate.UKUIRadioButton.checked_disableIndicatorColor :
|
||||
control.pressed ? StylePrivate.UKUIRadioButton.checked_clickIndicatorColor : control.hovered ?
|
||||
StylePrivate.UKUIRadioButton.checked_hoverIndicatorColor : StylePrivate.UKUIRadioButton.checked_normalIndicatorColor) :
|
||||
(!control.enabled ? StylePrivate.UKUIRadioButton.disableIndicatorColor : control.pressed ?
|
||||
StylePrivate.UKUIRadioButton.clickIndicatorColor : control.hovered ?
|
||||
StylePrivate.UKUIRadioButton.hoverIndicatorColor : StylePrivate.UKUIRadioButton.normalIndicatorColor)
|
||||
|
||||
Rectangle {
|
||||
id:childrenRec
|
||||
width: StylePrivate.UKUIRadioButton.childrenWidth
|
||||
height: width
|
||||
anchors.centerIn: parent
|
||||
radius: width / 2
|
||||
color: {
|
||||
!control.enabled ? StylePrivate.UKUIRadioButton.checked_disableChildrenColor :
|
||||
control.pressed ? StylePrivate.UKUIRadioButton.checked_clickChildrenColor:
|
||||
control.hovered ? StylePrivate.UKUIRadioButton.checked_hoverChildrenColor:
|
||||
StylePrivate.UKUIRadioButton.checked_normalChildrenColor
|
||||
}
|
||||
visible: control.checked
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: Label {
|
||||
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
|
||||
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
|
||||
|
||||
text: control.text
|
||||
font: StylePrivate.APPParameter.font
|
||||
color: control.enabled ? StylePrivate.UKUIRadioButton.normalTextColor : StylePrivate.UKUIRadioButton.disableTextColor
|
||||
}
|
||||
}
|
|
@ -3,42 +3,41 @@ import QtQuick 2.6
|
|||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
|
||||
T.RoundButton {
|
||||
id: controlRoot
|
||||
implicitWidth: {
|
||||
var contentwidth = implicitContentWidth + leftPadding + rightPadding
|
||||
return Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
contentwidth)
|
||||
}
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
|
||||
leftPadding: StylePrivate.UKUIButton.margin
|
||||
rightPadding: StylePrivate.UKUIButton.margin
|
||||
/* The value type of buttonType are "CloseButton","MaxButton","MinButton","blueButton","Default". */
|
||||
StylePrivate.StyleHelper.buttonType: "Default"
|
||||
|
||||
|
||||
implicitWidth: background.implicitWidth
|
||||
implicitHeight: background.implicitHeight
|
||||
|
||||
hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7?
|
||||
|
||||
contentItem: Item {}
|
||||
|
||||
font: StylePrivate.APPParameter.font
|
||||
|
||||
NormalControlColor{
|
||||
id:ncColor
|
||||
}
|
||||
|
||||
// StylePrivate.UKUIButton{
|
||||
// id: btn
|
||||
// }
|
||||
// StylePrivate.APPParameter{
|
||||
// id: appP
|
||||
// }
|
||||
contentItem: IconLabelContent {
|
||||
controlRoot: controlRoot
|
||||
anchors.centerIn: controlRoot
|
||||
onWidthChanged: console.log(controlRoot.text, width)
|
||||
}
|
||||
background: BackGroundRectangle{
|
||||
controlRoot: controlRoot
|
||||
_radius: controlRoot.height/2
|
||||
background: StylePrivate.StyleItem {
|
||||
id: styleitem
|
||||
anchors.fill: parent
|
||||
buttonType: controlRoot.StylePrivate.StyleHelper.buttonType
|
||||
control: controlRoot
|
||||
elementType: "button"
|
||||
roundButton:"RoundButton"
|
||||
sunken: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)
|
||||
raised: !(controlRoot.pressed || (controlRoot.checkable && controlRoot.checked))
|
||||
hover: controlRoot.hovered
|
||||
text: controlRoot.text
|
||||
hasFocus: controlRoot.activeFocus
|
||||
activeControl: controlRoot.isDefault ? "default" : "f"
|
||||
properties: {
|
||||
"icon": controlRoot.icon && controlRoot.display !== T.AbstractButton.TextOnly ? (controlRoot.icon.name || controlRoot.icon.source) : "",
|
||||
"iconWidth": controlRoot.icon && controlRoot.icon.width ? controlRoot.icon.width : 0,
|
||||
"iconHeight": controlRoot.icon && controlRoot.icon.height ? controlRoot.icon.height : 0,
|
||||
"flat": controlRoot.flat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import org.ukui.qqc2style.private 1.0 as StylePrivate
|
|||
T.ScrollBar {
|
||||
id: control
|
||||
|
||||
palette: StylePrivate.APPParameter.palette
|
||||
font: StylePrivate.APPParameter.font
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
|
@ -19,38 +19,36 @@ T.ScrollBar {
|
|||
|
||||
hoverEnabled: true
|
||||
|
||||
padding: StylePrivate.UKUIScrollBar.padding
|
||||
visible: control.policy !== ScrollBar.AlwaysOff
|
||||
|
||||
// StylePrivate.APPParameter{
|
||||
// id: appP
|
||||
// }
|
||||
|
||||
// StylePrivate.UKUIScrollBar{
|
||||
// id: scrollbar
|
||||
// }
|
||||
padding: 2
|
||||
visible: control.policy !== T.ScrollBar.AlwaysOff
|
||||
|
||||
|
||||
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: control.interactive ? 4 : 2
|
||||
implicitHeight: control.interactive ? 4 : 2
|
||||
implicitWidth: control.interactive ? 6 : 2
|
||||
implicitHeight: control.interactive ? 6 : 2
|
||||
|
||||
radius: width / 2
|
||||
color: !control.enabled ? StylePrivate.UKUIScrollBar.disableColor : control.pressed ? StylePrivate.UKUIScrollBar.clickColor :
|
||||
control.hovered ? StylePrivate.UKUIScrollBar.hoverColor : StylePrivate.UKUIScrollBar.normalColor
|
||||
color: control.palette.shadow
|
||||
|
||||
opacity: 0.3
|
||||
|
||||
|
||||
states: State {
|
||||
name: "active"
|
||||
when: control.policy === ScrollBar.AlwaysOn || (control.active && control.size < 1.0)
|
||||
PropertyChanges { target: control.contentItem; implicitWidth:8; implicitHeight:8}
|
||||
when: control.policy === T.ScrollBar.AlwaysOn || (control.active && control.size < 1.0)
|
||||
PropertyChanges { target: control.contentItem; implicitWidth:8.5; implicitHeight:8.5; opacity:0.5}
|
||||
}
|
||||
|
||||
// transitions: Transition {
|
||||
// from: "active"
|
||||
// SequentialAnimation {
|
||||
// PauseAnimation { duration: 200 }
|
||||
// NumberAnimation { target: control.contentItem; duration: 80; property: "opacity"; to: 0.3}
|
||||
// }
|
||||
// }
|
||||
transitions: Transition {
|
||||
from: "active"
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 200 }
|
||||
NumberAnimation { target: control.contentItem; duration: 80; property: "opacity"; to: 0.3}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,16 +8,14 @@ import org.ukui.qqc2style.private 1.0 as StylePrivate
|
|||
T.ScrollView {
|
||||
id: controlRoot
|
||||
|
||||
palette: appP.palette
|
||||
font: appP.font
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
contentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
contentHeight + topPadding + bottomPadding)
|
||||
|
||||
StylePrivate.APPParameter{
|
||||
id: appP
|
||||
}
|
||||
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
parent: controlRoot
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL3$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or later as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 2.0 requirements will be
|
||||
** met: http://www.gnu.org/licenses/gpl-2.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.impl 2.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.Slider {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitHandleWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitHandleHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: 6
|
||||
|
||||
hoverEnabled: true
|
||||
handle: Rectangle {
|
||||
x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
|
||||
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
|
||||
implicitWidth: StylePrivate.UKUISlider.handleHeight
|
||||
implicitHeight: StylePrivate.UKUISlider.handleHeight
|
||||
radius: width / 2
|
||||
color: !control.enabled ? StylePrivate.UKUISlider.disableHandleColor : control.pressed ? StylePrivate.UKUISlider.clickHandleColor :
|
||||
control.hovered ?StylePrivate.UKUISlider.hoverHandleColor : StylePrivate.UKUISlider.normalHandleColor
|
||||
border.width: StylePrivate.UKUISlider.handleBorderWidth
|
||||
border.color: !control.enabled ? StylePrivate.UKUISlider.disableHandleBorderColor : control.pressed ? StylePrivate.UKUISlider.clickHandleBorderColor :
|
||||
control.hovered ? StylePrivate.UKUISlider.hoverHandleBorderColor : StylePrivate.UKUISlider.normalHandleBorderColor
|
||||
|
||||
}
|
||||
|
||||
background: Item{
|
||||
id: item
|
||||
|
||||
// x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2)
|
||||
// y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0)
|
||||
implicitWidth: control.horizontal ? (StylePrivate.UKUISlider.normalWidth + handle.width) : StylePrivate.UKUISlider.normalHeight
|
||||
implicitHeight: control.horizontal ? StylePrivate.UKUISlider.normalHeight : (StylePrivate.UKUISlider.normalWidth + handle.height)
|
||||
|
||||
Component.onCompleted: console.log("itemmmmmmm", item.width, item.height)
|
||||
Rectangle {
|
||||
width: item.width
|
||||
height: item.height
|
||||
border.color: StylePrivate.UKUISlider.focusBorderColor
|
||||
border.width: control.activeFocus ? StylePrivate.UKUISlider.focusBorderWidth : 0
|
||||
scale: control.horizontal && control.mirrored ? -1 : 1
|
||||
|
||||
Rectangle{
|
||||
id: unGroove
|
||||
x: (control.horizontal ? handle.width / 2 : ((item.width - width) / 2))
|
||||
y:(control.horizontal ? ((item.height - height) / 2) : handle.height / 2)
|
||||
width: control.horizontal ? (item.width - handle.width) : StylePrivate.UKUISlider.grooveHeight
|
||||
height: control.horizontal ? StylePrivate.UKUISlider.grooveHeight : (item.height - handle.height)
|
||||
radius: control.horizontal ? height/2 : width/2
|
||||
border.width: StylePrivate.UKUISlider.grooveBorderWidth
|
||||
border.color: !control.enabled ? StylePrivate.UKUISlider.disableUnGrooveBorderColor : StylePrivate.UKUISlider.normalUnGrooveBorderColor
|
||||
color: !control.enabled ? StylePrivate.UKUISlider.disableUnGrooveColor : StylePrivate.UKUISlider.normalUnGrooveColor
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id:groove
|
||||
x: (control.horizontal ? handle.width / 2 : ((item.width - width) / 2))
|
||||
y: (control.horizontal ? ((item.height - height) / 2) : handle.height / 2)
|
||||
width: control.horizontal ? control.position * unGroove.width : StylePrivate.UKUISlider.grooveHeight
|
||||
height: control.horizontal ? StylePrivate.UKUISlider.grooveHeight : control.position * unGroove.height
|
||||
radius: StylePrivate.UKUISlider.grooveHeight / 2
|
||||
border.width: StylePrivate.UKUISlider.grooveBorderWidth
|
||||
border.color: !control.enabled ? StylePrivate.UKUISlider.disableGrooveBorderColor : StylePrivate.UKUISlider.normalGrooveBorderColor
|
||||
color: !control.enabled ? StylePrivate.UKUISlider.disableGrooveColor : StylePrivate.UKUISlider.normalGrooveColor
|
||||
}
|
||||
|
||||
// Rectangle {
|
||||
// id: handle
|
||||
// x: control.horizontal ? (control.position * control.width - width/2) : ((item.width - width) / 2)
|
||||
// y: control.horizontal ? ((item.height - height) / 2) : (control.position * parent.height - height/2)
|
||||
// width: StylePrivate.UKUISlider.grooveHeight
|
||||
// height: StylePrivate.UKUISlider.grooveHeight
|
||||
|
||||
// radius: StylePrivate.UKUISlider.grooveHeight / 2
|
||||
// color: !control.enabled ? StylePrivate.UKUISlider.disableHandleColor : StylePrivate.UKUISlider.normalHandleColor
|
||||
// border.width: StylePrivate.UKUISlider.handleBorderWidth
|
||||
// border.color: !control.enabled ? StylePrivate.UKUISlider.disableHandleBorderColor : StylePrivate.UKUISlider.normalHandleBorderColor
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,166 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL3$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or later as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 2.0 requirements will be
|
||||
** met: http://www.gnu.org/licenses/gpl-2.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.impl 2.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.SpinBox {
|
||||
id: control
|
||||
hoverEnabled: true
|
||||
|
||||
implicitWidth: implicitBackgroundWidth + leftInset + rightInset//Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
// contentItem.implicitWidth + 2 * padding +
|
||||
// up.implicitIndicatorWidth)
|
||||
implicitHeight: Math.max(implicitContentHeight + topPadding + bottomPadding,
|
||||
implicitBackgroundHeight,
|
||||
up.implicitIndicatorHeight + down.implicitIndicatorHeight)
|
||||
|
||||
padding: StylePrivate.UKUISpinBox.padding
|
||||
// leftPadding: padding + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
|
||||
rightPadding: padding + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0))
|
||||
|
||||
font: StylePrivate.APPParameter.font
|
||||
|
||||
property bool upHover: control.up.hovered
|
||||
property bool upClick: control.up.pressed
|
||||
property bool downHover: control.down.hovered
|
||||
property bool downClick: control.down.pressed
|
||||
|
||||
onUpHoverChanged:{
|
||||
upRadiusRec.canvas.requestPaint();
|
||||
}
|
||||
onUpClickChanged:{
|
||||
upRadiusRec.canvas.requestPaint();
|
||||
}
|
||||
onDownHoverChanged:{
|
||||
downRadiusRec.canvas.requestPaint();
|
||||
}
|
||||
onDownClickChanged:{
|
||||
downRadiusRec.canvas.requestPaint();
|
||||
}
|
||||
|
||||
validator: IntValidator {
|
||||
locale: control.locale.name
|
||||
bottom: Math.min(control.from, control.to)
|
||||
top: Math.max(control.from, control.to)
|
||||
}
|
||||
|
||||
contentItem: TextInput {
|
||||
id:textInput
|
||||
z: 2
|
||||
text: control.displayText
|
||||
font: control.font
|
||||
color: !control.enabled ? StylePrivate.UKUISpinBox.disableTextColor : StylePrivate.UKUISpinBox.normalTextColor
|
||||
selectionColor: control.palette.highlight
|
||||
selectedTextColor: control.palette.highlightedText
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
|
||||
readOnly: !control.editable
|
||||
validator: control.validator
|
||||
inputMethodHints: control.inputMethodHints
|
||||
}
|
||||
|
||||
up.indicator: RadiusRectangle {
|
||||
id:upRadiusRec
|
||||
z:3
|
||||
implicitWidth: StylePrivate.UKUISpinBox.btnNormalWidth
|
||||
implicitHeight: StylePrivate.UKUISpinBox.btnNormalHeight
|
||||
anchors.right: control.right
|
||||
anchors.top: parent.top
|
||||
|
||||
leftTopRadius: StylePrivate.UKUISpinBox.radius
|
||||
rightTopRadius: StylePrivate.UKUISpinBox.radius
|
||||
leftBottomRadius: 0
|
||||
rightBottomRadius: 0
|
||||
backColor: !control.enabled ? StylePrivate.UKUISpinBox.btnDisableColor : control.up.pressed ? StylePrivate.UKUISpinBox.btnClickColor :
|
||||
control.up.hovered ? StylePrivate.UKUISpinBox.btnHoverColor : StylePrivate.UKUISpinBox.btnNormalColor
|
||||
borderColor: !control.enabled ? StylePrivate.UKUISpinBox.btnDisableBorderColor : upClick ? StylePrivate.UKUISpinBox.btnClickBorderColor :
|
||||
upHover ? StylePrivate.UKUISpinBox.btnHoverBorderColor : StylePrivate.UKUISpinBox.btnNormalBorderColor
|
||||
borderWidth: StylePrivate.UKUISpinBox.btnBorderWidth
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
source: {
|
||||
var model = !control.enabled ? "disenable" : control.checked ? "clicked" : "normal"
|
||||
return "image://imageProvider/" + "ukui-up-symbolic" + "/" + model;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
down.indicator: RadiusRectangle {
|
||||
id: downRadiusRec
|
||||
z:3
|
||||
implicitWidth: StylePrivate.UKUISpinBox.btnNormalWidth
|
||||
implicitHeight: StylePrivate.UKUISpinBox.btnNormalHeight
|
||||
|
||||
anchors.right: control.right
|
||||
anchors.bottom: parent.bottom
|
||||
leftTopRadius: 0
|
||||
rightTopRadius: 0
|
||||
leftBottomRadius: StylePrivate.UKUISpinBox.radius
|
||||
rightBottomRadius: StylePrivate.UKUISpinBox.radius
|
||||
|
||||
|
||||
backColor: !control.enabled ? StylePrivate.UKUISpinBox.btnDisableColor : control.down.pressed ? StylePrivate.UKUISpinBox.btnClickColor :
|
||||
control.down.hovered ? StylePrivate.UKUISpinBox.btnHoverColor : StylePrivate.UKUISpinBox.btnNormalColor
|
||||
borderColor: !control.enabled ? StylePrivate.UKUISpinBox.btnDisableBorderColor : downClick ? StylePrivate.UKUISpinBox.btnClickBorderColor :
|
||||
downHover ? StylePrivate.UKUISpinBox.btnHoverBorderColor : StylePrivate.UKUISpinBox.btnNormalBorderColor
|
||||
borderWidth: StylePrivate.UKUISpinBox.btnBorderWidth
|
||||
|
||||
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
source: {
|
||||
var model = !control.enabled ? "disenable" : control.checked ? "clicked" : "normal"
|
||||
return "image://imageProvider/" + "ukui-down-symbolic" + "/" + model;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
implicitWidth: StylePrivate.UKUISpinBox.normalWidth
|
||||
implicitHeight: StylePrivate.UKUISpinBox.normalHeight
|
||||
radius: StylePrivate.UKUISpinBox.radius
|
||||
border.width: control.activeFocus ? StylePrivate.UKUISpinBox.focusBorderWidth : StylePrivate.UKUISpinBox.normalBorderWidth
|
||||
color: !control.enabled ? StylePrivate.UKUISpinBox.disableColor : control.activeFocus ? StylePrivate.UKUISpinBox.focusColor :
|
||||
control.hovered ? StylePrivate.UKUISpinBox.hoverColor : StylePrivate.UKUISpinBox.normalColor
|
||||
border.color: !control.enabled ? StylePrivate.UKUISpinBox.disableBorderColor : control.activeFocus ? StylePrivate.UKUISpinBox.focusBorderColor :
|
||||
control.hovered ? StylePrivate.UKUISpinBox.hoverBorderColor : StylePrivate.UKUISpinBox.normalBorderColor
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL3$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or later as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 2.0 requirements will be
|
||||
** met: http://www.gnu.org/licenses/gpl-2.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.TabBar {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
contentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
contentHeight + topPadding + bottomPadding)
|
||||
|
||||
spacing: 1
|
||||
|
||||
contentItem: ListView {
|
||||
model: control.contentModel
|
||||
currentIndex: control.currentIndex
|
||||
|
||||
spacing: control.spacing
|
||||
orientation: ListView.Horizontal
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
flickableDirection: Flickable.AutoFlickIfNeeded
|
||||
snapMode: ListView.SnapToItem
|
||||
|
||||
// highlightMoveDuration: 0
|
||||
// highlightRangeMode: ListView.ApplyRange
|
||||
// preferredHighlightBegin: 40
|
||||
// preferredHighlightEnd: width - 40
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
id: back
|
||||
implicitHeight: contentHeight
|
||||
implicitWidth: contentWidth
|
||||
//anchors.fill: control
|
||||
color: StylePrivate.UKUITabBar.normalColor
|
||||
}
|
||||
}
|
|
@ -7,105 +7,52 @@ import QtQuick.Templates 2.5 as T
|
|||
|
||||
T.TabButton {
|
||||
id: controlRoot
|
||||
implicitWidth: {
|
||||
var contentwidth = implicitContentWidth + leftPadding + rightPadding
|
||||
return Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
contentwidth)
|
||||
}
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
// leftPadding: btn.margin
|
||||
// rightPadding: btn.margin
|
||||
//Some qstyles like fusion don't have correct pixel metrics here and just return 0
|
||||
implicitWidth: Math.max(styleitem.implicitWidth, textMetrics.width + textMetrics.height * 2)
|
||||
implicitHeight: styleitem.implicitHeight || textMetrics.height * 2
|
||||
baselineOffset: contentItem.y + contentItem.baselineOffset
|
||||
|
||||
hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7?
|
||||
//This width: is important to make the tabbar internals not assume
|
||||
//all tabs have the same width
|
||||
width: implicitWidth
|
||||
padding: 0
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
contentItem: Item {}
|
||||
|
||||
|
||||
font: StylePrivate.APPParameter.font
|
||||
background: StylePrivate.StyleItem {
|
||||
id: styleitem
|
||||
|
||||
property color bordercolor: controlRoot.checked ? StylePrivate.UKUITabButton.checkedBorderColor : controlRoot.pressed ?
|
||||
StylePrivate.UKUITabButton.clickBorderColor : controlRoot.hovered ?
|
||||
StylePrivate.UKUITabButton.hoverBorderColor : StylePrivate.UKUITabButton.normalBorderColor
|
||||
TextMetrics {
|
||||
id: textMetrics
|
||||
|
||||
property var backcolor: controlRoot.checked ? StylePrivate.UKUITabButton.checkedColor : controlRoot.pressed ?
|
||||
StylePrivate.UKUITabButton.clickedColor : controlRoot.hovered ?
|
||||
StylePrivate.UKUITabButton.hoverColor : StylePrivate.UKUITabButton.normalColor
|
||||
// property var backcolor: checked ? "blue" : pressed ? "green" : hovered ? "red" : "yellow"
|
||||
|
||||
contentItem: IconLabelContent {
|
||||
controlRoot: controlRoot
|
||||
anchors.centerIn: controlRoot
|
||||
layout: "left"
|
||||
leftSpace: 10
|
||||
labelColor: StylePrivate.UKUITabButton.normalTextColor
|
||||
// onWidthChanged: console.log(controlRoot.text, width)
|
||||
}
|
||||
background: Canvas{
|
||||
id: canvas
|
||||
width: controlRoot.width
|
||||
height: controlRoot.height
|
||||
onPaint: {
|
||||
var radius = controlRoot.checked ? 8 : 0;
|
||||
var ctx = getContext("2d");
|
||||
ctx.reset(); // 重置画布状态
|
||||
ctx.fillStyle = backcolor;
|
||||
|
||||
ctx.beginPath();
|
||||
if(controlRoot.checked || controlRoot.pressed){
|
||||
// 绘制第一段圆弧路径
|
||||
ctx.arc(x + radius, y + radius, radius, Math.PI, Math.PI * 3 / 2);
|
||||
// 绘制第一段直线路径
|
||||
ctx.lineTo(width - radius + x, y);
|
||||
// 绘制第二段圆弧路径
|
||||
ctx.arc(width - radius + x, radius + y, radius, Math.PI * 3 / 2, Math.PI * 2);
|
||||
// 绘制第二段直线路径
|
||||
ctx.lineTo(width + x, height + y);
|
||||
// 绘制第三段直线路径
|
||||
ctx.lineTo(x, height + y);
|
||||
// 绘制第四段直线路径
|
||||
ctx.lineTo(x, y + radius);
|
||||
}
|
||||
else{
|
||||
// // 绘制第一段圆弧路径
|
||||
// ctx.arc(x + radius, y + radius, radius, Math.PI, Math.PI * 3 / 2);
|
||||
// 绘制第一段直线路径
|
||||
ctx.moveTo(x, y);
|
||||
// 绘制第二段直线路径
|
||||
ctx.lineTo(x + width, y);
|
||||
ctx.lineTo(x + width, y + height);
|
||||
ctx.lineTo(x, y + height);
|
||||
ctx.lineTo(x, y);
|
||||
|
||||
// // 绘制第二段圆弧路径
|
||||
// ctx.arc(width - radius + x, radius + y, radius, Math.PI * 3 / 2, Math.PI * 2);
|
||||
// // 绘制第三段直线路径
|
||||
// ctx.lineTo(width + x, y);
|
||||
// // 绘制第四段直线路径
|
||||
// ctx.lineTo(width + x - radius, y);
|
||||
|
||||
|
||||
}
|
||||
ctx.closePath();
|
||||
|
||||
ctx.fill();
|
||||
console.log("border color...", bordercolor, bordercolor.alpha);
|
||||
|
||||
if(bordercolor.alpha >= 0.0){
|
||||
ctx.lineWidth = StylePrivate.UKUITabButton.borderWidth;
|
||||
ctx.strokenStyle = bordercolor;
|
||||
|
||||
ctx.stroke();
|
||||
}
|
||||
text: controlRoot.text
|
||||
}
|
||||
}
|
||||
|
||||
onPressedChanged: {
|
||||
canvas.requestPaint()
|
||||
}
|
||||
onHoveredChanged: {
|
||||
canvas.requestPaint()
|
||||
}
|
||||
onCheckedChanged: {
|
||||
canvas.requestPaint()
|
||||
control: controlRoot
|
||||
anchors.fill: parent
|
||||
elementType: "tab"
|
||||
paintMargins: 0
|
||||
|
||||
properties: {
|
||||
"hasFrame" : true,
|
||||
"icon": control.icon ? (control.icon.name || control.icon.source) : "",
|
||||
"iconWidth": controlRoot.icon && controlRoot.icon.width ? controlRoot.icon.width : 0,
|
||||
"iconHeight": controlRoot.icon && controlRoot.icon.height ? controlRoot.icon.height : 0,
|
||||
"flat": controlRoot.flat
|
||||
|
||||
}
|
||||
|
||||
|
||||
enabled: controlRoot.enabled
|
||||
selected: controlRoot.checked
|
||||
text: controlRoot.text
|
||||
hover: controlRoot.hovered
|
||||
hasFocus: controlRoot.activeFocus
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL3$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or later as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 2.0 requirements will be
|
||||
** met: http://www.gnu.org/licenses/gpl-2.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.impl 2.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.TextField {
|
||||
id: control
|
||||
|
||||
implicitWidth: implicitBackgroundWidth + leftInset + rightInset
|
||||
|| Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
contentHeight + topPadding + bottomPadding,
|
||||
placeholder.implicitHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: StylePrivate.UKUITextFiled.leftRightPadding
|
||||
leftPadding: padding + 4
|
||||
|
||||
color: !control.enabled ? StylePrivate.UKUITextFiled.disableTextColor : StylePrivate.UKUITextFiled.normalTextColor
|
||||
selectionColor: control.palette.highlight
|
||||
selectedTextColor: control.palette.highlightedText
|
||||
placeholderTextColor: !control.enabled ? StylePrivate.UKUITextFiled.placeHolderDisableTextColor : StylePrivate.UKUITextFiled.placeHolderNormalTextColor
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
font: StylePrivate.APPParameter.font
|
||||
hoverEnabled: true
|
||||
|
||||
// property bool hover: false
|
||||
property bool click: false
|
||||
|
||||
PlaceholderText {
|
||||
id: placeholder
|
||||
x: control.leftPadding
|
||||
y: control.topPadding
|
||||
width: control.width - (control.leftPadding + control.rightPadding)
|
||||
height: control.height - (control.topPadding + control.bottomPadding)
|
||||
|
||||
text: control.placeholderText
|
||||
font: control.font
|
||||
color: !control.enabled ? StylePrivate.UKUITextFiled.placeHolderDisableTextColor : StylePrivate.UKUITextFiled.placeHolderNormalTextColor
|
||||
verticalAlignment: control.verticalAlignment
|
||||
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
|
||||
elide: Text.ElideRight
|
||||
renderType: control.renderType
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
id: backrec
|
||||
radius: StylePrivate.UKUITextFiled.radius
|
||||
implicitWidth: StylePrivate.UKUITextFiled.normalWidth
|
||||
implicitHeight: StylePrivate.UKUITextFiled.normalHeight
|
||||
border.width: control.activeFocus ? StylePrivate.UKUITextFiled.focusBorderWidth : StylePrivate.UKUITextFiled.normalWidth
|
||||
color: !control.enabled ? StylePrivate.UKUITextFiled.placeHolderDisableBC : control.activeFocus ? StylePrivate.UKUITextFiled.inputNormalBC :
|
||||
click ? StylePrivate.UKUITextFiled.placeHolderClickedBC
|
||||
:control.hovered ? StylePrivate.UKUITextFiled.placeHolderHoveredBC : StylePrivate.UKUITextFiled.normalBC
|
||||
border.color: !control.enabled ? StylePrivate.UKUITextFiled.disableBorderColor : control.activeFocus ? StylePrivate.UKUITextFiled.focusBorderColor :
|
||||
control.hovered ? StylePrivate.UKUITextFiled.hoverBorderColor : StylePrivate.UKUITextFiled.normalBorderColor
|
||||
|
||||
}
|
||||
|
||||
onPressed: {
|
||||
click = true;
|
||||
}
|
||||
onReleased: click = false
|
||||
}
|
|
@ -1,44 +1,45 @@
|
|||
|
||||
import QtQuick.Controls 2.5
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
|
||||
T.ToolButton {
|
||||
id: controlRoot
|
||||
implicitWidth: {
|
||||
var contentwidth = implicitContentWidth + leftPadding + rightPadding
|
||||
return Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
contentwidth)
|
||||
}
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
|
||||
leftPadding: btn.margin
|
||||
rightPadding: btn.margin
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
property string icontype: "default"
|
||||
|
||||
implicitWidth: text.length > 0 ? background.implicitWidth : implicitHeight
|
||||
implicitHeight: background.implicitHeight
|
||||
|
||||
hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7?
|
||||
|
||||
flat: true
|
||||
contentItem: Item {}
|
||||
|
||||
font.family: appP.font.family
|
||||
font.pointSize: appP.font.pointSize
|
||||
|
||||
NormalControlColor{
|
||||
id:ncColor
|
||||
StylePrivate.KyIcon {
|
||||
id:icon
|
||||
iconName: controlRoot.icon.name
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: controlRoot.icon.width
|
||||
height: controlRoot.icon.height
|
||||
sunken: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)
|
||||
hover: controlRoot.hovered
|
||||
hasFocus: controlRoot.activeFocus
|
||||
icontype: controlRoot.icontype
|
||||
}
|
||||
|
||||
StylePrivate.UKUIButton{
|
||||
id: btn
|
||||
background: StylePrivate.StyleItem {
|
||||
id: styleitem
|
||||
anchors.fill: parent
|
||||
control: controlRoot
|
||||
elementType: controlRoot.flat ? "toolbutton" : "button"
|
||||
on: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)
|
||||
hover: controlRoot.hovered
|
||||
text: controlRoot.text
|
||||
hasFocus: false
|
||||
activeControl: controlRoot.isDefault ? "default" : "f"
|
||||
}
|
||||
StylePrivate.APPParameter{
|
||||
id: appP
|
||||
}
|
||||
contentItem: IconLabelContent {
|
||||
controlRoot: controlRoot
|
||||
anchors.centerIn: controlRoot
|
||||
onWidthChanged: console.log(controlRoot.text, width)
|
||||
}
|
||||
background: BackGroundRectangle{
|
||||
controlRoot: controlRoot
|
||||
_radius: btn.radius
|
||||
}}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import org.ukui.qqc2style.private 1.0 as StylePrivate
|
|||
T.ToolTip {
|
||||
id: controlRoot
|
||||
|
||||
palette: StylePrivate.APPParameter.palette
|
||||
font: StylePrivate.APPParameter.font
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
|
||||
x: parent ? Math.round((parent.width - implicitWidth) / 2) : 0
|
||||
|
@ -22,8 +22,8 @@ T.ToolTip {
|
|||
implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
|
||||
implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
|
||||
|
||||
margins: StylePrivate.UKUIToolTip.margins
|
||||
padding: StylePrivate.UKUIToolTip.padding
|
||||
margins: 6
|
||||
padding: 6
|
||||
|
||||
|
||||
// Timeout based on text length, from QTipLabel::restartExpireTimer
|
||||
|
@ -35,15 +35,15 @@ T.ToolTip {
|
|||
text: controlRoot.text
|
||||
wrapMode: Text.WordWrap
|
||||
font: controlRoot.font
|
||||
color: StylePrivate.UKUIToolTip.textColor
|
||||
color: controlRoot.palette.windowText
|
||||
}
|
||||
|
||||
|
||||
background: Rectangle {
|
||||
radius: StylePrivate.UKUIToolTip.radius
|
||||
radius: 3
|
||||
|
||||
//border.color: controlRoot.palette.dark
|
||||
color: StylePrivate.UKUIToolTip.backColor
|
||||
color: controlRoot.palette.toolTipBase
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
|
@ -52,8 +52,9 @@ T.ToolTip {
|
|||
samples: 8
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 0
|
||||
color: StylePrivate.UKUIToolTip.shadowColor
|
||||
color: Qt.rgba(0, 0, 0, 0.3)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file alias="NormalControlColor">qml/NormalControlColor.qml</file>
|
||||
<file alias="IconLabelContent">qml/IconLabelContent.qml</file>
|
||||
<file>qml/BackGroundRectangle.qml</file>
|
||||
<file>qml/RadiusRectangle.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,64 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls 2.0
|
||||
import QtGraphicalEffects 1.0
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
|
||||
Rectangle {
|
||||
id:root
|
||||
property T.AbstractButton controlRoot: root.parent
|
||||
property int _radius : 6
|
||||
|
||||
color: ncColor.controlColor
|
||||
opacity: (controlRoot.flat && !controlRoot.pressed && !controlRoot.hovered) ? 0 : 1
|
||||
implicitWidth: controlRoot.width
|
||||
|
||||
implicitHeight: controlRoot.height
|
||||
radius: _radius // 可选:设置圆角半径
|
||||
border.width: controlRoot.focus ? StylePrivate.UKUIButton.focusBorderWidth : StylePrivate.UKUIButton.borderWidth
|
||||
border.color: ncColor.borderColor
|
||||
|
||||
|
||||
LinearGradient {
|
||||
id: grad
|
||||
|
||||
start: Qt.point(root.x, root.y)
|
||||
|
||||
end: Qt.point(root.x, root.y + root.height)
|
||||
gradient: Gradient {
|
||||
|
||||
GradientStop { position: 0.0; color: "blue" }
|
||||
|
||||
GradientStop { position: 1.0; color: "white" }
|
||||
}
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
|
||||
}
|
||||
NormalControlColor{
|
||||
id:ncColor
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
ncColor.changeColor(controlRoot.highlighted, controlRoot.enabled, false, false, false);
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: controlRoot
|
||||
function onPressedChanged() {
|
||||
ncColor.changeColor(controlRoot.highlighted, controlRoot.enabled, controlRoot.pressed, controlRoot.hovered, controlRoot.focus)
|
||||
}
|
||||
function onHoveredChanged() {
|
||||
// if(controlRoot.hovered)
|
||||
// grad.visible = true;
|
||||
// else
|
||||
// grad.visible = false;
|
||||
ncColor.changeColor(controlRoot.highlighted, controlRoot.enabled, false, controlRoot.hovered, controlRoot.focus)
|
||||
}
|
||||
function onFocusChanged(){
|
||||
ncColor.changeColor(controlRoot.highlighted, controlRoot.enabled, controlRoot.pressed, controlRoot.hovered, controlRoot.focus)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,205 +0,0 @@
|
|||
import QtQuick 2.6
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls 2.0
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
Item{
|
||||
id:root
|
||||
property T.AbstractButton controlRoot: root.parent
|
||||
|
||||
property int normalWidth: btn.normalWidth
|
||||
property int normalHeight: btn.normalHeight
|
||||
|
||||
property string layout: "center"
|
||||
property int leftSpace: 0
|
||||
property int labelSpace: 0
|
||||
|
||||
property var labelColor: controlRoot.enabled ? btn.normalTextColor : btn.disableTextColor
|
||||
|
||||
property bool imageVisible : image.visible || image1.visible
|
||||
property var space: {
|
||||
if(controlRoot.display === AbstractButton.TextOnly || controlRoot.display === AbstractButton.IconOnly)
|
||||
return 0
|
||||
return (label.text != "" && imageVisible) ? btn.space : 0
|
||||
}
|
||||
function adjustWidth(margin){//margin表示边距
|
||||
if(controlRoot.display !== AbstractButton.TextUnderIcon){
|
||||
var textwidth = (label.text !== "" && controlRoot.display !== AbstractButton.IconOnly) ? label.width : 0
|
||||
var imagewidth = (!imageVisible) ? 0 : image.width
|
||||
if(controlRoot.display === AbstractButton.IconOnly || label.text === "")
|
||||
return imagewidth + margin;
|
||||
if(controlRoot.display !== AbstractButton.TextBesideIcon)
|
||||
return Math.max(textwidth + margin, imagewidth + margin, normalWidth)
|
||||
return Math.max(normalWidth, textwidth + imagewidth + space + margin)
|
||||
}
|
||||
var textwidth1 = label1.text != "" ? label1.width : 0
|
||||
var imagewidth1 = imageVisible ? 0 : image1.width
|
||||
|
||||
return Math.max(normalWidth, textwidth1 + imagewidth1 + space + margin)
|
||||
|
||||
}
|
||||
|
||||
function adjustHeight(margin){//margin表示边距
|
||||
if(controlRoot.display !== AbstractButton.TextUnderIcon) {
|
||||
var textheight = label1.text != "" ? label1.height : 0
|
||||
var imageheight = !imageVisible ? 0 : image1.height
|
||||
if(controlRoot.display !== AbstractButton.TextBesideIcon)
|
||||
return Math.max(textheight + margin, imageheight + margin, normalHeight)
|
||||
return Math.max(normalHeight, textheight + space + margin, imageheight + space + margin)
|
||||
}
|
||||
var textheight1 = label1.text != "" ? label1.height : 0
|
||||
var imageheight1 = !imageVisible ? 0 : image1.height
|
||||
|
||||
var h = Math.max(normalHeight, textheight1 + imageheight1 + space + margin)
|
||||
// console.log("heigh0000000000....", controlRoot.text, textheight1, imageheight1, h, space, margin)
|
||||
|
||||
return h
|
||||
}
|
||||
|
||||
StylePrivate.UKUIButton{
|
||||
id: btn
|
||||
|
||||
}
|
||||
StylePrivate.APPParameter{
|
||||
id: appP
|
||||
onFontChanged:{
|
||||
controlRoot.width = adjustWidth(2 * btn.leftRightMargin)
|
||||
controlRoot.height = adjustHeight(2 * btn.upDownMargin)
|
||||
}
|
||||
}
|
||||
anchors.centerIn: controlRoot
|
||||
|
||||
Item{
|
||||
id:item
|
||||
visible: controlRoot.display !== AbstractButton.TextUnderIcon
|
||||
implicitWidth: {
|
||||
var textwidth = (controlRoot.display !== AbstractButton.IconOnly && label.text !== "") ? label.width : 0
|
||||
var imagewidth = imageVisible ? image.width : 0
|
||||
if(controlRoot.display === AbstractButton.IconOnly || label.text === "")
|
||||
return imagewidth;
|
||||
|
||||
if(controlRoot.display !== AbstractButton.TextBesideIcon)
|
||||
return Math.max(textwidth, imagewidth)
|
||||
return Math.max( textwidth + imagewidth + space)
|
||||
}
|
||||
|
||||
implicitHeight: {
|
||||
var textheight = label.visible ? (label.text != "" ? label.height : 0) : 0
|
||||
var imageheight = imageVisible ? image.height : 0
|
||||
if(controlRoot.display === AbstractButton.IconOnly || label.text === "")
|
||||
return imageheight;
|
||||
|
||||
if(controlRoot.display === AbstractButton.TextUnderIcon)
|
||||
return Math.max(textheight + imageheight + space, normalHeight);
|
||||
return Math.max(textheight, imageheight, normalHeight)
|
||||
|
||||
}
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: {
|
||||
if(layout == "left"){
|
||||
space += leftSpace;
|
||||
return leftSpace;
|
||||
}
|
||||
else
|
||||
return (parent.width - width) / 2
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Image {
|
||||
id: image
|
||||
source: //controlRoot.icon.source
|
||||
{
|
||||
if((controlRoot.icon.source.toString() === "" && controlRoot.icon.name.toString() === ""))
|
||||
return controlRoot.icon.source
|
||||
|
||||
var model = !controlRoot.enabled ? "disenable" : controlRoot.pressed ? "clicked" : controlRoot.hovered ? "hover" : "normal"
|
||||
|
||||
let s = controlRoot.icon.source.toString()
|
||||
return "image://imageProvider/" + s + "/" + model;
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: (controlRoot.display !== AbstractButton.TextOnly && source !== "" && status != Image.Null) ? 16 : 0
|
||||
visible: controlRoot.display !== AbstractButton.TextOnly && source !== "" && status != Image.Null
|
||||
|
||||
}
|
||||
Label {
|
||||
id:label
|
||||
text: controlRoot.text
|
||||
font:controlRoot.font
|
||||
color: labelColor
|
||||
visible: controlRoot.display !== AbstractButton.IconOnly && text !== ""
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
anchors.left: image.right
|
||||
anchors.leftMargin: (image.visible && image.status !== Image.Null) ? 0 : labelSpace
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Item{
|
||||
id:item1
|
||||
visible: controlRoot.display === AbstractButton.TextUnderIcon
|
||||
implicitWidth: {
|
||||
var textwidth1 = label1.text != "" ? label1.width : 0
|
||||
var imagewidth1 = controlRoot.icon.source === "" ? 0 : image1.width
|
||||
if(controlRoot.display === AbstractButton.TextUnderIcon)
|
||||
return Math.max(textwidth1, imagewidth1, normalWidth);
|
||||
if(controlRoot.display !== AbstractButton.TextBesideIcon)
|
||||
return Math.max(textwidth1, imagewidth1, normalWidth)
|
||||
return Math.max( textwidth1 + imagewidth1 + space, normalWidth)
|
||||
}
|
||||
implicitHeight: {
|
||||
var textheight1 = label1.text != "" ? label1.height : 0
|
||||
var imageheight1 = controlRoot.icon.source === "" ? 0 : image1.height
|
||||
if(display === AbstractButton.TextUnderIcon)
|
||||
return Math.max(textheight1 + imageheight1 + space, normalHeight);
|
||||
return Math.max(textheight1, imageheight1, normalHeight)
|
||||
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
Image {
|
||||
id: image1
|
||||
source: //controlRoot.icon.source
|
||||
{
|
||||
if((controlRoot.icon.source.toString() === "" && controlRoot.icon.name.toString() === ""))
|
||||
return controlRoot.icon.source
|
||||
|
||||
var model = !controlRoot.enabled ? "disenable" : controlRoot.pressed ? "clicked" : controlRoot.hovered ? "hover" : "normal"
|
||||
|
||||
let s = controlRoot.icon.source.toString()
|
||||
return "image://imageProvider/" + s + "/" + model;
|
||||
}
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: visible ? 16 : 0
|
||||
height: visible ? 16 : 0
|
||||
visible: controlRoot.display !== AbstractButton.TextOnly && source !== "" /*&& status != Image.Null*/
|
||||
}
|
||||
Label {
|
||||
id:label1
|
||||
text: controlRoot.text
|
||||
font:controlRoot.font
|
||||
color: labelColor
|
||||
visible: controlRoot.display !== AbstractButton.IconOnly && text !== ""
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: image1.bottom
|
||||
anchors.topMargin: space
|
||||
}
|
||||
|
||||
}
|
||||
Component.onCompleted: {
|
||||
width = adjustWidth(0);
|
||||
height = adjustHeight(0);
|
||||
controlRoot.width = adjustWidth(2 * btn.leftRightMargin)
|
||||
controlRoot.height = adjustHeight(2 * btn.upDownMargin)
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
width = adjustWidth(0);
|
||||
height = adjustHeight(0);
|
||||
controlRoot.width = adjustWidth(2 * btn.leftRightMargin)
|
||||
controlRoot.height = adjustHeight(2 * btn.upDownMargin)
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
// StylePrivate.UKUIButton{
|
||||
// id: btn
|
||||
// }
|
||||
// StylePrivate.APPParameter{
|
||||
// id: appP
|
||||
//// onFontChanged:{
|
||||
//// console.log("onFontChanged.......", StylePrivate.APPParameter.font)
|
||||
//// }
|
||||
// }
|
||||
property color controlColor// : StylePrivate.UKUIButton.normalBC
|
||||
property color borderColor
|
||||
function changeColor(highlighted, enable, click, hover, focus){
|
||||
console.log("changeColor123", hover, StylePrivate.UKUIButton.hoveredHBC)
|
||||
if(highlighted){
|
||||
controlColor = !enable ? StylePrivate.UKUIButton.disableHBC : click ? StylePrivate.UKUIButton.clickedHBC : hover ? StylePrivate.UKUIButton.hoveredHBC : StylePrivate.UKUIButton.normalHBC
|
||||
borderColor = !enable ? StylePrivate.UKUIButton.disableBorderHColor : focus ? StylePrivate.UKUIButton.focusBorderColor :
|
||||
click ? StylePrivate.UKUIButton.clickBorderHColor : hover ? StylePrivate.UKUIButton.hoverBorderHColor : StylePrivate.UKUIButton.normalBorderHColor
|
||||
}
|
||||
else{
|
||||
controlColor = !enable ? StylePrivate.UKUIButton.disableBC : click ? StylePrivate.UKUIButton.clickedBC : hover ? StylePrivate.UKUIButton.hoveredBC : StylePrivate.UKUIButton.normalBC
|
||||
borderColor = !enable ? StylePrivate.UKUIButton.disableBorderColor : focus ? StylePrivate.UKUIButton.focusBorderColor :
|
||||
click ? StylePrivate.UKUIButton.clickBorderColor : hover ? StylePrivate.UKUIButton.hoverBorderColor : StylePrivate.UKUIButton.normalBorderColor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
import QtQuick 2.6
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import QtQuick.Controls 2.0
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
Item{
|
||||
id:control
|
||||
// property Rectangle controlRoot: control.parent
|
||||
|
||||
property int leftTopRadius: 6
|
||||
property int rightTopRadius: 6
|
||||
property int leftBottomRadius: 6
|
||||
property int rightBottomRadius: 6
|
||||
|
||||
property color borderColor
|
||||
property color backColor
|
||||
property int borderWidth
|
||||
|
||||
property alias canvas : customButtonCanvas
|
||||
|
||||
Canvas {
|
||||
id: customButtonCanvas
|
||||
width: control.width
|
||||
height: control.height
|
||||
anchors.centerIn: parent
|
||||
|
||||
onPaint: {
|
||||
var ctx = getContext("2d");
|
||||
ctx.reset();
|
||||
|
||||
// 填充颜色
|
||||
ctx.fillStyle = backColor;
|
||||
|
||||
// 开始绘制路径
|
||||
ctx.beginPath();
|
||||
|
||||
// 绘制圆角矩形,只有左上角和右上角有圆角
|
||||
// 绘制第一段圆弧路径
|
||||
ctx.moveTo(0, leftTopRadius);
|
||||
ctx.arc(leftTopRadius, leftTopRadius, leftTopRadius, Math.PI, Math.PI * 3 / 2);
|
||||
// 绘制第一段直线路径
|
||||
ctx.lineTo(width - rightTopRadius, 0);
|
||||
// 绘制第二段圆弧路径
|
||||
ctx.arc(width - rightTopRadius, rightTopRadius, rightTopRadius, Math.PI * 3 / 2, Math.PI * 2);
|
||||
// 绘制第二段直线路径
|
||||
ctx.lineTo(width, height - rightBottomRadius);
|
||||
// 绘制第三段圆弧路径
|
||||
ctx.arc(width - rightBottomRadius, height - rightBottomRadius, rightBottomRadius, 0, Math.PI * 1 / 2);
|
||||
// 绘制第三段直线路径
|
||||
ctx.lineTo(leftBottomRadius, height);
|
||||
// 绘制第四段圆弧路径
|
||||
ctx.arc(leftBottomRadius, height - leftBottomRadius, leftBottomRadius, Math.PI * 1 / 2, Math.PI);
|
||||
// 绘制第四段直线路径
|
||||
ctx.lineTo(leftTopRadius);
|
||||
|
||||
// 填充路径
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
|
||||
// 绘制边框
|
||||
ctx.strokeStyle = borderColor;
|
||||
ctx.lineWidth = borderWidth;
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
// 鼠标点击事件(模拟按钮点击)
|
||||
// MouseArea {
|
||||
// anchors.fill: parent
|
||||
// onClicked: {
|
||||
// canvas.requestPaint()
|
||||
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
IconLabelContent 1.0 qml/IconLabelContent.qml
|
||||
NormalControlColor 1.0 qml/NormalControlColor.qml
|
||||
BackGroundRectangle 1.0 qml/BackGroundRectangle.qml
|
||||
RadiusRectangle 1.0 qml/RadiusRectangle.qml
|
Loading…
Reference in New Issue