qt6-ukui-platformtheme/0000775000175000017500000000000015154306201014027 5ustar fengfengqt6-ukui-platformtheme/qt6-ukui-platformtheme/0000775000175000017500000000000015154306200020360 5ustar fengfengqt6-ukui-platformtheme/qt6-ukui-platformtheme/xatom-helper.cpp0000664000175000017500000001504515154306200023476 0ustar fengfeng/* * KWin Style UKUI * * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #include "xatom-helper.h" #include #include #include #include #include #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include #endif static XAtomHelper *global_instance = nullptr; Display* XAtomHelper::x11Display() { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) return QX11Info::display(); #else QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); return native ? static_cast(native->nativeResourceForWindow("display", nullptr)) : nullptr; #endif } bool XAtomHelper::isPlatformX11() { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) return QX11Info::isPlatformX11(); #else return QGuiApplication::platformName() == "xcb"; #endif } XAtomHelper *XAtomHelper::getInstance() { if (!global_instance) global_instance = new XAtomHelper; return global_instance; } bool XAtomHelper::isFrameLessWindow(int winId) { auto hints = getInstance()->getWindowMotifHint(winId); if (hints.flags == MWM_HINTS_DECORATIONS && hints.functions == 1) { return true; } return false; } bool XAtomHelper::isWindowDecorateBorderOnly(int winId) { return isWindowMotifHintDecorateBorderOnly(getInstance()->getWindowMotifHint(winId)); } bool XAtomHelper::isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint) { bool isDeco = false; if (hint.flags & MWM_HINTS_DECORATIONS && hint.flags != MWM_HINTS_DECORATIONS) { if (hint.decorations == MWM_DECOR_BORDER) isDeco = true; } return isDeco; } bool XAtomHelper::isUKUICsdSupported() { // fixme: return false; } bool XAtomHelper::isUKUIDecorationWindow(int winId) { if (m_ukuiDecorationAtion == None) return false; Atom type; int format; ulong nitems; ulong bytes_after; uchar *data; bool isUKUIDecoration = false; XGetWindowProperty(x11Display(), winId, m_ukuiDecorationAtion, 0, LONG_MAX, false, m_ukuiDecorationAtion, &type, &format, &nitems, &bytes_after, &data); if (type == m_ukuiDecorationAtion) { if (nitems == 1) { isUKUIDecoration = data[0]; } } return isUKUIDecoration; } UnityCorners XAtomHelper::getWindowBorderRadius(int winId) { UnityCorners corners; Atom type; int format; ulong nitems; ulong bytes_after; uchar *data; if (m_unityBorderRadiusAtom != None) { XGetWindowProperty(x11Display(), winId, m_unityBorderRadiusAtom, 0, LONG_MAX, false, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &data); if (type == XA_CARDINAL) { if (nitems == 4) { corners.topLeft = static_cast(data[0]); corners.topRight = static_cast(data[1*sizeof (ulong)]); corners.bottomLeft = static_cast(data[2*sizeof (ulong)]); corners.bottomRight = static_cast(data[3*sizeof (ulong)]); } XFree(data); } } return corners; } void XAtomHelper::setWindowBorderRadius(int winId, const UnityCorners &data) { if (m_unityBorderRadiusAtom == None) return; ulong corners[4] = {data.topLeft, data.topRight, data.bottomLeft, data.bottomRight}; XChangeProperty(x11Display(), winId, m_unityBorderRadiusAtom, XA_CARDINAL, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof (corners)/sizeof (corners[0])); } void XAtomHelper::setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight) { if (m_unityBorderRadiusAtom == None) return; ulong corners[4] = {(ulong)topLeft, (ulong)topRight, (ulong)bottomLeft, (ulong)bottomRight}; XChangeProperty(x11Display(), winId, m_unityBorderRadiusAtom, XA_CARDINAL, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof (corners)/sizeof (corners[0])); } void XAtomHelper::setUKUIDecoraiontHint(int winId, bool set) { if (m_ukuiDecorationAtion == None) return; XChangeProperty(x11Display(), winId, m_ukuiDecorationAtion, m_ukuiDecorationAtion, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &set, 1); } void XAtomHelper::setWindowMotifHint(int winId, const MotifWmHints &hints) { if (m_unityBorderRadiusAtom == None) return; XChangeProperty(x11Display(), winId, m_motifWMHintsAtom, m_motifWMHintsAtom, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *)&hints, sizeof (MotifWmHints)/ sizeof (ulong)); } MotifWmHints XAtomHelper::getWindowMotifHint(int winId) { MotifWmHints hints; if (m_unityBorderRadiusAtom == None) return hints; uchar *data; Atom type; int format; ulong nitems; ulong bytes_after; XGetWindowProperty(x11Display(), winId, m_motifWMHintsAtom, 0, sizeof (MotifWmHints)/sizeof (long), false, AnyPropertyType, &type, &format, &nitems, &bytes_after, &data); if (type == None) { return hints; } else { hints = *(MotifWmHints *)data; XFree(data); } return hints; } XAtomHelper::XAtomHelper(QObject *parent) : QObject(parent) { if (!isPlatformX11()) return; Display *display = x11Display(); if (!display) return; m_motifWMHintsAtom = XInternAtom(display, "_MOTIF_WM_HINTS", true); m_unityBorderRadiusAtom = XInternAtom(display, "_UNITY_GTK_BORDER_RADIUS", false); m_ukuiDecorationAtion = XInternAtom(display, "_KWIN_UKUI_DECORAION", false); } Atom XAtomHelper::registerUKUICsdNetWmSupportAtom() { // fixme: return None; } void XAtomHelper::unregisterUKUICsdNetWmSupportAtom() { // fixme: } qt6-ukui-platformtheme/qt6-ukui-platformtheme/xatom-helper.h0000664000175000017500000000643015154306200023141 0ustar fengfeng/* * KWin Style UKUI * * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: Yue Lan * */ #ifndef XATOMHELPER_H #define XATOMHELPER_H #include #include #include struct UnityCorners { ulong topLeft = 0; ulong topRight = 0; ulong bottomLeft = 0; ulong bottomRight = 0; }; typedef struct { ulong flags = 0; ulong functions = 0; ulong decorations = 0; long input_mode = 0; ulong status = 0; } MotifWmHints, MwmHints; #define MWM_HINTS_FUNCTIONS (1L << 0) #define MWM_HINTS_DECORATIONS (1L << 1) #define MWM_HINTS_INPUT_MODE (1L << 2) #define MWM_HINTS_STATUS (1L << 3) #define MWM_FUNC_ALL (1L << 0) #define MWM_FUNC_RESIZE (1L << 1) #define MWM_FUNC_MOVE (1L << 2) #define MWM_FUNC_MINIMIZE (1L << 3) #define MWM_FUNC_MAXIMIZE (1L << 4) #define MWM_FUNC_CLOSE (1L << 5) #define MWM_DECOR_ALL (1L << 0) #define MWM_DECOR_BORDER (1L << 1) #define MWM_DECOR_RESIZEH (1L << 2) #define MWM_DECOR_TITLE (1L << 3) #define MWM_DECOR_MENU (1L << 4) #define MWM_DECOR_MINIMIZE (1L << 5) #define MWM_DECOR_MAXIMIZE (1L << 6) #define MWM_INPUT_MODELESS 0 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 #define MWM_INPUT_SYSTEM_MODAL 2 #define MWM_INPUT_FULL_APPLICATION_MODAL 3 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL #define MWM_TEAROFF_WINDOW (1L<<0) namespace UKUI { class Decoration; } class XAtomHelper : public QObject { friend class UKUI::Decoration; Q_OBJECT public: static XAtomHelper *getInstance(); static Display* x11Display(); static bool isPlatformX11(); static bool isFrameLessWindow(int winId); bool isWindowDecorateBorderOnly(int winId); bool isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint); bool isUKUICsdSupported(); bool isUKUIDecorationWindow(int winId); UnityCorners getWindowBorderRadius(int winId); void setWindowBorderRadius(int winId, const UnityCorners &data); void setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight); void setUKUIDecoraiontHint(int winId, bool set = true); void setWindowMotifHint(int winId, const MotifWmHints &hints); MotifWmHints getWindowMotifHint(int winId); private: explicit XAtomHelper(QObject *parent = nullptr); ulong registerUKUICsdNetWmSupportAtom(); void unregisterUKUICsdNetWmSupportAtom(); ulong m_motifWMHintsAtom = 0l; ulong m_unityBorderRadiusAtom = 0l; ulong m_ukuiDecorationAtion = 0l; }; #endif // XATOMHELPER_H qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/0000775000175000017500000000000015154306200023101 5ustar fengfengqt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_en_US.ts0000664000175000017500000001641515154306200031102 0ustar fengfeng MessageBox Close Close QApplication Executable '%1' requires Qt %2, found Qt %3. Executable '%1' requires Qt %2, found Qt %3. Incompatible Qt Library Error Incompatible Qt Library Error QDialogButtonBox OK OK QMessageBox Show Details... Show Details... Hide Details... Hide Details... QObject File Name File Name Modified Date Modified Date File Type File Type File Size File Size Original Path Original Path Descending Descending Ascending Ascending Use current sorting for all folders Use current sorting for all folders List View List View Icon View Icon View Close Close UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Let tab widget switch with a slide animation. UKUIFileDialog::KyFileDialogHelper Open File Open File Save File Save File All Files (*) All Files (*) UKUIFileDialog::KyNativeFileDialog Go Back Go Back Go Forward Go Forward Cd Up Cd Up Search Search View Type View Type Sort Type Sort Type Maximize Maximize Close Close Restore Restore Name Name Open Open Cancel Cancel Save as Save as New Folder New Folder Save Save Directories Directories Warning Warning exist, are you sure replace? exist, are you sure replace? NewFolder NewFolder Undo Undo Redo Redo warn warn This operation is not supported. This operation is not supported. qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_kk.ts0000664000175000017500000001714515154306200030477 0ustar fengfeng MessageBox Close تاقاۋ QApplication Executable '%1' requires Qt %2, found Qt %3. اتقار ىستەۋگە بولاتٸن حۇجات 1، مۇقتاجدىق ارگومەنتتٸ 2، ٸزدەپ تاپقان ارگومەنتتٸ 3 Incompatible Qt Library Error سىغىشمىغانQT قامبادا قاتەلىك كورىلدى QDialogButtonBox OK ماقۇل QMessageBox Show Details... ناقتى مازمۇنىن كورسەتۋ Hide Details... ناقتى مازمۇنىن جاسىرۋ QObject File Name 文件名称 Modified Date 修改日期 File Type 文件类型 File Size 文件大小 Original Path 原始路径 Descending 降序 Ascending 升序 Use current sorting for all folders 所有目录使用当前排序 List View 列表视图 Icon View 图标视图 Close تاقاۋ UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide الدىن بەكٸتٸلگەن slide Let tab widget switch with a slide animation. تالدانبا كارتونىن كشكەنە زاپشاستارىن پٸروبيكسيا كارتون فىلىمىگە سايكەستىرۋ UKUIFileDialog::KyFileDialogHelper Open File 打开 Save File 保存 All Files (*) 所有(*) UKUIFileDialog::KyNativeFileDialog Go Back 后退 Go Forward 前进 Cd Up 向上 Search 搜索 View Type 视图类型 Sort Type 排序类型 Maximize 最大化 Close 关闭 Restore 还原 Name 文件名 Open 打开 Cancel 取消 Save as 另存为 New Folder 新建文件夹 Save 保存 Directories 目录 Warning 警告 exist, are you sure replace? 已存在,是否替换? NewFolder 新建文件夹 Undo 撤销 Redo 重做 warn 警告 This operation is not supported. 不支持此操作。 qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_tr.ts0000664000175000017500000000525015154306200030511 0ustar fengfeng MessageBox Close QApplication Executable '%1' requires Qt %2, found Qt %3. Incompatible Qt Library Error QDialogButtonBox OK QMessageBox Show Details... Hide Details... QObject Close UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Let tab widget switch with a slide animation. qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_bo_CN.ts0000664000175000017500000002260015154306200031042 0ustar fengfeng MessageBox Close ཁ་རྒྱག་པ། QApplication Executable '%1' requires Qt %2, found Qt %3. ལག་བསྟར་བྱེད་ཆོག་པའི་'%1'ལ་Qt %2,Qt%3རྙེད་པ་རེད། Incompatible Qt Library Error ཕན་ཚུན་མཐུན་ཐབས་མེད་པའི་Qt དཔེ་མཛོད་ཁང་གི་ནོར་འཁྲུལ། QDialogButtonBox OK འགྲིགས། QMessageBox Show Details... ཞིབ་ཕྲའི་གནས་ཚུལ་གསལ་བཤད་བྱ་དགོས། Hide Details... གནས་ཚུལ་ཞིབ་ཕྲ་སྦས་སྐུང་བྱེད་ QObject File Name ཡིག་ཆའི་མིང་། Modified Date བཟོ་བཅོས་བརྒྱབ་པའི་དུས་ཚོད། File Type ཡིག་ཆའི་རིགས་གྲས། File Size ཡིག་ཆའི་ཆེ་ཆུང་། Original Path ཐོག་མའི་འགྲོ་ལམ། Descending མར་འབབ་པ། Ascending རིམ་པ་ཇེ་མང་དུ་འགྲོ་བཞིན། Use current sorting for all folders དཀར་ཆག་ཡོད་ཚད་མིག་སྔའི་གོ་རིམ་བཀོལ་སྤྱོད་བྱེད་བཞིན་ཡོད། List View མཐོང་རིས་རེའུ་མིག Icon View མཚོན་རྟགས་ལྟ་ཚུལ། Close ཁ་རྒྱག་པ། UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide ཁ་ཆད་བཞག་པའི་སྒྲོན་བརྙན Let tab widget switch with a slide animation. སྒྲོན་བརྙན་གྱི་འགུལ་རིས་ལ་བརྟེན་ནས་ཤོག་བྱང་ཆུང་ཆུང་བརྗེ་རེས་བྱེད་དུ་འཇུག་དགོས། UKUIFileDialog::KyFileDialogHelper Open File ཁ་ཕྱེ་བའི་ཡིག་ཆ། Save File ཡིག་ཆ་ཉར་ཚགས་བྱེད་པ། All Files (*) ཡིག་ཆ་ཡོད་ཚད་(*) UKUIFileDialog::KyNativeFileDialog Go Back ཕྱིར་ལོག Go Forward མདུན་སྐྱོད། Cd Up གོང་ཕྱོགས། Search འཚོལ་ཞིབ། View Type མཐོང་རིས་ཀྱི་རིགས། Sort Type གོ་རིམ་གྱི་རིགས། Maximize ཆེས་ཆེ་བསྒྱུར། Close ཁ་རྒྱག་པ། Restore སླར་གསོ་བྱེད་པ། Name ཡིག་ཆའི་མིང་། Open སྒོ་ཕྱེ་བ། Cancel ཕྱིར་འཐེན། Save as ཉར་ཚགས་གཞན། New Folder ཡིག་ཁུག་གསར་འཛུགས། Save གྲོན་ཆུང་བྱེད་དགོས། Directories དཀར་ཆག Warning ཐ་ཚིག་སྒྲོག་པ། exist, are you sure replace? གནས་ཡོད་པས། ཁྱོད་ཀྱིས་དངོས་གནས་ཚབ་བྱེད་ཐུབ་བམ། NewFolder དཀར་ཆག་གསར་བ། Undo ཁ་ཕྱིར་འཐེན་བྱ་དགོས། Redo ཡང་བསྐྱར་ལས། warn ཉེན་བརྡ་བཏང་བ། This operation is not supported. བཀོལ་སྤྱོད་འདི་ལ་རྒྱབ་སྐྱོར་མི་བྱེད། qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_cs.ts0000664000175000017500000000525015154306200030471 0ustar fengfeng MessageBox Close QApplication Executable '%1' requires Qt %2, found Qt %3. Incompatible Qt Library Error QDialogButtonBox OK QMessageBox Show Details... Hide Details... QObject Close UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Let tab widget switch with a slide animation. qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_HK.ts0000664000175000017500000001650515154306200031074 0ustar fengfeng MessageBox Close 關閉 QApplication Executable '%1' requires Qt %2, found Qt %3. 可執行檔「%1」 需要數量%2,找到數量%3。 Incompatible Qt Library Error 不相容的Qt庫錯誤 QDialogButtonBox OK 確認 QMessageBox Show Details... 顯示細節...... Hide Details... 隱藏細節...... QObject File Name 檔名稱 Modified Date 修改日期 File Type 檔案類型 File Size 檔大小 Original Path 原始路徑 Descending 降序 Ascending 升序 Use current sorting for all folders 所有資料夾套用目前排序方式 List View 清單檢視 Icon View 圖示檢視 Close 關閉 UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide 默認slide Let tab widget switch with a slide animation. 讓選項卡小部件切換為幻燈片動畫。 UKUIFileDialog::KyFileDialogHelper Open File 打開 Save File 保存 All Files (*) 所有(*) UKUIFileDialog::KyNativeFileDialog Go Back 後退 Go Forward 前進 Cd Up 向上 Search 搜索 View Type 視圖類型 Sort Type 排序類型 Maximize 最大化 Close 關閉 Restore 還原 Name 檔名 Open 打開 Cancel 取消 Save as 另存為 New Folder 新建資料夾 Save 保存 Directories 目錄 Warning 警告 exist, are you sure replace? 已存在,是否替換? NewFolder 新建資料夾 Undo 撤銷 Redo 重做 warn 警告 This operation is not supported. 不支援此操作。 qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_Hant.ts0000664000175000017500000004051515154306200031462 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close 關閉 QApplication Executable '%1' requires Qt %2, found Qt %3. 可執行檔「%1」 需要數量%2,找到數量%3。 Incompatible Qt Library Error 不相容的Qt庫錯誤 QDialogButtonBox OK 確認 QMessageBox Show Details... 顯示細節...... Hide Details... 隱藏細節...... QObject File Name 檔名稱 Modified Date 修改日期 File Type 檔案類型 File Size 檔大小 Original Path 原始路徑 Descending 降序 Ascending 升序 Use current sorting for all folders 所有資料夾套用目前排序方式 List View 清單檢視 Icon View 圖示檢視 Close 關閉 UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide 默認slide Let tab widget switch with a slide animation. 讓選項卡小部件切換為幻燈片動畫。 UKUIFileDialog::KyFileDialogHelper Open File 打開 Save File 保存 All Files (*) 所有(*) UKUIFileDialog::KyNativeFileDialog Go Back 後退 Go Forward 前進 Cd Up 向上 Search 搜索 View Type 視圖類型 Sort Type 排序類型 Maximize 最大化 Close 關閉 Restore 還原 Name 檔名 Open 打開 Cancel 取消 Save as 另存為 New Folder 新建資料夾 Save 保存 Directories 目錄 Warning 警告 exist, are you sure replace? 已存在,是否替換? NewFolder 新建資料夾 Undo 撤銷 Redo 重做 warn 警告 This operation is not supported. 不支援此操作。 qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_fa.ts0000664000175000017500000000525015154306200030452 0ustar fengfeng MessageBox Close QApplication Executable '%1' requires Qt %2, found Qt %3. Incompatible Qt Library Error QDialogButtonBox OK QMessageBox Show Details... Hide Details... QObject Close UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Let tab widget switch with a slide animation. qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_de.ts0000664000175000017500000003501615154306200030457 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close Schließen QApplication Executable '%1' requires Qt %2, found Qt %3. Die ausführbare Datei '%1' erfordert Qt %2, Qt %3 gefunden. Incompatible Qt Library Error Fehler in der inkompatiblen Qt-Bibliothek QDialogButtonBox OK OKAY QMessageBox Show Details... Details anzeigen... Hide Details... Details ausblenden... QObject File Name Dateiname Modified Date Änderungsdatum File Type Dateityp File Size Dateigröße Original Path Ursprünglicher Pfad Descending Absteigend Ascending Aufsteigend Use current sorting for all folders Globale Sortierung verwenden List View Listenansicht Icon View Icon-Ansicht Close Schließen UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Standard-Folie Let tab widget switch with a slide animation. Lassen Sie das Tab-Widget mit einer Folienanimation wechseln. UKUIFileDialog::KyFileDialogHelper Open File Offene Linie Save File Datei speichern All Files (*) Alle Dateien (*) UKUIFileDialog::KyNativeFileDialog Go Back Zurück Go Forward Vorwärts gehen Cd Up Cd nach oben Search Suchen View Type Typ der Ansicht Sort Type Art der Sortierung Maximize Maximieren Close Schließen Restore Wiederherstellen Name Name Open Offen Cancel Abbrechen Save as Speichern unter New Folder Neuer Ordner Save Retten Directories Verzeichnisse Warning Warnung exist, are you sure replace? existieren, sind Sie sicher, ersetzen? NewFolder Neuer Ordner Undo Aufmachen Redo Noch einmal machen warn warnen This operation is not supported. Dieser Vorgang wird nicht unterstützt. qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_mn.ts0000664000175000017500000002127515154306200030503 0ustar fengfeng MessageBox Close ᠬᠠᠭᠠᠬᠤ QApplication Executable '%1' requires Qt %2, found Qt %3. ᠭᠦᠢᠴᠡᠳᠬᠡᠵᠦ ᠪᠣᠯᠬᠤ ᠹᠠᠢᠯ '%1' Qt% 2 ᠬᠡᠷᠡᠭᠰᠡᠵᠦ ᠂ Qt% 3 ᠢ᠋/ ᠵᠢ ᠡᠷᠢᠵᠦ ᠣᠯᠬᠤ ᠬᠡᠷᠡᠭᠲᠡᠶ . Incompatible Qt Library Error QDialogButtonBox OK OK QMessageBox Show Details... Hide Details... QObject File Name ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠨᠡᠷᠡᠢᠳᠦᠯ Modified Date ᠵᠠᠰᠠᠭᠰᠠᠨ ᠡᠳᠦᠷ ᠰᠠᠷ᠎ᠠ File Type ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ File Size ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠶᠡᠬᠡ ᠪᠠᠭ᠎ᠠ Original Path ᠤᠭ ᠤ᠋ᠨ ᠵᠠᠮ ᠱᠤᠭᠤᠮ Descending ᠪᠠᠭᠠᠰᠬᠠᠬᠤ Ascending ᠶᠡᠬᠡᠰᠬᠡᠬᠦ Use current sorting for all folders ᠪᠦᠬᠦ ᠪᠠᠢᠳᠠᠯ ᠤ᠋ᠨ ᠳᠠᠷᠠᠭᠠᠯᠠᠯ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ List View ᠵᠢᠭᠰᠠᠭᠠᠯᠳᠠ ᠵᠢᠨ ᠬᠠᠷᠠᠭᠠᠨ ᠵᠢᠷᠤᠭ Icon View ᠰᠢᠪᠠᠭ᠎ᠠ ᠵᠢᠨ ᠬᠠᠷᠠᠭᠠᠨ ᠵᠢᠷᠤᠭ Close ᠬᠠᠭᠠᠬᠤ UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Default Slide Let tab widget switch with a slide animation. UKUIFileDialog::KyFileDialogHelper Open File ᠨᠡᠬᠡᠬᠡᠬᠦ Save File ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ All Files (*) ᠪᠦᠬᠦᠢᠯᠡ (*) UKUIFileDialog::KyNativeFileDialog Go Back ᠤᠬᠤᠷᠢᠬᠤ Go Forward ᠤᠷᠤᠭᠰᠢᠯᠠᠬᠤ Cd Up ᠳᠡᠭᠡᠭᠰᠢ Search ᠬᠠᠢᠯᠳᠠ View Type ᠬᠠᠷᠠᠭᠠᠨ ᠵᠢᠷᠤᠭ ᠤ᠋ᠨ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ Sort Type ᠳᠠᠷᠠᠭᠠᠯᠠᠯ ᠤ᠋ᠨ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ Maximize ᠬᠠᠮᠤᠭ ᠤ᠋ᠨ ᠶᠡᠬᠡᠴᠢᠯᠡᠯ Close ᠬᠠᠭᠠᠬᠤ Restore ᠡᠬᠡᠬᠦᠯᠬᠦ Name ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠨᠡᠷ᠎ᠡ Open ᠨᠡᠬᠡᠬᠡᠬᠦ Cancel ᠦᠬᠡᠢᠰᠭᠡᠬᠦ᠌ Save as ᠦᠭᠡᠷ᠎ᠡ ᠭᠠᠵᠠᠷ ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ New Folder ᠰᠢᠨ᠎ᠡ ᠪᠡᠷ ᠪᠠᠢᠭᠤᠯᠤᠭᠰᠠᠨ ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠬᠠᠪᠳᠠᠰᠤ Save ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ Directories ᠭᠠᠷᠴᠠᠭ Warning ᠰᠡᠷᠡᠮᠵᠢᠯᠡᠬᠦᠯᠦᠯ exist, are you sure replace? ᠪᠠᠢᠨ᠎ᠠ᠂ ᠰᠤᠯᠢᠬᠤ ᠤᠤ? NewFolder ᠰᠢᠨ᠎ᠡ ᠪᠡᠷ ᠪᠠᠢᠭᠤᠯᠤᠭᠰᠠᠨ ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠬᠠᠪᠳᠠᠰᠤ Undo ᠬᠦᠴᠦᠨ ᠦᠬᠡᠢ ᠪᠤᠯᠭᠠᠬᠤ Redo ᠳᠠᠬᠢᠵᠤ ᠬᠢᠬᠦ warn ᠰᠡᠷᠡᠮᠵᠢᠯᠡᠬᠦᠯᠬᠦ This operation is not supported. ᠳᠤᠰ ᠠᠵᠢᠯᠯᠠᠬᠤᠢ ᠵᠢ ᠳᠡᠮᠵᠢᠬᠦ ᠦᠬᠡᠢ. qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_ug.ts0000664000175000017500000001712715154306200030505 0ustar fengfeng MessageBox Close تاقاش QApplication Executable '%1' requires Qt %2, found Qt %3. ئىجرا قىلىشقا بولىدىغان ھۆججەت 1، ئىھتىياجلىق سان 2، ئىزدەپ تاپقان سان 3 Incompatible Qt Library Error سىغىشمىغانQT ئامبىرىدا خاتالىق كۆرۈلدى QDialogButtonBox OK ماقۇل QMessageBox Show Details... تەپسىلاتىنى كۆرسىتىش Hide Details... تەپسىلاتىنى يوشۇرۇش QObject File Name 文件名称 Modified Date 修改日期 File Type 文件类型 File Size 文件大小 Original Path 原始路径 Descending 降序 Ascending 升序 Use current sorting for all folders 所有目录使用当前排序 List View 列表视图 Icon View 图标视图 Close تاقاش UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide ئالدىن بىكىتىلگەن slide Let tab widget switch with a slide animation. تاللانما كارتىدىكى كىچىك زاپچاسلارنى پرويېكسىيە كارتون فىلىمىگە ئالماشتۇرۇش UKUIFileDialog::KyFileDialogHelper Open File 打开 Save File 保存 All Files (*) 所有(*) UKUIFileDialog::KyNativeFileDialog Go Back 后退 Go Forward 前进 Cd Up 向上 Search 搜索 View Type 视图类型 Sort Type 排序类型 Maximize 最大化 Close 关闭 Restore 还原 Name 文件名 Open 打开 Cancel 取消 Save as 另存为 New Folder 新建文件夹 Save 保存 Directories 目录 Warning 警告 exist, are you sure replace? 已存在,是否替换? NewFolder 新建文件夹 Undo 撤销 Redo 重做 warn 警告 This operation is not supported. 不支持此操作。 qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_fr.ts0000664000175000017500000001705515154306200030501 0ustar fengfeng MessageBox Close Fermer QApplication Executable '%1' requires Qt %2, found Qt %3. L’exécutable '%1' nécessite Qt %2, trouvé Qt %3. Incompatible Qt Library Error Erreur de bibliothèque Qt incompatible QDialogButtonBox OK D’ACCORD QMessageBox Show Details... Afficher les détails... Hide Details... Masquer les détails... QObject File Name Nom du fichier Modified Date Date de modification File Type Type de fichier File Size Taille du fichier Original Path Chemin d’accès d’origine Descending Descendant Ascending Ascendant Use current sorting for all folders Utiliser le tri global List View Affichage en liste Icon View Affichage de l’icône Close Fermer UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Diapositive par défaut Let tab widget switch with a slide animation. Laissez le widget d’onglet basculer avec une animation de diapositive. UKUIFileDialog::KyFileDialogHelper Open File Ouvrir un fichier Save File Enregistrer le fichier All Files (*) Tous les fichiers (*) UKUIFileDialog::KyNativeFileDialog Go Back Retour Go Forward Avancer Cd Up Cd Up Search Rechercher View Type Type de vue Sort Type Type de tri Maximize Maximiser Close Fermer Restore Restaurer Name Nom Open Ouvrir Cancel Annuler Save as Enregistrer sous New Folder Nouveau dossier Save Sauvegarder Directories Téléphonique Warning Avertissement exist, are you sure replace? exister, êtes-vous sûr de remplacer ? NewFolder NouveauDossier Undo Défaire Redo Refaire warn avertir This operation is not supported. Cette opération n’est pas prise en charge. qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_es.ts0000664000175000017500000003513315154306200030476 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close QApplication Executable '%1' requires Qt %2, found Qt %3. Incompatible Qt Library Error QDialogButtonBox OK QMessageBox Show Details... Hide Details... QObject File Name Modified Date File Type File Size Original Path Descending Ascending Use current sorting for all folders List View Icon View Close UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Let tab widget switch with a slide animation. UKUIFileDialog::KyFileDialogHelper Open File Save File All Files (*) UKUIFileDialog::KyNativeFileDialog Go Back Go Forward Cd Up Search View Type Sort Type Maximize Close Restore Name Open Cancel Save as New Folder Save Directories Warning exist, are you sure replace? NewFolder Undo Redo warn This operation is not supported. qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_CN.ts0000664000175000017500000001646115154306200031073 0ustar fengfeng MessageBox Close 关闭 QApplication Executable '%1' requires Qt %2, found Qt %3. 可执行文件“%1”需要数量%2,找到数量%3。 Incompatible Qt Library Error 不兼容的Qt库错误 QDialogButtonBox OK 确认 QMessageBox Show Details... 显示细节…… Hide Details... 隐藏细节…… QObject File Name 文件名称 Modified Date 修改日期 File Type 文件类型 File Size 文件大小 Original Path 原始路径 Descending 降序 Ascending 升序 Use current sorting for all folders 所有目录使用当前排序 List View 列表视图 Icon View 图标视图 Close 关闭 UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide 默认slide Let tab widget switch with a slide animation. 让选项卡小部件切换为幻灯片动画。 UKUIFileDialog::KyFileDialogHelper Open File 打开 Save File 保存 All Files (*) 所有(*) UKUIFileDialog::KyNativeFileDialog Go Back 后退 Go Forward 前进 Cd Up 向上 Search 搜索 View Type 视图类型 Sort Type 排序类型 Maximize 最大化 Close 关闭 Restore 还原 Name 文件名 Open 打开 Cancel 取消 Save as 另存为 New Folder 新建文件夹 Save 保存 Directories 目录 Warning 警告 exist, are you sure replace? 已存在,是否替换? NewFolder 新建文件夹 Undo 撤销 Redo 重做 warn 警告 This operation is not supported. 不支持此操作。 qt6-ukui-platformtheme/qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_ky.ts0000664000175000017500000001712515154306200030513 0ustar fengfeng MessageBox Close بەكىتىش QApplication Executable '%1' requires Qt %2, found Qt %3. اتقارماق جاسووعو بولوتۇرعان ۅجۅت 1، كەرەكتۉۉ سان 2، ىزدەپ تاپقان سان 3 Incompatible Qt Library Error سىغىشمىغانQT قامپادا قاتاالىق كۅرۉلدۉ QDialogButtonBox OK ماقۇل QMessageBox Show Details... جۅن جايىن كۅرسۅتۉۉ Hide Details... جۅن جايىن جاشىرۇۇ QObject File Name 文件名称 Modified Date 修改日期 File Type 文件类型 File Size 文件大小 Original Path 原始路径 Descending 降序 Ascending 升序 Use current sorting for all folders 所有目录使用当前排序 List View 列表视图 Icon View 图标视图 Close بەكىتىش UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide الدىن بەكىتىلگەن slide Let tab widget switch with a slide animation. تاندالما كارتاداقى كىچىك شايمانداردى پرويەكسىيە كارتون فىلىمىگە الماشتىرۇۇ UKUIFileDialog::KyFileDialogHelper Open File 打开 Save File 保存 All Files (*) 所有(*) UKUIFileDialog::KyNativeFileDialog Go Back 后退 Go Forward 前进 Cd Up 向上 Search 搜索 View Type 视图类型 Sort Type 排序类型 Maximize 最大化 Close 关闭 Restore 还原 Name 文件名 Open 打开 Cancel 取消 Save as 另存为 New Folder 新建文件夹 Save 保存 Directories 目录 Warning 警告 exist, are you sure replace? 已存在,是否替换? NewFolder 新建文件夹 Undo 撤销 Redo 重做 warn 警告 This operation is not supported. 不支持此操作。 qt6-ukui-platformtheme/qt6-ukui-platformtheme/ukui.json0000664000175000017500000000003315154306200022224 0ustar fengfeng{ "Keys": [ "ukui" ] } qt6-ukui-platformtheme/qt6-ukui-platformtheme/qt5-ukui-platformtheme_global.h0000664000175000017500000000212015154306200026375 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef QT5UKUIPLATFORMTHEME_GLOBAL_H #define QT5UKUIPLATFORMTHEME_GLOBAL_H #include #if defined(QT5UKUIPLATFORMTHEME_LIBRARY) # define QT5UKUIPLATFORMTHEMESHARED_EXPORT Q_DECL_EXPORT #else # define QT5UKUIPLATFORMTHEMESHARED_EXPORT Q_DECL_IMPORT #endif #endif // QT5UKUIPLATFORMTHEME_GLOBAL_H qt6-ukui-platformtheme/qt6-ukui-platformtheme/widget/0000775000175000017500000000000015154306200021643 5ustar fengfengqt6-ukui-platformtheme/qt6-ukui-platformtheme/widget/messagebox/0000775000175000017500000000000015154306200024000 5ustar fengfengqt6-ukui-platformtheme/qt6-ukui-platformtheme/widget/messagebox/message-box.cpp0000664000175000017500000013537315154306200026732 0ustar fengfeng/* * KWin Style UKUI * * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: xibowen * */ #include "message-box.h" #include "../../xatom-helper.h" #include #include #include #include #include #include #include #include #include #include "private/qlabel_p.h" #include "private/qdialog_p.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include enum Button { Old_Ok = 1, Old_Cancel = 2, Old_Yes = 3, Old_No = 4, Old_Abort = 5, Old_Retry = 6, Old_Ignore = 7, Old_YesAll = 8, Old_NoAll = 9, Old_ButtonMask = 0xFF, NewButtonMask = 0xFFFFFC00 }; static QMessageBox::StandardButton newButton(int button); static QMessageDialogOptions::StandardIcon helperIcon(QMessageBox::Icon i); static QPlatformDialogHelper::StandardButtons helperStandardButtons(MessageBox * q); MessageBox::MessageBox(QWidget *parent) : QDialog(*new MessageBoxPrivate, parent, Qt::MSWindowsFixedSizeDialogHint /*| Qt::WindowTitleHint*/ | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) { Q_D(MessageBox); const QString locale = QLocale::system().name(); QTranslator *translator = new QTranslator(this); if (translator->load("/usr/share/qt5-ukui-platformtheme/qt5-ukui-platformtheme_" + locale)) { //Fix:BUG176598,block QMessagebox translation for xca before commit patch to upstream if (qAppName() != "xca") { if(!QApplication::installTranslator(translator)) qWarning() << "Install translator failed!" << locale; } } else qWarning() << "Load translations file failed!" << locale; setProperty("useStyleWindowManager", true); setBackgroundRole(QPalette::Base); setAutoFillBackground(true); d->init(); d->mCloseButtton->setToolTip(tr("Close")); setContentsMargins(0, 0, 0, 0); setAttribute(Qt::WA_TranslucentBackground); // m_windowHelper = new UkuiWindowHelper(this); // m_windowHelper->removeTitleBar(); // m_windowHelper->setSkipTaskBar(true); // m_windowHelper->setSkipSwitcher(true); // QDBusInterface *interFace = new QDBusInterface("com.kylin.statusmanager.interface", // "/", // "com.kylin.statusmanager.interface", // QDBusConnection::sessionBus()); // if(interFace->isValid()){ // connect(interFace, SIGNAL(mode_change_signal(bool)), this, SLOT(d->tableModeChanged(bool))); // } } MessageBox::~MessageBox() { // if (m_windowHelper) { // delete m_windowHelper; // m_windowHelper = nullptr; // } } void MessageBox::setCheckBox(QCheckBox *cb) { Q_D(MessageBox); if (cb == d->mCheckbox) { return; } d->mCheckbox = cb; } QMessageBox::Icon MessageBox::icon() { Q_D(const MessageBox); return d->mIcon; } void MessageBox::setIcon(QMessageBox::Icon icon) { Q_D(MessageBox); setIconPixmap(MessageBoxPrivate::standardIcon((QMessageBox::Icon)icon, this)); d->mIcon = icon; } QPixmap MessageBox::iconPixmap() const { Q_D(const MessageBox); if (d->mIconLabel && !d->mIconLabel->pixmap().isNull()) return d->mIconLabel->pixmap(); return QPixmap(); } void MessageBox::setIconPixmap(const QPixmap &pixmap) { Q_D(MessageBox); if (!pixmap.isNull()){ d->mIconLabel->setAlignment(Qt::AlignVCenter); d->mIconLabel->setPixmap(pixmap); } d->mIcon = QMessageBox::NoIcon; } QString MessageBox::text() { Q_D(const MessageBox); return d->mLabel->text(); } void MessageBox::setText(const QString& text) { Q_D(MessageBox); d->mLabel->setText(text); } Qt::TextFormat MessageBox::textFormat() const { Q_D(const MessageBox); return d->mLabel->textFormat(); } void MessageBox::setTextFormat(Qt::TextFormat format) { Q_D(MessageBox); d->mLabel->setTextFormat(format); } Qt::TextInteractionFlags MessageBox::textInteractionFlags() const { Q_D(const MessageBox); return d->mLabel->textInteractionFlags(); } void MessageBox::setTextInteractionFlags(Qt::TextInteractionFlags flags) { Q_D(MessageBox); d->mLabel->setTextInteractionFlags(flags); } void MessageBox::addButton(QAbstractButton *button, QMessageBox::ButtonRole role) { Q_D(MessageBox); if (!button) { return; } if (d->mButtonBox->buttons().contains(button)) return; removeButton(button); d->mOptions->addButton(button->text(), static_cast(role), button); d->mButtonBox->addButton(button, (QDialogButtonBox::ButtonRole)role); d->mCustomButtonList.append(button); d->mAutoAddOkButton = false; } QPushButton* MessageBox::addButton(const QString &text, QMessageBox::ButtonRole role) { Q_D(MessageBox); QPushButton* pushButton = new QPushButton(text); addButton(pushButton, role); return pushButton; } QPushButton *MessageBox::addButton(QMessageBox::StandardButton button) { Q_D(MessageBox); if (d->mButtonBox->standardButtons() & button) { return nullptr; } QPushButton *pushButton = d->mButtonBox->addButton((QDialogButtonBox::StandardButton)button); if (pushButton) { d->mAutoAddOkButton = false; } pushButton->setIcon(QIcon()); return pushButton; } void MessageBox::removeButton(QAbstractButton *button) { Q_D(MessageBox); d->mCustomButtonList.removeAll(button); if (d->mEscapeButton == button) { d->mEscapeButton = nullptr; } if (d->mDefaultButton == button) { d->mDefaultButton = nullptr; } d->mButtonBox->removeButton(button); } QAbstractButton *MessageBox::button(QMessageBox::StandardButton which) const { Q_D(const MessageBox); return d->mButtonBox->button(QDialogButtonBox::StandardButton(which)); } QList MessageBox::buttons() const { Q_D(const MessageBox); return d->mButtonBox->buttons(); } QMessageBox::ButtonRole MessageBox::buttonRole(QAbstractButton *button) const { Q_D(const MessageBox); return QMessageBox::ButtonRole(d->mButtonBox->buttonRole(button)); } void MessageBox::setStandardButtons(QMessageBox::StandardButtons buttons) { Q_D(MessageBox); d->mButtonBox->setStandardButtons(QDialogButtonBox::StandardButtons(int(buttons))); QList buttonList = d->mButtonBox->buttons(); if (!buttonList.contains(d->mEscapeButton)) { d->mEscapeButton = nullptr; } if (!buttonList.contains(d->mDefaultButton)) { d->mDefaultButton = nullptr; } d->mAutoAddOkButton = false; } QMessageBox::StandardButtons MessageBox::standardButtons() const { Q_D(const MessageBox); return QMessageBox::StandardButtons(int(d->mButtonBox->standardButtons())); } QMessageBox::StandardButton MessageBox::standardButton(QAbstractButton *button) const { Q_D(const MessageBox); return (QMessageBox::StandardButton)d->mButtonBox->standardButton(button); } QPushButton *MessageBox::defaultButton() const { Q_D(const MessageBox); return d->mDefaultButton; } void MessageBox::setDefaultButton(QPushButton *button) { Q_D(MessageBox); if (!d->mButtonBox->buttons().contains(button)) { return; } d->mDefaultButton = button; button->setDefault(true); button->setFocus(); } void MessageBox::setDefaultButton(QMessageBox::StandardButton button) { Q_D(MessageBox); setDefaultButton(d->mButtonBox->button(QDialogButtonBox::StandardButton(button))); } QAbstractButton* MessageBox::escapeButton() const { Q_D(const MessageBox); return d->mEscapeButton; } void MessageBox::setEscapeButton(QAbstractButton *button) { Q_D(MessageBox); if (d->mButtonBox->buttons().contains(button)) { d->mEscapeButton = button; } } void MessageBox::setEscapeButton(QMessageBox::StandardButton button) { Q_D(MessageBox); setEscapeButton(d->mButtonBox->button(QDialogButtonBox::StandardButton(button))); } QAbstractButton* MessageBox::clickedButton() const { Q_D(const MessageBox); return d->mClickedButton; } QString MessageBox::buttonText(int button) const { Q_D(const MessageBox); if (QAbstractButton *abstractButton = d->abstractButtonForId(button)) { return abstractButton->text(); } else if (d->mButtonBox->buttons().isEmpty() && (button == QMessageBox::Ok || button == Old_Ok)) { return QDialogButtonBox::tr("OK"); } return QString(); } void MessageBox::setButtonText(int button, const QString &text) { Q_D(MessageBox); if (QAbstractButton *abstractButton = d->abstractButtonForId(button)) { abstractButton->setText(text); } else if (d->mButtonBox->buttons().isEmpty() && (button == QMessageBox::Ok || button == Old_Ok)) { addButton(QMessageBox::Ok)->setText(text); } } QString MessageBox::informativeText() const { Q_D(const MessageBox); return d->mInformativeLabel ? d->mInformativeLabel->text() : QString(); } void MessageBox::setInformativeText(const QString &text) { Q_D(MessageBox); if (text.isEmpty()) { if (d->mInformativeLabel) { d->mInformativeLabel->hide(); d->mInformativeLabel->deleteLater(); } d->mInformativeLabel = nullptr; } else { if (!d->mInformativeLabel) { QLabel *label = new QLabel; label->setObjectName(QLatin1String("ukui_msgbox_informativelabel")); label->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, nullptr, this))); label->setAlignment(Qt::AlignTop | Qt::AlignLeft); label->setOpenExternalLinks(true); QPalette palette = label->palette(); palette.setColor(QPalette::Text, palette.color(QPalette::Disabled, QPalette::Text)); label->setPalette(palette); d->mInformativeLabel = label; } d->mInformativeLabel->setText(text); } } void MessageBox::setDetailedText(const QString &text) { Q_D(MessageBox); if (!text.isEmpty()) { d->mDetail = new TextEdit; d->mDetail->setText(text); d->mDetail->hide(); if (!d->mDetailButton) { d->mDetailButton = new QPushButton(this); d->mDetailButton->setText(QMessageBox::tr("Show Details...")); } } else { d->mDetail = nullptr; d->mDefaultButton = nullptr; } } void MessageBox::setWindowTitle(const QString &title) { Q_D(MessageBox); // d->mTitleText->setText(title); d->mTitleText->setText(""); QDialog::setWindowTitle(title); } void MessageBox::setWindowModality(Qt::WindowModality windowModality) { QDialog::setWindowModality(windowModality); // if (parentWidget() && windowModality == Qt::WindowModal) { // setParent(parentWidget(), Qt::Sheet); // } else { // setParent(parentWidget(), Qt::Dialog); // } setDefaultButton(d_func()->mDefaultButton); } QPixmap MessageBox::standardIcon(QMessageBox::Icon icon) { return MessageBoxPrivate::standardIcon(icon, nullptr); } void MessageBox::setWindowIcon(const QIcon &icon) { Q_D(MessageBox); // d->mTitleIcon->setPixmap(icon.pixmap(QSize(22, 22))); QDialog::setWindowIcon(icon); } bool MessageBox::event(QEvent *e) { Q_D(MessageBox); bool result = QDialog::event(e); switch (e->type()) { case QEvent::ApplicationWindowIconChange: if(icon() != QMessageBox::NoIcon) setIcon(icon()); if(!windowIcon().isNull()) setWindowIcon(windowIcon()); break; case QEvent::LayoutRequest: { d->updateSize(); break; } case QEvent::FontChange: d->updateSize(); break; case QEvent::ApplicationPaletteChange: { if (d->mInformativeLabel) { QPalette palette = QGuiApplication::palette(); palette.setColor(QPalette::Text, palette.color(QPalette::Disabled, QPalette::Text)); d->mInformativeLabel->setPalette(palette); } } default: break; } return result; } void MessageBox::changeEvent(QEvent *event) { Q_D(MessageBox); switch (event->type()) { case QEvent::StyleChange: { if (d->mIcon != QMessageBox::NoIcon) setIcon(d->mIcon); Qt::TextInteractionFlags flags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, nullptr, this)); d->mLabel->setTextInteractionFlags(flags); d->mButtonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, nullptr, this)); if (d->mInformativeLabel) d->mInformativeLabel->setTextInteractionFlags(flags); Q_FALLTHROUGH(); } case QEvent::FontChange: case QEvent::ApplicationFontChange: Q_FALLTHROUGH(); default: break; } QDialog::changeEvent(event); } void MessageBox::showEvent(QShowEvent *event) { Q_D(MessageBox); if (d->mAutoAddOkButton) { addButton(QMessageBox::Ok); } if (d->mDetailButton) { addButton(d->mDetailButton, QMessageBox::ActionRole); } d->detectEscapeButton(); d->updateSize(); #ifndef QT_NO_ACCESSIBILITY QAccessibleEvent e(this, QAccessible::Alert); QAccessible::updateAccessibility(&e); #endif QDialog::showEvent(event); } void MessageBox::closeEvent(QCloseEvent *event) { Q_D(MessageBox); if (!d->mDetectedEscapeButton) { event->ignore(); return; } QDialog::closeEvent(event); d->mClickedButton = d->mDetectedEscapeButton; setResult(d->execReturnCode(d->mDetectedEscapeButton)); } void MessageBox::keyPressEvent(QKeyEvent* e) { #if QT_CONFIG(shortcut) Q_D(MessageBox); if (e->matches(QKeySequence::Cancel)) { if (d->mDetectedEscapeButton) { d->mDetectedEscapeButton->click(); } return; } #endif // QT_CONFIG(shortcut) #if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT) //#if QT_CONFIG(textedit) // if (e == QKeySequence::Copy) { // if (d->detailsText && d->detailsText->isVisible() && d->detailsText->copy()) { // e->setAccepted(true); // return; // } // } else if (e == QKeySequence::SelectAll && d->detailsText && d->detailsText->isVisible()) { // d->detailsText->selectAll(); // e->setAccepted(true); // return; // } //#endif // QT_CONFIG(textedit) #ifndef QT_NO_SHORTCUT #endif #endif // !QT_NO_CLIPBOARD && !QT_NO_SHORTCUT #ifndef QT_NO_SHORTCUT if (!(e->modifiers() & (Qt::AltModifier | Qt::ControlModifier | Qt::MetaModifier))) { int key = e->key() & ~Qt::MODIFIER_MASK; if (key) { const QList buttons = d->mButtonBox->buttons(); for (auto *pb : buttons) { QKeySequence shortcut = pb->shortcut(); if (!shortcut.isEmpty() && key == int(shortcut[0] & ~Qt::MODIFIER_MASK)) { pb->animateClick(); return; } } } } #endif QDialog::keyPressEvent(e); } void MessageBox::paintEvent(QPaintEvent *event) { Q_D(MessageBox); QPainter painter (this); QPalette palette; painter.save(); painter.setRenderHint(QPainter::Antialiasing); painter.setPen(Qt::NoPen); painter.setBrush(palette.brush(QPalette::Base)); painter.drawRoundedRect(rect(), d->mRadius, d->mRadius); painter.restore(); Q_UNUSED(event); QDialog::paintEvent(event); } void MessageBox::resizeEvent(QResizeEvent *event) { QDialog::resizeEvent(event); Q_UNUSED(event); } void MessageBox::initHelper(QPlatformMessageDialogHelper* h) { Q_D(MessageBox); d->initHelper(h); } void MessageBox::setuplayout() { Q_D(MessageBox); d->setupLayout(); } void MessageBox::tableModeChanged(bool tableMode) { Q_D(MessageBox); if(tableMode) d->mCloseButtton->setFixedSize(48, 48); else d->mCloseButtton->setFixedSize(32, 32); } MessageBoxPrivate::MessageBoxPrivate() : mCheckbox(nullptr), mEscapeButton(nullptr), mDefaultButton(nullptr), mClickedButton(nullptr), mCompatMode(false), mAutoAddOkButton(true), mDetectedEscapeButton(nullptr), mInformativeLabel(nullptr), mDetail(nullptr), mDetailButton(nullptr), mOptions(QMessageDialogOptions::create()) { } MessageBoxPrivate::~MessageBoxPrivate() { /* if (nullptr != mLabel) { delete mLabel; } if (nullptr != mIconLabel) { delete mIconLabel; } if (nullptr != mButtonBox) { delete mButtonBox; } if (nullptr != mDetail) { delete mDetail; } if (nullptr != mDetailButton) { delete mDetailButton; } */ } void MessageBoxPrivate::init(const QString &title, const QString &text) { Q_Q(MessageBox); mLabel = new QLabel; mLabel->setObjectName(QLatin1String("ukui_msgbox_label")); mLabel->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, q))); mLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); mLabel->setOpenExternalLinks(true); mIconLabel = new QLabel; mIconLabel->setObjectName(QLatin1String("ukui_msgbox_icon_label")); mIconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mIconLabel->setContentsMargins(0, 0, 0, 0); mButtonBox = new QDialogButtonBox; mButtonBox->setObjectName(QLatin1String("ukui_msgbox_buttonbox")); mButtonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, nullptr, q)); QObject::connect(mButtonBox, SIGNAL(clicked(QAbstractButton*)), q, SLOT(_q_buttonClicked(QAbstractButton*))); // bool isTableMode = false; // QDBusMessage message = QDBusMessage::createMethodCall("com.kylin.statusmanager.interface", // "/", // "com.kylin.statusmanager.interface", // "get_current_tabletmode"); // QDBusMessage ret = QDBusConnection::sessionBus().call(message); // if (ret.type() != QDBusMessage::ReplyMessage) // { // //从返回参数获取返回值 // qDebug() << "complex type failed!"; // } // else // { // isTableMode = ret.arguments()[0].value(); // } mCloseButtton = new QPushButton(); mCloseButtton->setFlat(true); mCloseButtton->setFocusPolicy(Qt::NoFocus); mCloseButtton->setProperty("isWindowButton", 0x2); mCloseButtton->setIcon(QIcon::fromTheme("window-close-symbolic")); mCloseButtton->setIconSize(QSize(16, 16)); mCloseButtton->setToolTip(QObject::tr("Close")); // if(isTableMode)//styleName == "ukui-dark"){// // mCloseButtton->setFixedSize(48, 48); // else mCloseButtton->setFixedSize(32, 32); QObject::connect(mCloseButtton, &QPushButton::clicked, q, [=]() { q->close(); }); mTitleText = new QLabel(); // mTitleText->setText(title); mTitleText->setText(""); // mTitleIcon = new QLabel(); // mTitleIcon->setPixmap(QIcon(qApp->windowIcon()).pixmap(QSize(22, 22))); //mTitleIcon->setFixedSize(22, 22); q->setModal(true); mIcon = QMessageBox::NoIcon; } void MessageBoxPrivate::setupLayout() { Q_Q(MessageBox); if (q->layout()) delete q->layout(); bool hasIcon = mIconLabel->pixmap() && !mIconLabel->pixmap()->isNull(); QGridLayout *gridLayout = new QGridLayout; gridLayout->setContentsMargins(0, 0, 0, 32); gridLayout->setHorizontalSpacing(8); gridLayout->setVerticalSpacing(8); if (hasIcon) gridLayout->addWidget(mIconLabel, 0, 0, Qt::AlignTop); gridLayout->addWidget(mLabel, 0, hasIcon ? 1 : 0); if (mInformativeLabel) { gridLayout->addWidget(mInformativeLabel, 1, hasIcon ? 1 : 0); } QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->setSpacing(48); if (mDetail && !mDetail->isHidden()) { buttonLayout->setContentsMargins(0, 0, 0, 24); } else { buttonLayout->setContentsMargins(0, 0, 0, 0); } buttonLayout->setSizeConstraint(QLayout::SetNoConstraint); if (mCheckbox) { buttonLayout->addWidget(mCheckbox, 0, Qt::AlignLeft | Qt::AlignVCenter); } if (mButtonBox->layout()) { mButtonBox->layout()->setSpacing(8); } buttonLayout->addWidget(mButtonBox, 0, Qt::AlignRight | Qt::AlignVCenter); QVBoxLayout *contentLayout = new QVBoxLayout; contentLayout->setContentsMargins(20, 0 , 20, 20); contentLayout->setSpacing(0); contentLayout->addLayout(gridLayout); contentLayout->addLayout(buttonLayout); if (mDetail) { contentLayout->addWidget(mDetail); } QHBoxLayout *titleLayout = new QHBoxLayout; titleLayout->setContentsMargins(20,0,0,0); titleLayout->addWidget(mTitleText, Qt::AlignLeft | Qt::AlignVCenter); titleLayout->addWidget(mCloseButtton, Qt::AlignRight | Qt::AlignVCenter); QVBoxLayout *layout = new QVBoxLayout; layout->setContentsMargins(4, 4, 4, 4); layout->setSpacing(4); // layout->addWidget(mCloseButtton, 0, Qt::AlignRight); layout->addLayout(titleLayout); layout->addSpacing(0); layout->addLayout(contentLayout); q->setLayout(layout); updateSize(); } void MessageBoxPrivate::updateSize() { Q_Q(MessageBox); if (q->layout() == nullptr) return; if (QGuiApplication::screenAt(QCursor::pos()) == nullptr) { return; } q->layout()->activate(); while (mButtonBox->layout()->count() < mButtonBox->buttons().count() + 1) { QEvent event(QEvent::StyleChange); QGuiApplication::sendEvent(mButtonBox, &event); } QSize minSize(424, 156); QSize size; QSize screenSize = QGuiApplication::screenAt(QCursor::pos())->availableGeometry().size(); QSize maxSize(screenSize.width() * 0.8, screenSize.height() * 0.8); mLabel->setWordWrap(false); if (mInformativeLabel) { mInformativeLabel->setWordWrap(false); } q->layout()->activate(); if (q->sizeHint().width() > qMax(mButtonBox->sizeHint().width() + 24 + 24, 452)) { mLabel->setWordWrap(true); if (mInformativeLabel) { mInformativeLabel->setWordWrap(true); } } q->layout()->activate(); q->setContentsMargins(0, 0, 0, 0); q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); size.setWidth(qMax(qMin(maxSize.width(), q->sizeHint().width()), minSize.width())); size.setHeight(qMax(qMin(maxSize.height(), q->layout()->hasHeightForWidth() ? q->layout()->totalHeightForWidth(size.width()) : q->layout()->totalMinimumSize().height()), minSize.height())); q->setFixedSize(size); QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest); } int MessageBoxPrivate::layoutMinimumWidth() { layout->activate(); return layout->totalMinimumSize().width(); } void MessageBoxPrivate::_q_buttonClicked(QAbstractButton* button) { Q_Q(MessageBox); if (mDetailButton && mDetail && button == mDetailButton) { mDetail->setHidden(!mDetail->isHidden()); mDetailButton->setText(mDetail->isHidden() ? QMessageBox::tr("Show Details...") : QMessageBox::tr("Hide Details...")); setupLayout(); } else { setClickedButton(button); if (mReceiverToDisconnectOnClose) { QObject::disconnect(q, mSignalToDisconnectOnClose, mReceiverToDisconnectOnClose, mMemberToDisconnectOnClose); mReceiverToDisconnectOnClose = nullptr; } mSignalToDisconnectOnClose.clear(); mMemberToDisconnectOnClose.clear(); } } void MessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role) { Q_Q(MessageBox); if (button > QPlatformDialogHelper::LastButton) { mClickedButton = static_cast(mOptions->customButton(button)->button); Q_ASSERT(mClickedButton); mClickedButton->click(); q->done(role); } else { q->done(button); } } // after click button void MessageBoxPrivate::setClickedButton(QAbstractButton *button) { Q_Q(MessageBox); mClickedButton = button; Q_EMIT q->buttonClicked(mClickedButton); mClickedButton = button; auto resultCode = execReturnCode(button); hide(resultCode); finalize(resultCode, dialogCodeForButton(button)); } QAbstractButton* MessageBoxPrivate::findButton(int button0, int button1, int button2, int flags) { Q_Q(MessageBox); int button = 0; if (button0 & flags) { button = button0; } else if (button1 & flags) { button = button1; } else if (button2 & flags) { button = button2; } return q->button(newButton(button)); } static bool detectedCompat(int button0, int button1, int button2) { if (button0 != 0 && !(button0 & NewButtonMask)) { return true; } if (button1 != 0 && !(button1 & NewButtonMask)) { return true; } if (button2 != 0 && !(button2 & NewButtonMask)) { return true; } return false; } void MessageBoxPrivate::addOldButtons(int button0, int button1, int button2) { Q_Q(MessageBox); q->addButton(newButton(button0)); q->addButton(newButton(button1)); q->addButton(newButton(button2)); q->setDefaultButton(static_cast(findButton(button0, button1, button2, QMessageBox::Default))); q->setEscapeButton(findButton(button0, button1, button2, QMessageBox::Escape)); mCompatMode = detectedCompat(button0, button1, button2); } QAbstractButton* MessageBoxPrivate::abstractButtonForId(int id) const { Q_Q(const MessageBox); QAbstractButton *result = mCustomButtonList.value(id); if (result) { return result; } if (id & QMessageBox::FlagMask) { return nullptr; } return q->button(newButton(id)); } int MessageBoxPrivate::execReturnCode(QAbstractButton *button) { int ret = mButtonBox->standardButton(button); if (ret == QMessageBox::NoButton) { ret = mCustomButtonList.indexOf(button); } else if (mCompatMode) { ret = -1; } return ret; } int MessageBoxPrivate::dialogCodeForButton(QAbstractButton *button) const { Q_Q(const MessageBox); switch (q->buttonRole(button)) { case QMessageBox::AcceptRole: case QMessageBox::YesRole: return QDialog::Accepted; case QMessageBox::RejectRole: case QMessageBox::NoRole: return QDialog::Rejected; default: return -1; } } void MessageBoxPrivate::detectEscapeButton() { if (mEscapeButton) { mDetectedEscapeButton = mEscapeButton; return; } mDetectedEscapeButton = mButtonBox->button(QDialogButtonBox::Cancel); if (mDetectedEscapeButton) { return; } const QList buttons = mButtonBox->buttons(); if (buttons.count() == 1) { mDetectedEscapeButton = buttons.first(); return; } if (buttons.count() == 2 && mDetailButton) { auto idx = buttons.indexOf(mDetailButton); if (idx != -1) { mDetectedEscapeButton = buttons.at(1 - idx); return; } } for (auto *button : buttons) { if (mButtonBox->buttonRole(button) == QDialogButtonBox::RejectRole) { if (mDetectedEscapeButton) { // already detected! mDetectedEscapeButton = nullptr; break; } mDetectedEscapeButton = button; } } if (mDetectedEscapeButton) { return; } for (auto *button : buttons) { if (mButtonBox->buttonRole(button) == QDialogButtonBox::NoRole) { if (mDetectedEscapeButton) { // already detected! mDetectedEscapeButton = nullptr; break; } mDetectedEscapeButton = button; } } } QMessageBox::StandardButton MessageBoxPrivate::newButton(int button) { if (button == QMessageBox::NoButton) { return QMessageBox::StandardButton(button & QMessageBox::ButtonMask); } return QMessageBox::NoButton; } int MessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2) { MessageBox messageBox; messageBox.setIcon(icon); messageBox.setText(text); messageBox.setWindowTitle(title); messageBox.d_func()->addOldButtons(button0, button1, button2); Q_UNUSED(parent); return messageBox.exec(); } int MessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, const QString &button0Text, const QString &button1Text, const QString &button2Text, int defaultButtonNumber, int escapeButtonNumber) { MessageBox messageBox; messageBox.setIcon(icon); messageBox.setText(text); messageBox.setWindowTitle(title); QString myButton0Text = button0Text; if (myButton0Text.isEmpty()) { myButton0Text = QDialogButtonBox::tr("OK"); } messageBox.addButton(myButton0Text, QMessageBox::ActionRole); if (!button1Text.isEmpty()) { messageBox.addButton(button1Text, QMessageBox::ActionRole); } if (!button2Text.isEmpty()) { messageBox.addButton(button2Text, QMessageBox::ActionRole); } const QList &buttonList = messageBox.d_func()->mCustomButtonList; messageBox.setDefaultButton(static_cast(buttonList.value(defaultButtonNumber))); messageBox.setEscapeButton(buttonList.value(escapeButtonNumber)); Q_UNUSED(parent); return messageBox.exec(); } QMessageBox::StandardButton MessageBoxPrivate::showNewMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { if (defaultButton && !(buttons & defaultButton)) { return (QMessageBox::StandardButton) MessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0); } MessageBox messageBox; messageBox.setIcon(icon); messageBox.setText(text); messageBox.setWindowTitle(title); QDialogButtonBox *buttonBox = messageBox.findChild(); Q_ASSERT(buttonBox != nullptr); uint mask = QMessageBox::FirstButton; while (mask <= QMessageBox::LastButton) { uint sb = buttons & mask; mask <<= 1; if (!sb) { continue; } QPushButton *button = messageBox.addButton((QMessageBox::StandardButton)sb); if (messageBox.defaultButton()) { continue; } if ((defaultButton == QMessageBox::NoButton && buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) || (defaultButton != QMessageBox::NoButton && sb == uint(defaultButton))) { messageBox.setDefaultButton(button); } } if (messageBox.exec() == -1) { return QMessageBox::Cancel; } return messageBox.standardButton(messageBox.clickedButton()); } QPixmap MessageBoxPrivate::standardIcon(QMessageBox::Icon icon, MessageBox *mb) { QStyle *style = mb ? mb->style() : QApplication::style(); int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, nullptr, mb); QIcon tmpIcon; switch (icon) { case QMessageBox::Information: tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, nullptr, mb); break; case QMessageBox::Warning: tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, nullptr, mb); break; case QMessageBox::Critical: tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, nullptr, mb); break; case QMessageBox::Question: tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, nullptr, mb); default: break; } if (!tmpIcon.isNull()) { return tmpIcon.pixmap (QSize(iconSize, iconSize)); } return QPixmap(); } void MessageBoxPrivate::initHelper(QPlatformDialogHelper* h) { Q_Q(MessageBox); QObject::connect(h, SIGNAL(clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole)), q, SLOT(_q_clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole))); static_cast(h)->setOptions(mOptions); } void MessageBoxPrivate::helperPrepareShow(QPlatformDialogHelper*) { Q_Q(MessageBox); mOptions->setWindowTitle(q->windowTitle()); mOptions->setText(q->text()); mOptions->setInformativeText(q->informativeText()); //#if QT_CONFIG(textedit) // mOptions->setDetailedText(q->detailedText()); //#endif mOptions->setIcon(helperIcon(q->icon())); mOptions->setStandardButtons(helperStandardButtons(q)); } void MessageBoxPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper*) { Q_Q(MessageBox); QAbstractButton *button = q->button(QMessageBox::StandardButton(code)); if (button) { mClickedButton = button; } } static QPlatformDialogHelper::StandardButtons helperStandardButtons(MessageBox * q) { QPlatformDialogHelper::StandardButtons buttons(int(q->standardButtons())); return buttons; } static QMessageDialogOptions::Icon helperIcon(QMessageBox::Icon i) { switch (i) { case QMessageBox::NoIcon: return QMessageDialogOptions::NoIcon; case QMessageBox::Information: return QMessageDialogOptions::Information; case QMessageBox::Warning: return QMessageDialogOptions::Warning; case QMessageBox::Critical: return QMessageDialogOptions::Critical; case QMessageBox::Question: return QMessageDialogOptions::Question; } return QMessageDialogOptions::NoIcon; } static QMessageBox::StandardButton newButton(int button) { // this is needed for source compatibility with Qt 4.0 and 4.1 if (button == QMessageBox::NoButton || (button & NewButtonMask)) return QMessageBox::StandardButton(button & QMessageBox::ButtonMask); #if QT_VERSION < 0x050000 // this is needed for binary compatibility with Qt 4.0 and 4.1 switch (button & Old_ButtonMask) { case Old_Ok: return QMessageBox::Ok; case Old_Cancel: return QMessageBox::Cancel; case Old_Yes: return QMessageBox::Yes; case Old_No: return QMessageBox::No; case Old_Abort: return QMessageBox::Abort; case Old_Retry: return QMessageBox::Retry; case Old_Ignore: return QMessageBox::Ignore; case Old_YesAll: return QMessageBox::YesToAll; case Old_NoAll: return QMessageBox::NoToAll; default: return QMessageBox::NoButton; } #else return QMessageBox::NoButton; #endif } class MessageBoxOptionsPrivate : public QSharedData { public: MessageBoxOptionsPrivate() : icon(QMessageDialogOptions::NoIcon), buttons(QPlatformDialogHelper::Ok), nextCustomButtonId(QPlatformDialogHelper::LastButton + 1) { } QString windowTitle; QMessageDialogOptions::Icon icon; QString text; QString informativeText; QString detailedText; QPlatformDialogHelper::StandardButtons buttons; QList customButtons; int nextCustomButtonId; }; MessageBoxHelper::MessageBoxHelper() : QPlatformMessageDialogHelper(), mMessageBox(new MessageBox) { connect(mMessageBox, &QDialog::accepted, this, &MessageBoxHelper::accept); connect(mMessageBox, &QDialog::rejected, this, &MessageBoxHelper::reject); } MessageBoxHelper::~MessageBoxHelper() { if(mMessageBox){ mMessageBox->deleteLater(); mMessageBox = nullptr; } } void MessageBoxHelper::exec() { int ret = mMessageBox->exec(); int role = mMessageBox->buttonRole(mMessageBox->clickedButton()); mMessageBox->done(ret); Q_EMIT clicked((QPlatformDialogHelper::StandardButton)ret, QPlatformDialogHelper::ButtonRole(role)); } void MessageBoxHelper::hide() { mMessageBox->hide(); } bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) { initDialog(windowFlags, windowModality, parent); if (parent && mMessageBox->find(parent->winId())) { if (QWidget *p = mMessageBox->find(parent->winId())) { for(QMessageBox *mb : p->findChildren()) { if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text() && mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) { if(!mb->windowIcon().isNull()){ mMessageBox->setWindowIcon(mb->windowIcon()); break; } } } //QMessageBox checkbox if (p->findChild()) { for (QMessageBox *mb : p->findChildren()) { if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text() && mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) { if (QCheckBox *cb = mb->findChild()) { if (mb->layout() && (mb->layout()->indexOf(cb) != -1)) { mMessageBox->setCheckBox(cb); } } } } } //QMessageBox custom icon if (mMessageBox->icon() == QMessageBox::NoIcon) { for (QMessageBox *mb : p->findChildren()) { if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text() && mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) { if (!mb->iconPixmap().isNull()) { mMessageBox->setIconPixmap(mb->iconPixmap()); } } } } for (QMessageBox *mb : p->findChildren()) { if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text() && mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) { if(mb->escapeButton() && mMessageBox->escapeButton() != mb->escapeButton()) mMessageBox->setEscapeButton(mb->escapeButton()); if(mb->defaultButton()){ QString btnText = mb->defaultButton()->text(); foreach (QAbstractButton* btn, mMessageBox->buttons()) { if(btn->text() == btnText){ mMessageBox->setDefaultButton(dynamic_cast(btn)); break; } } } } } if (windowModality == Qt::WindowModal && mMessageBox->parentWidget() != p) { ///QDialog center in parent mMessageBox->setParent(p, Qt::Sheet); } else if(mMessageBox->parentWidget() != p){ ///QDialog center in parent mMessageBox->setParent(p, Qt::Dialog); } } } else{ if(windowModality == Qt::WindowModal && mMessageBox->windowFlags() != Qt::Sheet) mMessageBox->setWindowFlag(Qt::Sheet); else if(mMessageBox->windowFlags() != Qt::Dialog) mMessageBox->setWindowFlag(Qt::Dialog); } if(parent == nullptr || mMessageBox->find(parent->winId()) == nullptr) { QList widgets = QApplication::allWidgets(); foreach (QWidget *w, widgets) { if(QMessageBox *mb = qobject_cast(w)) { if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text() && mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) { if(mb->escapeButton() && mMessageBox->escapeButton() != mb->escapeButton()) mMessageBox->setEscapeButton(mb->escapeButton()); if(mb->defaultButton() == nullptr) break; QString btnText = mb->defaultButton()->text(); foreach (QAbstractButton* btn, mMessageBox->buttons()) { if(btn->text() == btnText){ mMessageBox->setDefaultButton(dynamic_cast(btn)); break; } } break; } } } } mMessageBox->setuplayout(); /* if (!mMessageBox->isVisible()) { if(parent){ QWidget *p = mMessageBox->find(parent->winId()); int x = (p->width() - mMessageBox->width()) > 0 ? (p->width() - mMessageBox->width()) / 2 : 0; int y = (p->height() - mMessageBox->height()) > 0 ? (p->height() - mMessageBox->height()) / 2 : 0; QPoint gloabP = QPoint(x, y) + p->mapToGlobal(p->pos()); qDebug() << "gloabP...." << gloabP; QPoint point = p->mapFromGlobal(gloabP); qDebug() << "point....." << point; if (windowModality == Qt::WindowModal) { qDebug() << "WindowModal............"; mMessageBox->setParent(p, Qt::Sheet); } else{ qDebug() << "Dialog............"; mMessageBox->setParent(p, Qt::Dialog); } // mMessageBox->move(point); qDebug() << "mMessageBox parent......" << p << p->geometry() << p->mapToGlobal(p->pos()); qDebug() << "mMessageBox ....." << mMessageBox << mMessageBox->geometry(); } else{ int number = QApplication::desktop()->screenNumber(QCursor::pos()); if(number<0){ number=0; } QSize size = QApplication::screens().at(number)->availableGeometry().size(); // qDebug() << "availableGeometry......" << size << QApplication::screens().at(number)->availableSize(); mMessageBox->move(QPoint((size.width() - mMessageBox->width()) / 2, (size.height() - mMessageBox->height()) / 2)); } // if (QWidget *p = mMessageBox->find(parent->winId())) { // qDebug() << "isvisible....." << mMessageBox->isVisible(); // qDebug() << "p geometry1231233333......" << p << p->geometry() << p->mapToGlobal(QPoint(0,0)); // qDebug() << "parent geometry1231233333......" << parent << parent->geometry() << parent->mapToGlobal(QPoint(0,0)); // mMessageBox->move(QPoint((p->width() - mMessageBox->width()) / 2, (p->height() - mMessageBox->height()) / 2) // + p->mapToGlobal(QPoint(0,0))); // mMessageBox->move(QPoint((parent->width() - mMessageBox->width()) / 2, (parent->height() - mMessageBox->height()) / 2) // + QPoint(parent->x(), parent->y())); // qDebug() << "parent11111111............" << mMessageBox->geometry() << parent->geometry() << p->geometry(); // } } */ //remove windows header // QString platform = QGuiApplication::platformName(); // if(platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive)) // { // kdk::UkuiStyleHelper::self()->removeHeader(mMessageBox); // } else { // MotifWmHints hints; // hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; // hints.functions = MWM_FUNC_ALL; // hints.decorations = MWM_DECOR_BORDER; // XAtomHelper::getInstance()->setWindowMotifHint(mMessageBox->winId(), hints); // } // UkuiWindowHelper *windowHelper = new UkuiWindowHelper(mMessageBox); // windowHelper->removeTitleBar(); // windowHelper->setSkipTaskBar(true); foreach (QAbstractButton *ab, mMessageBox->buttons()) { if (QPushButton *pb = qobject_cast(ab)) { if (pb->isDefault()) { pb->setProperty("isImportant", true); mMessageBox->setDefaultButton(pb); } else { pb->setProperty("isImportant", false); } } } mMessageBox->show(); return true; } void MessageBoxHelper::initDialog(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) { if(!mMessageBox->isVisible()) mMessageBox->setWindowModality(windowModality); mMessageBox->setIcon((QMessageBox::Icon)options()->icon()); mMessageBox->setText(options()->text()); mMessageBox->setInformativeText(options()->informativeText()); mMessageBox->setDetailedText(options()->detailedText()); mMessageBox->setWindowTitle(options()->windowTitle()); QPlatformDialogHelper::StandardButtons btns = options()->standardButtons(); uint mask = QMessageBox::FirstButton; while (mask <= QMessageBox::LastButton) { uint sb = btns & mask; mask <<= 1; if (!sb) { continue; } mMessageBox->addButton((QMessageBox::StandardButton)sb); } for (QMessageDialogOptions::CustomButton button : options()->customButtons()) { QAbstractButton *ab = static_cast(button.button); if (ab) { if (!ab->text().isEmpty() && ab->text() == QMessageBox::tr("Show Details...") || ab->text() == QMessageBox::tr("Hide Details...")) continue; ab->setIcon(QIcon()); } mMessageBox->addButton(ab, QMessageBox::ButtonRole(button.role)); } } qt6-ukui-platformtheme/qt6-ukui-platformtheme/widget/messagebox/message-box.h0000664000175000017500000002371415154306200026372 0ustar fengfeng/* * KWin Style UKUI * * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authors: xibowen * */ #ifndef MESSAGEBOX_H #define MESSAGEBOX_H #include #include #include #include #include #include #include #include #include #include "private/qdialog_p.h" #include // #include "ukuiwindowhelper.h" class QLabel; class QAbstractButton; class MessageBoxHelper; class MessageBoxPrivate; class MessageBoxOptionsPrivate; typedef QMessageBox::Icon Icon; typedef QMessageBox::StandardButtons StandardButtons; class MessageBox : public QDialog { Q_OBJECT Q_PROPERTY(Icon mIcon READ icon WRITE setIcon) Q_PROPERTY(QString mText READ text WRITE setText) Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat) Q_PROPERTY(QPixmap mIconPixmap READ iconPixmap WRITE setIconPixmap) Q_PROPERTY(QString mInformativeText READ informativeText WRITE setInformativeText) Q_PROPERTY(StandardButtons mStandardButtons READ standardButtons WRITE setStandardButtons) Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) friend class MessageBoxHelper; public: explicit MessageBox(QWidget *parent = nullptr); ~MessageBox(); void setCheckBox(QCheckBox *cb); QCheckBox* checkBox() const; QMessageBox::Icon icon (); void setIcon (QMessageBox::Icon icon); QPixmap iconPixmap() const; void setIconPixmap(const QPixmap &pixmap); QString text(); void setText (const QString& text); QString informativeText() const; void setInformativeText(const QString &text); QString detailedText() const; void setDetailedText(const QString &text); QString buttonText(int button) const; void setButtonText(int button, const QString &text); Qt::TextFormat textFormat() const; void setTextFormat(Qt::TextFormat format); void setTextInteractionFlags(Qt::TextInteractionFlags flags); Qt::TextInteractionFlags textInteractionFlags() const; void addButton(QAbstractButton *button, QMessageBox::ButtonRole role); QPushButton* addButton(const QString &text, QMessageBox::ButtonRole role); QPushButton* addButton(QMessageBox::StandardButton button); void removeButton(QAbstractButton *button); QAbstractButton* button (QMessageBox::StandardButton which) const; QList buttons() const; QMessageBox::ButtonRole buttonRole(QAbstractButton *button) const; QMessageBox::StandardButtons standardButtons() const; void setStandardButtons(QMessageBox::StandardButtons buttons); QMessageBox::StandardButton standardButton(QAbstractButton *button) const; QPushButton* defaultButton() const; void setDefaultButton(QPushButton *button); void setDefaultButton(QMessageBox::StandardButton button); QAbstractButton* escapeButton() const; void setEscapeButton(QAbstractButton *button); void setEscapeButton(QMessageBox::StandardButton button); QAbstractButton* clickedButton() const; void setWindowTitle(const QString &title); void setWindowModality(Qt::WindowModality windowModality); static QPixmap standardIcon(QMessageBox::Icon icon); void setWindowIcon(const QIcon &icon); protected: bool event(QEvent *e) override; void changeEvent(QEvent *event) override; void showEvent(QShowEvent *event) override; virtual void closeEvent(QCloseEvent *event) override; void keyPressEvent(QKeyEvent *event) override; void paintEvent (QPaintEvent *event) override; void resizeEvent(QResizeEvent *event) override; private: void initHelper(QPlatformMessageDialogHelper*); void setuplayout(); public slots: void tableModeChanged(bool isTableMode); Q_SIGNALS: void buttonClicked(QAbstractButton* button); private: Q_DISABLE_COPY(MessageBox) Q_DECLARE_PRIVATE(MessageBox) Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton*)) Q_PRIVATE_SLOT(d_func(), void _q_clicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole)) // UkuiWindowHelper *m_windowHelper; }; class MessageBoxHelper : public QPlatformMessageDialogHelper { Q_OBJECT public: explicit MessageBoxHelper(); ~MessageBoxHelper() override; virtual void exec() override; virtual void hide() override; virtual bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override; Q_SIGNALS: void clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role); private: void initDialog (Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent); private: MessageBox* mMessageBox = nullptr; }; class TextEdit : public QTextEdit { public: TextEdit(QWidget *parent=0) : QTextEdit(parent) { } void contextMenuEvent(QContextMenuEvent * e) override { QMenu *menu = createStandardContextMenu(); menu->setAttribute(Qt::WA_DeleteOnClose); menu->popup(e->globalPos()); } }; class MessageBoxPrivate : public QDialogPrivate { Q_DECLARE_PUBLIC(MessageBox) public: MessageBoxPrivate (); ~MessageBoxPrivate (); void init (const QString &title = QString(), const QString &text = QString()); void setupLayout (); void _q_buttonClicked(QAbstractButton*); void _q_clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role); void setClickedButton(QAbstractButton *button); QAbstractButton* findButton(int button0, int button1, int button2, int flags); void addOldButtons(int button0, int button1, int button2); QAbstractButton *abstractButtonForId(int id) const; int execReturnCode(QAbstractButton *button); int dialogCodeForButton(QAbstractButton *button) const; void updateSize(); int layoutMinimumWidth(); void detectEscapeButton(); static QMessageBox::StandardButton newButton(int button); static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2); static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, const QString &btn0Text, const QString &btn1Text, const QString &btn2Text, int defBtnNum, int espBtnNum); static QPixmap standardIcon(QMessageBox::Icon icon, MessageBox *mb); static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons btn, QMessageBox::StandardButton defBtn); private: void initHelper(QPlatformDialogHelper*) override; void helperPrepareShow(QPlatformDialogHelper*) override; void helperDone(QDialog::DialogCode, QPlatformDialogHelper*) override; public: QLabel* mLabel = nullptr; QLabel* mInformativeLabel = nullptr; TextEdit* mDetail = nullptr; // qt 显示 label 暂定使用富文本框 QCheckBox* mCheckbox = nullptr; // qt checkbox QLabel* mIconLabel = nullptr; // qt 显示图标 QDialogButtonBox* mButtonBox = nullptr; // qt 按钮框 QPushButton* mDetailButton = nullptr; // 详细情况按钮 QPushButton* mCloseButtton = nullptr; //标题栏关闭按钮 QLabel* mTitleText = nullptr; //标题文本 QLabel* mTitleIcon = nullptr; //标题icon QByteArray mMemberToDisconnectOnClose; QByteArray mSignalToDisconnectOnClose; QPointer mReceiverToDisconnectOnClose; QString mTipString; // 原始的需要展示的文本 QMessageBox::Icon mIcon; QList mCustomButtonList; // 自定义按钮 QAbstractButton* mEscapeButton = nullptr; QPushButton* mDefaultButton = nullptr; QAbstractButton* mClickedButton = nullptr; // 复选框按钮 bool mCompatMode; bool mShowDetail; // 是否显示详细信息 bool mAutoAddOkButton; // QTextEdit* informativeTextEdit; QAbstractButton* mDetectedEscapeButton = nullptr; QSharedPointer mOptions; private: int mRadius = 0; int mIconSize = 24; }; #endif // MESSAGEBOX_H qt6-ukui-platformtheme/qt6-ukui-platformtheme/widget/filedialog/0000775000175000017500000000000015154306200023742 5ustar fengfengqt6-ukui-platformtheme/qt6-ukui-platformtheme/widget/filedialog/xdgdesktopportalfiledialog.cpp0000664000175000017500000004462215154306200032074 0ustar fengfeng/**************************************************************************** ** ** Copyright (C) 2017-2018 Red Hat, Inc ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** 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 https://www.qt.io/terms-conditions. For further ** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ** Modified by: Tan Jing on 2025-04-02 ****************************************************************************/ #include "xdgdesktopportalfiledialog_p.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include QT_BEGIN_NAMESPACE QDBusArgument &operator <<(QDBusArgument &arg, const XdgDesktopPortalFileDialog::FilterCondition &filterCondition) { arg.beginStructure(); arg << filterCondition.type << filterCondition.pattern; arg.endStructure(); return arg; } const QDBusArgument &operator >>(const QDBusArgument &arg, XdgDesktopPortalFileDialog::FilterCondition &filterCondition) { uint type; QString filterPattern; arg.beginStructure(); arg >> type >> filterPattern; filterCondition.type = (XdgDesktopPortalFileDialog::ConditionType)type; filterCondition.pattern = filterPattern; arg.endStructure(); return arg; } QDBusArgument &operator <<(QDBusArgument &arg, const XdgDesktopPortalFileDialog::Filter filter) { arg.beginStructure(); arg << filter.name << filter.filterConditions; arg.endStructure(); return arg; } const QDBusArgument &operator >>(const QDBusArgument &arg, XdgDesktopPortalFileDialog::Filter &filter) { QString name; XdgDesktopPortalFileDialog::FilterConditionList filterConditions; arg.beginStructure(); arg >> name >> filterConditions; filter.name = name; filter.filterConditions = filterConditions; arg.endStructure(); return arg; } class XdgDesktopPortalFileDialogPrivate { public: XdgDesktopPortalFileDialogPrivate(QPlatformFileDialogHelper *nativeFileDialog) : nativeFileDialog(nativeFileDialog) { } WId winId = 0; bool directoryMode = false; bool modal = false; bool multipleFiles = false; bool saveFile = false; QString acceptLabel; QString directory; QString title; QStringList nameFilters; QStringList mimeTypesFilters; // maps user-visible name for portal to full name filter QMap userVisibleToNameFilter; QString selectedMimeTypeFilter; QString selectedNameFilter; QStringList selectedFiles; QPlatformFileDialogHelper *nativeFileDialog = nullptr; }; XdgDesktopPortalFileDialog::XdgDesktopPortalFileDialog(QPlatformFileDialogHelper *nativeFileDialog) : QPlatformFileDialogHelper() , d_ptr(new XdgDesktopPortalFileDialogPrivate(nativeFileDialog)) { Q_D(XdgDesktopPortalFileDialog); if (d->nativeFileDialog) { connect(d->nativeFileDialog, SIGNAL(accept()), this, SIGNAL(accept())); connect(d->nativeFileDialog, SIGNAL(reject()), this, SIGNAL(reject())); } } XdgDesktopPortalFileDialog::~XdgDesktopPortalFileDialog() { } void XdgDesktopPortalFileDialog::initializeDialog() { Q_D(XdgDesktopPortalFileDialog); if (d->nativeFileDialog) d->nativeFileDialog->setOptions(options()); if (options()->fileMode() == QFileDialogOptions::ExistingFiles) d->multipleFiles = true; if (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly) d->directoryMode = true; if (options()->isLabelExplicitlySet(QFileDialogOptions::Accept)) d->acceptLabel = options()->labelText(QFileDialogOptions::Accept); if (!options()->windowTitle().isEmpty()) d->title = options()->windowTitle(); if (options()->acceptMode() == QFileDialogOptions::AcceptSave) d->saveFile = true; if (!options()->nameFilters().isEmpty()) d->nameFilters = options()->nameFilters(); if (!options()->mimeTypeFilters().isEmpty()) d->mimeTypesFilters = options()->mimeTypeFilters(); if (!options()->initiallySelectedMimeTypeFilter().isEmpty()) d->selectedMimeTypeFilter = options()->initiallySelectedMimeTypeFilter(); if (!options()->initiallySelectedNameFilter().isEmpty()) d->selectedNameFilter = options()->initiallySelectedNameFilter(); setDirectory(options()->initialDirectory()); } void XdgDesktopPortalFileDialog::openPortal() { Q_D(XdgDesktopPortalFileDialog); // qDebug() << "openPortal 11111111............" << d->saveFile ; QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), QLatin1String("/org/freedesktop/portal/desktop"), QLatin1String("org.freedesktop.portal.FileChooser"), d->saveFile ? QLatin1String("SaveFile") : QLatin1String("OpenFile")); QString parentWindowId; QString platform = QGuiApplication::platformName(); if(platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive)) { parentWindowId = QLatin1String("wayland:") + QString::number(d->winId); } else { parentWindowId = QLatin1String("x11:") + QString::number(d->winId); } QVariantMap options; if (!d->acceptLabel.isEmpty()) options.insert(QLatin1String("accept_label"), d->acceptLabel); options.insert(QLatin1String("modal"), d->modal); options.insert(QLatin1String("multiple"), d->multipleFiles); options.insert(QLatin1String("directory"), d->directoryMode); options.insert(QLatin1String("current_folder"), QFile::encodeName(m_initialPath).append('\0')); if (d->saveFile) { if (!m_initialSelectFiles.isEmpty()){ options.insert(QLatin1String("current_file"), QFile::encodeName(m_initialSelectFiles.first().path()).append('\0')); if(!m_initialSelectFiles.first().path().endsWith("/")){ QString name = m_initialSelectFiles.first().path().split("/").last(); options.insert(QLatin1String("current_name"), name); } } } // Insert filters qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType(); FilterList filterList; auto selectedFilterIndex = filterList.size() - 1; d->userVisibleToNameFilter.clear(); // qDebug() << "mimeTypesFilters..." << d->mimeTypesFilters << d->nameFilters; if (!d->mimeTypesFilters.isEmpty()) { for (const QString &mimeTypefilter : d->mimeTypesFilters) { QMimeDatabase mimeDatabase; QMimeType mimeType = mimeDatabase.mimeTypeForName(mimeTypefilter); // Creates e.g. (1, "image/png") FilterCondition filterCondition; filterCondition.type = MimeType; filterCondition.pattern = mimeTypefilter; // Creates e.g. [((1, "image/png"))] FilterConditionList filterConditions; filterConditions << filterCondition; // Creates e.g. [("Images", [((1, "image/png"))])] Filter filter; filter.name = mimeType.comment(); filter.filterConditions = filterConditions; filterList << filter; if (!d->selectedMimeTypeFilter.isEmpty() && d->selectedMimeTypeFilter == mimeTypefilter) selectedFilterIndex = filterList.size() - 1; } } else if (!d->nameFilters.isEmpty()) { for (const QString &nameFilter : d->nameFilters) { // Do parsing: // Supported format is ("Images (*.png *.jpg)") QRegularExpression regexp(QPlatformFileDialogHelper::filterRegExp); QRegularExpressionMatch match = regexp.match(nameFilter); if (match.hasMatch()) { QString userVisibleName = match.captured(1); QStringList filterStrings = match.captured(2).split(QLatin1Char(' '), Qt::SkipEmptyParts); if (filterStrings.isEmpty()) { qWarning() << "Filter " << userVisibleName << " is empty and will be ignored."; continue; } FilterConditionList filterConditions; for (const QString &filterString : filterStrings) { FilterCondition filterCondition; filterCondition.type = GlobalPattern; filterCondition.pattern = filterString; filterConditions << filterCondition; } if(userVisibleName.isEmpty()) userVisibleName = " "; Filter filter; filter.name = userVisibleName; filter.filterConditions = filterConditions; filterList << filter; d->userVisibleToNameFilter.insert(userVisibleName, nameFilter); if (!d->selectedNameFilter.isEmpty() && d->selectedNameFilter == nameFilter) selectedFilterIndex = filterList.size() - 1; } } } // "[('Images', [(0, '*ico'), (1, 'image/png')]), ('Text', [(0, '*.txt')])]"; if (!filterList.isEmpty()) options.insert(QLatin1String("filters"), QVariant::fromValue(filterList)); if (selectedFilterIndex != -1) options.insert(QLatin1String("current_filter"), QVariant::fromValue(filterList[selectedFilterIndex])); options.insert(QLatin1String("handle_token"), QStringLiteral("qt%1").arg(QRandomGenerator::global()->generate())); // TODO choices a(ssa(ss)s) // List of serialized combo boxes to add to the file chooser. message << parentWindowId << d->title << options; QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall); connect(watcher, &QDBusPendingCallWatcher::finished, this, [this] (QDBusPendingCallWatcher *watcher) { QDBusPendingReply reply = *watcher; if (reply.isError()) { qWarning() << "reply error......" << reply.error(); Q_EMIT reject(); } else { QDBusConnection::sessionBus().connect(nullptr, reply.value().path(), QLatin1String("org.freedesktop.portal.Request"), QLatin1String("Response"), this, SLOT(gotResponse(uint,QVariantMap))); } }); } bool XdgDesktopPortalFileDialog::defaultNameFilterDisables() const { return false; } void XdgDesktopPortalFileDialog::setDirectory(const QUrl &directory) { Q_D(XdgDesktopPortalFileDialog); if (d->nativeFileDialog) { d->nativeFileDialog->setOptions(options()); d->nativeFileDialog->setDirectory(directory); } d->directory = directory.path(); } QUrl XdgDesktopPortalFileDialog::directory() const { Q_D(const XdgDesktopPortalFileDialog); if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly)) return d->nativeFileDialog->directory(); return d->directory; } void XdgDesktopPortalFileDialog::selectFile(const QUrl &filename) { Q_D(XdgDesktopPortalFileDialog); if (d->nativeFileDialog) { d->nativeFileDialog->setOptions(options()); d->nativeFileDialog->selectFile(filename); } d->selectedFiles << filename.path(); } QList XdgDesktopPortalFileDialog::selectedFiles() const { Q_D(const XdgDesktopPortalFileDialog); if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly)) return d->nativeFileDialog->selectedFiles(); QList files; for (const QString &file : d->selectedFiles) { files << QUrl(file); } return files; } void XdgDesktopPortalFileDialog::setFilter() { Q_D(XdgDesktopPortalFileDialog); if (d->nativeFileDialog) { d->nativeFileDialog->setOptions(options()); d->nativeFileDialog->setFilter(); } } void XdgDesktopPortalFileDialog::selectMimeTypeFilter(const QString &filter) { Q_D(XdgDesktopPortalFileDialog); if (d->nativeFileDialog) { d->nativeFileDialog->setOptions(options()); d->nativeFileDialog->selectMimeTypeFilter(filter); } } QString XdgDesktopPortalFileDialog::selectedMimeTypeFilter() const { Q_D(const XdgDesktopPortalFileDialog); return d->selectedMimeTypeFilter; } void XdgDesktopPortalFileDialog::selectNameFilter(const QString &filter) { Q_D(XdgDesktopPortalFileDialog); if (d->nativeFileDialog) { d->nativeFileDialog->setOptions(options()); d->nativeFileDialog->selectNameFilter(filter); } } QString XdgDesktopPortalFileDialog::selectedNameFilter() const { Q_D(const XdgDesktopPortalFileDialog); return d->selectedNameFilter; } void XdgDesktopPortalFileDialog::exec() { Q_D(XdgDesktopPortalFileDialog); if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly)) { d->nativeFileDialog->exec(); return; } // HACK we have to avoid returning until we emit that the dialog was accepted or rejected QEventLoop loop; loop.connect(this, SIGNAL(accept()), SLOT(quit())); loop.connect(this, SIGNAL(reject()), SLOT(quit())); loop.exec(); } void XdgDesktopPortalFileDialog::hide() { Q_D(XdgDesktopPortalFileDialog); if (d->nativeFileDialog) d->nativeFileDialog->hide(); } bool XdgDesktopPortalFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) { Q_D(XdgDesktopPortalFileDialog); // qDebug() << "show 2222222222222"; m_initialDirectory = options()->initialDirectory(); m_initialSelectFiles = options()->initiallySelectedFiles(); initializeDialog(); d->modal = windowModality != Qt::NonModal; d->winId = 0; if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly)) return d->nativeFileDialog->show(windowFlags, windowModality, parent); for(QWidget *widget : qApp->allWidgets()){ if(QFileDialog *fd = qobject_cast(widget)){ if(options()->windowTitle() == fd->windowTitle()){ // qDebug() << "parent us null filedoalog set parent...." << fd->geometry() << options()->windowTitle() << fd->objectName(); d->winId = fd->winId(); // qDebug() << "parent us null filedoalog directory...." << fd->directory(); // qDebug() << "parent us null filedoalog selectedFiles11111111...." << fd->selectedFiles(); if(m_initialSelectFiles.length() > 0 && QFile::exists(m_initialSelectFiles.value(0).path())){ QDir dir(m_initialSelectFiles.value(0).path()); dir.cdUp(); // qDebug() <<"dirrrrr..." << dir.path(); m_initialPath = dir.absolutePath(); } else if(fd->directory().exists() /*|| Peony::FileUtils::isFileExsit(fd->directory().path())*/){ // qDebug() << "updatePath........." << fd->directory(); m_initialPath = fd->directory().absolutePath(); } break; } } } openPortal(); // qDebug() << "show 1111111111111111111"; return true; } void XdgDesktopPortalFileDialog::gotResponse(uint response, const QVariantMap &results) { Q_D(XdgDesktopPortalFileDialog); if (!response) { if (results.contains(QLatin1String("uris"))) d->selectedFiles = results.value(QLatin1String("uris")).toStringList(); if (results.contains(QLatin1String("current_filter"))) { const Filter selectedFilter = qdbus_cast(results.value(QStringLiteral("current_filter"))); if (!selectedFilter.filterConditions.empty() && selectedFilter.filterConditions[0].type == MimeType) { // s.a. XdgDesktopPortalFileDialog::openPortal which basically does the inverse d->selectedMimeTypeFilter = selectedFilter.filterConditions[0].pattern; d->selectedNameFilter.clear(); } else { d->selectedNameFilter = d->userVisibleToNameFilter.value(selectedFilter.name); d->selectedMimeTypeFilter.clear(); } } Q_EMIT accept(); } else { Q_EMIT reject(); } } QT_END_NAMESPACE qt6-ukui-platformtheme/qt6-ukui-platformtheme/widget/filedialog/xdgdesktopportalfiledialog_p.h0000664000175000017500000001031415154306200032047 0ustar fengfeng/**************************************************************************** ** ** Copyright (C) 2017-2018 Red Hat, Inc ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** 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 https://www.qt.io/terms-conditions. For further ** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ** Modified by: Tan Jing on 2025-04-02 ****************************************************************************/ #ifndef XDGDESKTOPPORTALFILEDIALOG_P_H #define XDGDESKTOPPORTALFILEDIALOG_P_H #include #include QT_BEGIN_NAMESPACE class XdgDesktopPortalFileDialogPrivate; class XdgDesktopPortalFileDialog : public QPlatformFileDialogHelper { Q_OBJECT Q_DECLARE_PRIVATE(XdgDesktopPortalFileDialog) public: enum ConditionType : uint { GlobalPattern = 0, MimeType = 1 }; // Filters a(sa(us)) // Example: [('Images', [(0, '*.ico'), (1, 'image/png')]), ('Text', [(0, '*.txt')])] struct FilterCondition { ConditionType type; QString pattern; // E.g. '*ico' or 'image/png' }; typedef QVector FilterConditionList; struct Filter { QString name; // E.g. 'Images' or 'Text FilterConditionList filterConditions;; // E.g. [(0, '*.ico'), (1, 'image/png')] or [(0, '*.txt')] }; typedef QVector FilterList; XdgDesktopPortalFileDialog(QPlatformFileDialogHelper *nativeFileDialog = nullptr); ~XdgDesktopPortalFileDialog(); bool defaultNameFilterDisables() const override; QUrl directory() const override; void setDirectory(const QUrl &directory) override; void selectFile(const QUrl &filename) override; QList selectedFiles() const override; void setFilter() override; void selectNameFilter(const QString &filter) override; QString selectedNameFilter() const override; void selectMimeTypeFilter(const QString &filter) override; QString selectedMimeTypeFilter() const override; void exec() override; bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override; void hide() override; private Q_SLOTS: void gotResponse(uint response, const QVariantMap &results); private: void initializeDialog(); void openPortal(); private: QUrl m_initialDirectory; QList m_initialSelectFiles; QString m_initialPath; QScopedPointer d_ptr; }; QT_END_NAMESPACE Q_DECLARE_METATYPE(XdgDesktopPortalFileDialog::FilterCondition); Q_DECLARE_METATYPE(XdgDesktopPortalFileDialog::FilterConditionList); Q_DECLARE_METATYPE(XdgDesktopPortalFileDialog::Filter); Q_DECLARE_METATYPE(XdgDesktopPortalFileDialog::FilterList); #endif // XDGDESKTOPPORTALFILEDIALOG_P_H qt6-ukui-platformtheme/qt6-ukui-platformtheme/CMakeLists.txt0000664000175000017500000001156615154306200023131 0ustar fengfengcmake_minimum_required(VERSION 3.16) project(qt6-ukui-platformtheme) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(QT_MIN_VERSION "6.2.0") set(KF5_MIN_VERSION "5.66.0") find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS DBus Widgets Gui Quick QuickControls2 LinguistTools # 移除私有模块的直接 find_package 引用,改为通过目标属性获取 ) # 显式查找 Qt6 私有模块(Qt6 正确的私有模块引用方式) find_package(Qt6 REQUIRED COMPONENTS GuiPrivate WidgetsPrivate) message("Qt6Widgets_INCLUDE: ${Qt6Widgets_INCLUDE_DIRS}") # 修正变量名:Qt6Widgets_PRIVATE_INCLUDE → Qt6Widgets_PRIVATE_INCLUDES get_target_property(Qt6Gui_PRIVATE_INCLUDES Qt6::Gui INTERFACE_INCLUDE_DIRECTORIES) get_target_property(Qt6Widgets_PRIVATE_INCLUDES Qt6::Widgets INTERFACE_INCLUDE_DIRECTORIES) foreach(_dir ${Qt6Gui_PRIVATE_INCLUDES}) message(${_dir}) string(REGEX MATCHALL "QtGui" matches "${_dir}") list(LENGTH matches match_count) if(${match_count} EQUAL 2) string(REPLACE "QtGui" "QtThemeSupport" ThemeSupport_string "${_dir}") endif() endforeach() include_directories(${ThemeSupport_string}) # 修正变量名:Qt6Widgets_PRIVATE_INCLUDE → Qt6Widgets_PRIVATE_INCLUDES include_directories(${Qt6Widgets_PRIVATE_INCLUDES}) include_directories(${Qt6Gui_PRIVATE_INCLUDES}) # 修正变量名输出 message("Qt6Widgets_PRIVATE_INCLUDES: ${Qt6Widgets_PRIVATE_INCLUDES}") message("Qt6Gui_PRIVATE_INCLUDES: ${Qt6Gui_PRIVATE_INCLUDES}") find_package(X11) find_package(PkgConfig) pkg_check_modules(QGSETTINGS REQUIRED gsettings-qt6) pkg_check_modules(FONTCONFIG REQUIRED fontconfig) pkg_check_modules(FREETYPE2 REQUIRED freetype2) pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0) include_directories( ${QGSETTINGS_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ../libqt6-ukui-style/ ../ukui-styles/ ) if (FONTCONFIG_FOUND) include_directories(${FONTCONFIG_INCLUDE_DIRS}) link_directories(${FONTCONFIG_LIBRARY_DIRS}) endif() if (FREETYPE2_FOUND) include_directories(${FREETYPE2_INCLUDE_DIRS}) link_directories(${FREETYPE2_LIBRARY_DIRS}) endif() if (KYSDKWAYLANDHELPER_FOUND) include_directories(${KYSDKWAYLANDHELPER_INCLUDE_DIRS}) link_directories(${KYSDKWAYLANDHELPER_LIBRARY_DIRS}) endif() if (QGSETTINGS_FOUND) include_directories(${QGSETTINGS_INCLUDE_DIRS}) link_directories(${QGSETTINGS_LIBRARY_DIRS}) endif() if (UKUIWINDOWHELPER_FOUND) include_directories(${UKUIWINDOWHELPER_INCLUDE_DIRS}) link_directories(${UKUIWINDOWHELPER_LIBRARY_DIRS}) endif() file(GLOB_RECURSE ConfigSources ../ukui-styles/readconfig.cpp ) file(GLOB_RECURSE ConfigHeaders ../ukui-styles/readconfig.h ) set(sources main.cpp platform-theme-fontdata.cpp platform-theme-fontdata.h qt5-ukui-platform-theme.cpp qt5-ukui-platformtheme_global.h qt5-ukui-platform-theme.h xatom-helper.cpp xatom-helper.h widget/filedialog/xdgdesktopportalfiledialog.cpp widget/filedialog/xdgdesktopportalfiledialog_p.h ) set(Json ukui.json ) file(GLOB TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts") source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${sources} ${Json} ${TS_FILES}) set(UKUI_TRANSLATIONS_DIR "/usr/share/qt6-ukui-platformtheme") add_definitions(-DUKUI_TRANSLATIONS_DIR="${UKUI_TRANSLATIONS_DIR}") if (NOT DEFINED UPDATE_TRANSLATIONS) set(UPDATE_TRANSLATIONS "No") endif() if (UPDATE_TRANSLATIONS) qt6_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) else() qt6_add_translation(QM_FILES ${TS_FILES}) endif() add_custom_target(themetranslations ALL DEPENDS ${QM_FILES}) add_library(qt6-ukui-platformtheme MODULE ${sources} ${Json} ${TS_FILES} ${ConfigSources} ${ConfigHeaders} ) target_link_libraries(qt6-ukui-platformtheme PRIVATE Qt6::Widgets Qt6::DBus Qt6::Gui Qt6::Quick Qt6::QuickControls2 ${UKUIWINDOWHELPER_LIBRARIES} ${QGSETTINGS_LIBRARIES} xcb glib-2.0 ${X11_LIBRARIES} qt6-ukui-style ${FONTCONFIG_LIBRARIES} ${FREETYPE2_LIBRARIES} ${KYSDKWAYLANDHELPER_LIBRARIES} # 确保私有模块正确链接 Qt6::GuiPrivate Qt6::WidgetsPrivate ) target_compile_definitions(qt6-ukui-platformtheme PRIVATE -DQT5UKUIPLATFORMTHEME_LIBRARY -DQT_DEPRECATED_WARNINGS -DQT_MESSAGELOGCONTEXT -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 ) set(TARGET_PATH "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/qt6/plugins") set(UKUIPLATFORMTHEME_DIR ${TARGET_PATH}) target_compile_definitions(qt6-ukui-platformtheme PRIVATE UKUIPLATFORMTHEME_DIR="${UKUIPLATFORMTHEME_DIR}" ) if(UNIX) MESSAGE("libqt6-ukui-platformtheme TARGET_PATH: ${TARGET_PATH}") install(TARGETS ${PROJECT_NAME} DESTINATION ${TARGET_PATH}/platformthemes/) install(FILES ${QM_FILES} DESTINATION "${UKUI_TRANSLATIONS_DIR}") endif() qt6-ukui-platformtheme/qt6-ukui-platformtheme/main.cpp0000664000175000017500000000253515154306200022015 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include #include "qt5-ukui-platform-theme.h" #include #include #define UKUI_PLATFORMTHEME QT_BEGIN_NAMESPACE class Qt5UKUIPlatformThemePlugin : public QPlatformThemePlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QPlatformThemeFactoryInterface_iid FILE "ukui.json") public: virtual QPlatformTheme *create(const QString &key, const QStringList ¶ms) { if (key.toLower() == "ukui") { return new Qt5UKUIPlatformTheme(params); } return nullptr; } }; QT_END_NAMESPACE #include "main.moc" qt6-ukui-platformtheme/qt6-ukui-platformtheme/qt5-ukui-platform-theme.h0000664000175000017500000000714215154306200025143 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef QT5UKUIPLATFORMTHEME_H #define QT5UKUIPLATFORMTHEME_H #include "qt5-ukui-platformtheme_global.h" #include #include #include #include #include "../ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.h" #include "../ukui-styles/readconfig.h" #if !defined(QT_NO_DBUS) && defined(QT_DBUS_LIB) #if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) && !defined(QT_NO_SYSTEMTRAYICON) #define DBUS_TRAY #endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) #define GLOBAL_MENU #endif #endif class QPalette; #ifdef DBUS_TRAY class QPlatformSystemTrayIcon; #endif #ifdef GLOBAL_MENU class QPlatformMenuBar; #endif using namespace UKUIConfigStyleSpace; using namespace UKUIGlobalDTConfig; /*! * \brief The Qt5UKUIPlatformTheme class * \details * In UKUI desktop environment, we have our own platform to manage the qt applications' style. * This class is used to take over the theme and preferences of those applications. * The platform theme will effect globally. */ class QT5UKUIPLATFORMTHEMESHARED_EXPORT Qt5UKUIPlatformTheme : public QObject, public QPlatformTheme { Q_OBJECT public: Qt5UKUIPlatformTheme(const QStringList &args); ~Qt5UKUIPlatformTheme(); virtual const QPalette *palette(Palette type = SystemPalette) const; virtual const QFont *font(Font type = SystemFont) const; virtual QVariant themeHint(ThemeHint hint) const; virtual QIconEngine *createIconEngine(const QString &iconName) const; #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) virtual bool usePlatformNativeDialog(DialogType type) const; virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; #endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) // virtual QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = 0) const; // virtual QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = QPlatformTheme::IconOption::noOptions) const; // virtual QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = QPlatformTheme::IconOption::NoOptions) const; virtual QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = static_cast(0)) const; #endif #ifdef GLOBAL_MENU virtual QPlatformMenuBar* createPlatformMenuBar() const; #endif #if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; #endif public Q_SLOTS: void slotChangeStyle(const QString& key); private: QStringList xdgIconThemePaths() const; private: QFont m_system_font; QFont m_fixed_font; QPluginLoader *m_loader = nullptr; int m_portalVersion = 0; GlobalDTConfig *m_dtConfig = nullptr; QPalette *m_palette = nullptr; }; #endif // QT5UKUIPLATFORMTHEME_H qt6-ukui-platformtheme/qt6-ukui-platformtheme/qt5-ukui-platform-theme.cpp0000664000175000017500000003510115154306200025472 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include #include #include "qt5-ukui-platform-theme.h" #include "settings/ukui-style-settings.h" #include "effects/highlight-effect.h" #include "settings/black-list.h" #include #include #include #include #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) #include #include #endif #include #include #include //#include #include #include #include #include #include //#include "widget/messagebox/message-box.h" //#include "widget/filedialog/kyfiledialog.h" #include "platform-theme-fontdata.h" // #include "../qt5-ukui-filedialog/filedialoginterface.h" // #include "widget/filedialog/xdgdesktopportalfiledialog_p.h" #include #include #include #if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) static bool isDBusTrayAvailable() { static bool dbusTrayAvailable = false; static bool dbusTrayAvailableKnown = false; if (!dbusTrayAvailableKnown) { // 使用 DBus 连接直接检查状态栏服务 QDBusConnection bus = QDBusConnection::sessionBus(); if (bus.isConnected()) { // 检查是否有 StatusNotifierHost 服务注册 QStringList services = bus.interface()->registeredServiceNames(); for (const QString &service : services) { if (service.startsWith("org.kde.StatusNotifierHost")) { dbusTrayAvailable = true; break; } } } dbusTrayAvailableKnown = true; } return dbusTrayAvailable; } #endif void Qt5UKUIPlatformTheme::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); if(qApp){ 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(qApp); if(app == nullptr) return; QString font = settings->get("system-font").toString(); // QFontDatabase db; // QFontDatabase *db = QFontDatabase::instance(); int id = 0; if (!QFontDatabase::families().contains(font)) { PlatformThemeFontData fontData; QMap fontMap = fontData.getAllFontInformation(); if(fontMap.contains(font)){ auto iter = fontMap.find(font); id = QFontDatabase::addApplicationFont(iter.value()); } } // QFontDatabase *newDb = QFontDatabase::instance(); if (QFontDatabase::families().contains(font)) { QFont oldFont = QApplication::font(); m_system_font.setFamily(font); m_fixed_font.setFamily(font); oldFont.setFamily(font); QApplication::setFont(oldFont); } } if (key == "systemFontSize" || key == "system-font-size") { //Skip QGuiApplication avoid it crash when we setfont auto *app = qobject_cast(qApp); if(app == nullptr || qApp == 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(); m_system_font.setPointSize(fontSize); m_fixed_font.setPointSize(fontSize*1.2); oldFont.setPointSizeF(fontSize); QApplication::setFont(oldFont); } } } Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args) { //FIXME: Q_UNUSED(args) if (QGSettings::isSchemaInstalled("org.ukui.style")) { auto settings = UKUIStyleSettings::globalInstance(); //set font auto fontName = settings->get("systemFont").toString(); auto fontSize = settings->get("systemFontSize").toString().toDouble(); if (qApp && qApp->property("noChangeSystemFontSize").isValid() && qApp->property("noChangeSystemFontSize").toBool()) fontSize = 11; m_system_font.setFamily(fontName); m_system_font.setPointSizeF(fontSize); m_fixed_font.setFamily(fontName); m_fixed_font.setPointSizeF(fontSize*1.2); /*! * \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 auto *app = qobject_cast(qApp); if(app != nullptr) { QApplication::setFont(m_system_font); } if (app->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, &Qt5UKUIPlatformTheme::slotChangeStyle); } // // add qqc2 style // if (QFile::exists(QString("%1/kf5/kirigami/org.kylin.style.so").arg(QT_PLUGIN_INSTALL_DIRS))) { // QQuickStyle::setStyle("org.kylin.style"); // } // if(qApp && (qApp->inherits("QApplication") == true || qApp->inherits("QGuiApplication") == true) && qAppName() != "cura") { // QQuickStyle::setStyle("org.ukui.style"); // } QString systemLang = QLocale::system().name(); if(systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ"){ QGuiApplication::setLayoutDirection(Qt::RightToLeft); } else { QGuiApplication::setLayoutDirection(Qt::LeftToRight); } const char* c = UKUIPLATFORMTHEME_DIR; QString path = QString::fromUtf8(c); if (QFile::exists(QString("%1/platformthemes/libqt5-ukui-filedialog.so").arg(path))) { m_loader = new QPluginLoader(QString("%1/platformthemes/libqt5-ukui-filedialog.so").arg(path)); } // Get information about portal version QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), QLatin1String("/org/freedesktop/portal/desktop"), QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("Get")); message << QLatin1String("org.freedesktop.portal.FileChooser") << QLatin1String("version"); QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall); QObject::connect(watcher, &QDBusPendingCallWatcher::finished, [&] (QDBusPendingCallWatcher *watcher) { if (watcher->isError()) { // 错误处理 QDBusError error = watcher->error(); qWarning() << "D-Bus 调用失败:" << error.message(); } else { QDBusPendingReply reply = *watcher; if (reply.isValid()) { //qDebug() << "FileChooserPortalVersion......." << reply.value().toUInt(); m_portalVersion = reply.value().toUInt(); } } watcher->deleteLater(); }); m_dtConfig = new GlobalDTConfig(); m_palette = new QPalette(m_dtConfig->appPalette()); } Qt5UKUIPlatformTheme::~Qt5UKUIPlatformTheme() { if(m_loader){ m_loader->unload(); delete m_loader; m_loader = nullptr; } if(m_dtConfig){ delete m_dtConfig; m_dtConfig = nullptr; } if(m_palette){ delete m_palette; m_palette = nullptr; } } const QPalette *Qt5UKUIPlatformTheme::palette(Palette type) const { //FIXME: if (type == QPlatformTheme::SystemPalette && m_palette) { return m_palette; } return QPlatformTheme::palette(type); } const QFont *Qt5UKUIPlatformTheme::font(Font type) const { //FIXME: if (type == FixedFont) return &m_fixed_font; return &m_system_font; switch (type) { case SystemFont: return &m_system_font; case TitleBarFont: case FixedFont: case GroupBoxTitleFont: return &m_fixed_font; default: return &m_system_font; } return QPlatformTheme::font(type); } QVariant Qt5UKUIPlatformTheme::themeHint(ThemeHint hint) const { if(qAppName() == "cura") return QPlatformTheme::themeHint(hint); switch (hint) { case QPlatformTheme::StyleNames:{ // qDebug() << "Qt5UKUIPlatformTheme...."; // if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { // if (auto settings = UKUIStyleSettings::globalInstance()) { // QString themeName = settings->get("widget-theme-name").toString(); // if(themeName == "classical") // return QStringList()<< "ukui-default"; // } // } return QStringList()<< "ukui"; } case QPlatformTheme::SystemIconThemeName: { if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { if (auto settings = UKUIStyleSettings::globalInstance()) { QString icontheme = settings->get("icon-theme-name").toString(); return QStringList()<(l.instance()); // auto engine = p->create(); // qDebug()<<"use my engine"; // return engine; // } else { // qDebug()<<"use common engine"; // return QPlatformTheme::createIconEngine(iconName); // } // //return new XdgIconLoaderEngine(iconName); return QPlatformTheme::createIconEngine(iconName); } #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) bool Qt5UKUIPlatformTheme::usePlatformNativeDialog(DialogType type) const { switch (type) { case QPlatformTheme::FileDialog: if (ukuiFiledialogBlackList().contains(qAppName())) return false; else return false; case QPlatformTheme::FontDialog: case QPlatformTheme::ColorDialog: return false; case QPlatformTheme::MessageDialog: if(qApp && qApp->inherits("QApplication")) return true; // if (qAppName() == "ukui-control-center") // return false; default: break; } return false; } QPlatformDialogHelper *Qt5UKUIPlatformTheme::createPlatformDialogHelper(DialogType type) const { switch (type) { case QPlatformTheme::FileDialog: // if (!ukuiFiledialogBlackList().contains(qAppName())) { // if (qApp && qApp->inherits("QApplication") && (m_loader && m_loader->instance())) { // return qobject_cast(m_loader->instance())->create(); // } else if (qApp && qApp->inherits("QGuiApplication") && m_portalVersion >= 3) { // return new XdgDesktopPortalFileDialog; // } // } case QPlatformTheme::FontDialog: case QPlatformTheme::ColorDialog: return QPlatformTheme::createPlatformDialogHelper(type); case QPlatformTheme::MessageDialog: return QPlatformTheme::createPlatformDialogHelper(type); default: break; } return nullptr; } #endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) QIcon Qt5UKUIPlatformTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const { //FIXME: return QPlatformTheme::fileIcon(fileInfo, iconOptions); } #endif #ifdef GLOBAL_MENU QPlatformMenuBar *Qt5UKUIPlatformTheme::createPlatformMenuBar() const { return QPlatformTheme::createPlatformMenuBar(); } #endif #if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) QPlatformSystemTrayIcon *Qt5UKUIPlatformTheme::createPlatformSystemTrayIcon() const { // if (isDBusTrayAvailable()) // return new QDBusTrayIcon(); return nullptr; } #endif qt6-ukui-platformtheme/qt6-ukui-platformtheme/platform-theme-fontdata.cpp0000664000175000017500000001242015154306200025605 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "platform-theme-fontdata.h" #include #undef signals #undef slots #undef emit #include PlatformThemeFontData::PlatformThemeFontData() { } PlatformThemeFontData::~PlatformThemeFontData() { } bool PlatformThemeFontData::chooseFontFile(QString path) { QStringList list = path.split("."); QString fontTypeTTF = "ttf"; QString fontTypeOTF = "otf"; QString fontType = list.at(list.size()-1); if (fontType.compare(fontTypeTTF, Qt::CaseInsensitive) == 0) { return true; } else if (fontType.compare(fontTypeOTF, Qt::CaseInsensitive) == 0) { return true; } return false; } QMap PlatformThemeFontData::getAllFontInformation() { QMap fontMap; QList ret; ret.clear(); FT_Library ft_library; FT_Error err = FT_Init_FreeType(&ft_library); if (err != FT_Err_Ok) { qCritical() << "Error : LibFun , getAllFontInformation , init freetype fail"; return fontMap; } if (!FcInitReinitialize()) { qCritical() << "Error : LibFun , getAllFontInformation , init font list fail"; return fontMap; } FcConfig *config = FcInitLoadConfigAndFonts(); FcPattern *pat = FcPatternCreate(); FcObjectSet *os = FcObjectSetBuild(FC_FILE , FC_FAMILY , FC_STYLE , FC_INDEX , NULL); FcFontSet *fs = FcFontList(config , pat , os); qInfo() << "Info : LibFun , getAllFontInformation , total matching fonts is " << fs->nfont; for (int i = 0 ; i < fs->nfont && fs != NULL ; i++) { FontInformation item; FcChar8 *path = NULL; FcChar8 *family = NULL; // FcChar8 *style = NULL; int index; FcPattern *font = fs->fonts[i]; if (FcPatternGetString(font , FC_FILE , 0 , &path) == FcResultMatch && FcPatternGetString(font , FC_FAMILY , 0 , &family) == FcResultMatch && // FcPatternGetString(font , FC_STYLE , 0 , &style) == FcResultMatch && FcPatternGetInteger(font , FC_INDEX , 0 , &index) == FcResultMatch) { item.path = QString((char *)path); item.family = QString((char *)family); // item.style = QString((char *)style); } /* 对字体文件进行判断(判断后缀名是否为.ttf .otf)*/ if (!chooseFontFile(item.path)) { continue; } gchar *fontData = NULL; gsize fontDataLenth; g_autoptr(GError) error = NULL; GFile *fd = g_file_new_for_path((const gchar *)path); if (!g_file_load_contents(fd , NULL , &fontData , &fontDataLenth , NULL , &error)) { qWarning() << "Waring : LibFun , getAllFontInformation , load font file fail , Path is [ " << path << " ]" << " error is [ " << error->message << " ]"; ret << item; continue; } FT_Error ft_error; FT_Face ft_retval; ft_error = FT_New_Memory_Face(ft_library , (const FT_Byte *)fontData , (FT_Long)fontDataLenth , index , &ft_retval); if (ft_error != FT_Err_Ok) { qWarning() << "Waring : LibFun , getAllFontInformation , read font data fail , Path is [ " << path << " ]"; ret << item; continue; } /* ///名字 if (ft_retval->family_name) { item.name = QString((char *)ft_retval->family_name); } ///样式 if (ft_retval->style_name) { item.style = QString((char *)ft_retval->style_name); } ///路径 g_autofree gchar *location = NULL; location = g_file_get_path(fd); item.path = QString((char *)location); ///种类 g_autoptr(GFileInfo) fileInfo; fileInfo = g_file_query_info(fd , G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," G_FILE_ATTRIBUTE_STANDARD_SIZE , G_FILE_QUERY_INFO_NONE , NULL , NULL); if (fileInfo != NULL) { g_autofree gchar *fileType = g_content_type_get_description(g_file_info_get_content_type(fileInfo)); item.type = QString((char *)fileType); } qDebug() << "name:" << item.name << "style:" << item.style << "path:" << item.path << "family:" << item.family; */ ret << item; fontMap.insert(item.family, item.path); FT_Done_Face(ft_retval); g_object_unref(fd); g_free(fontData); } if (pat) { FcPatternDestroy(pat); } if (os) { FcObjectSetDestroy(os); } if (fs) { FcFontSetDestroy(fs); } return fontMap; } qt6-ukui-platformtheme/qt6-ukui-platformtheme/platform-theme-fontdata.h0000664000175000017500000000347015154306200025257 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef PLATFORMTHEMEFONTDATA_H #define PLATFORMTHEMEFONTDATA_H #include #include #include #include #include typedef struct _FontInformation { QString path; /* 路径 */ QString family; /* 系列 */ QString style; /* 样式 */ // QString name; /* 名称 */ // QString type; /* 种类 */ // QString version; /* 版本 */ // QString copyright; /* 版权 */ // QString manufacturer; /* 商标 */ // QString description; /* 描述 */ // QString designer; /* 设计师 */ // QString license; /* 许可证 */ } FontInformation; class PlatformThemeFontData : public QObject { Q_OBJECT public: PlatformThemeFontData(); ~PlatformThemeFontData(); public: QMap getAllFontInformation(); bool chooseFontFile(QString path); }; #endif // PLATFORMTHEMEFONTDATA_H qt6-ukui-platformtheme/translations/0000775000175000017500000000000015154306200016547 5ustar fengfengqt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_en_US.ts0000664000175000017500000003442715154306200024553 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close Close QApplication Executable '%1' requires Qt %2, found Qt %3. Executable '%1' requires Qt %2, found Qt %3. Incompatible Qt Library Error Incompatible Qt Library Error QDialogButtonBox OK OK QMessageBox Show Details... Show Details... Hide Details... Hide Details... QObject File Name File Name Modified Date Modified Date File Type File Type File Size File Size Original Path Original Path Descending Descending Ascending Ascending Use global sorting Use global sorting List View List View Icon View Icon View Close Close UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Let tab widget switch with a slide animation. UKUIFileDialog::KyFileDialogHelper Open File Open File Save File Save File All Files (*) All Files (*) UKUIFileDialog::KyNativeFileDialog Go Back Go Back Go Forward Go Forward Cd Up Cd Up Search Search View Type View Type Sort Type Sort Type Maximize Maximize Close Close Restore Restore Name Name Open Open Cancel Cancel Save as Save as New Folder New Folder Save Save Directories Directories Warning Warning exist, are you sure replace? exist, are you sure replace? NewFolder NewFolder Undo Undo Redo Redo warn warn This operation is not supported. This operation is not supported. qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_kk.ts0000664000175000017500000003670615154306200024151 0ustar fengfeng MainWindow MainWindow نەگٸزگٸ كوز بەك test open سېناقنى ٸشٸۋ directory باس مازمۇن selected uri تالدانعان uri test show سىناقتى كورسەتۋ test exec اتقار ورىنداۋدى ولشەۋ test save سىناقتى ساقتاۋ test static open تىنىش كۇيدە اشۋدٸ سىناۋ PushButton تالداۋ كىنوپكاسى use auto highlight icon اۆتوماتتى جارقىن كورسەتۋ سىن بەلگىسىن ٸستەتڭٸز ... ... highlightOnly تەك جوعارعى جارقتا كورسەتىلدى. bothDefaultAndHighlight كوڭىلدەگى ۋا ەرەكشە كورسەتۋ RadioButton تاق تالداۋ كىنوپكاسى style سلوب icon ئايكون menu opacity تاماق تىزىمدىگنىڭ تۇنىقتىق دارەجەسى جوق font ٴارىپ نۇسقاسى MessageBox Close تاقاۋ QApplication Executable '%1' requires Qt %2, found Qt %3. اتقار ىستەۋگە بولاتٸن حۇجات 1، مۇقتاجدىق ارگومەنتتٸ 2، ٸزدەپ تاپقان ارگومەنتتٸ 3 Incompatible Qt Library Error سىغىشمىغانQT قامبادا قاتەلىك كورىلدى QDialogButtonBox OK ماقۇل QMessageBox Show Details... ناقتى مازمۇنىن كورسەتۋ Hide Details... ناقتى مازمۇنىن جاسىرۋ QObject File Name حۇجات مى Modified Date وزگەرتىلگەن ۋاقىتى File Type حۇجات تۇرى File Size حۇجات ۇلكەندىگى Original Path وڭ جول Descending چوڭدىن كىچىككە قاراتىپ تىزۋ Ascending كىشىدەن ۇلكەنگە قاراتىپ تىزۋ Use global sorting ئومومىيلىق مەنەن تىزۋدى ٸستەتۋ List View تٸزٸمدٸك كورىنۋى Icon View پىشىن كورىنۋى Close تاقاۋ UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide الدىن بەكٸتٸلگەن slide Let tab widget switch with a slide animation. تالدانبا كارتونىن كشكەنە زاپشاستارىن پٸروبيكسيا كارتون فىلىمىگە سايكەستىرۋ UKUIFileDialog::KyFileDialogHelper Open File حۇجاتتى ٸشٸۋ Save File حۇجاتتى ساقتاۋ All Files (*) بارلٸق حۇجاتتار (*) UKUIFileDialog::KyNativeFileDialog Go Back قايتۋ Go Forward ىلگەرلەۋ Cd Up Cd نىڭ ٷستٸن Search ٸزدەۋ View Type كورىنۋ تيپى Sort Type رەتتەلگەن تيپ Maximize ۇلكەيتۋ Close تاقاۋ Restore قالپىنا كەلتىرىلگەن Name ەسىمى Open ٸشٸۋ Cancel كۇشىنەن قالدىرۋ Save as تەجەۋ New Folder جاڭا حۇجات قىسقىش Save ساقتاۋ Directories مازمۇندار Warning ەسكەرتۋ exist, are you sure replace? ساقتالعان، الماستٸرۋدٸ تۇراقتاستىراسىزبا؟ NewFolder جاڭا قاتتاعىش Undo ٸشٸۋ Redo قاتە-قاتە سىناۋ warn ەسكەرتۋ This operation is not supported. نۇ جوبالاۋدى قولدامايدى. qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_tr.ts0000664000175000017500000003511515154306200024162 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close QApplication Executable '%1' requires Qt %2, found Qt %3. Incompatible Qt Library Error QDialogButtonBox OK QMessageBox Show Details... Hide Details... QObject File Name Modified Date File Type File Size Original Path Descending Ascending Use global sorting List View Icon View Close UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Let tab widget switch with a slide animation. UKUIFileDialog::KyFileDialogHelper Open File Save File All Files (*) UKUIFileDialog::KyNativeFileDialog Go Back Go Forward Cd Up Search View Type Sort Type Maximize Close Restore Name Open Cancel Save as New Folder Save Directories Warning exist, are you sure replace? NewFolder Undo Redo warn This operation is not supported. qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_bo_CN.ts0000664000175000017500000004052315154306200024514 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close ཁ་རྒྱག་པ། QApplication Executable '%1' requires Qt %2, found Qt %3. ལག་བསྟར་བྱེད་ཆོག་པའི་'%1'ལ་Qt %2,Qt%3རྙེད་པ་རེད། Incompatible Qt Library Error ཕན་ཚུན་མཐུན་ཐབས་མེད་པའི་Qt དཔེ་མཛོད་ཁང་གི་ནོར་འཁྲུལ། QDialogButtonBox OK འགྲིགས། QMessageBox Show Details... ཞིབ་ཕྲའི་གནས་ཚུལ་གསལ་བཤད་བྱ་དགོས། Hide Details... གནས་ཚུལ་ཞིབ་ཕྲ་སྦས་སྐུང་བྱེད་ QObject File Name ཡིག་ཆའི་མིང་། Modified Date བཟོ་བཅོས་བརྒྱབ་པའི་དུས་ཚོད། File Type ཡིག་ཆའི་རིགས་གྲས། File Size ཡིག་ཆའི་ཆེ་ཆུང་། Original Path ཐོག་མའི་འགྲོ་ལམ། Descending མར་འབབ་པ། Ascending རིམ་པ་ཇེ་མང་དུ་འགྲོ་བཞིན། Use global sorting ཁྱོན་ཡོངས་ཀྱི་གོ་རིམ་བེད་སྤྱོད། List View མཐོང་རིས་རེའུ་མིག Icon View མཚོན་རྟགས་ལྟ་ཚུལ། Close ཁ་རྒྱག་པ། UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide ཁ་ཆད་བཞག་པའི་སྒྲོན་བརྙན Let tab widget switch with a slide animation. སྒྲོན་བརྙན་གྱི་འགུལ་རིས་ལ་བརྟེན་ནས་ཤོག་བྱང་ཆུང་ཆུང་བརྗེ་རེས་བྱེད་དུ་འཇུག་དགོས། UKUIFileDialog::KyFileDialogHelper Open File ཁ་ཕྱེ་བའི་ཡིག་ཆ། Save File ཡིག་ཆ་ཉར་ཚགས་བྱེད་པ། All Files (*) ཡིག་ཆ་ཡོད་ཚད་(*) UKUIFileDialog::KyNativeFileDialog Go Back ཕྱིར་ལོག Go Forward མདུན་སྐྱོད། Cd Up གོང་ཕྱོགས། Search འཚོལ་ཞིབ། View Type མཐོང་རིས་ཀྱི་རིགས། Sort Type གོ་རིམ་གྱི་རིགས། Maximize ཆེས་ཆེ་བསྒྱུར། Close ཁ་རྒྱག་པ། Restore སླར་གསོ་བྱེད་པ། Name ཡིག་ཆའི་མིང་། Open སྒོ་ཕྱེ་བ། Cancel ཕྱིར་འཐེན། Save as ཉར་ཚགས་གཞན། New Folder ཡིག་ཁུག་གསར་འཛུགས། Save གྲོན་ཆུང་བྱེད་དགོས། Directories དཀར་ཆག Warning ཐ་ཚིག་སྒྲོག་པ། exist, are you sure replace? གནས་ཡོད་པས། ཁྱོད་ཀྱིས་དངོས་གནས་ཚབ་བྱེད་ཐུབ་བམ། NewFolder དཀར་ཆག་གསར་བ། Undo ཁ་ཕྱིར་འཐེན་བྱ་དགོས། Redo ཡང་བསྐྱར་ལས། warn ཉེན་བརྡ་བཏང་བ། This operation is not supported. བཀོལ་སྤྱོད་འདི་ལ་རྒྱབ་སྐྱོར་མི་བྱེད། qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_cs.ts0000664000175000017500000003511515154306200024142 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close QApplication Executable '%1' requires Qt %2, found Qt %3. Incompatible Qt Library Error QDialogButtonBox OK QMessageBox Show Details... Hide Details... QObject File Name Modified Date File Type File Size Original Path Descending Ascending Use global sorting List View Icon View Close UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Let tab widget switch with a slide animation. UKUIFileDialog::KyFileDialogHelper Open File Save File All Files (*) UKUIFileDialog::KyNativeFileDialog Go Back Go Forward Cd Up Search View Type Sort Type Maximize Close Restore Name Open Cancel Save as New Folder Save Directories Warning exist, are you sure replace? NewFolder Undo Redo warn This operation is not supported. qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_HK.ts0000664000175000017500000003543715154306200024547 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close 關閉 QApplication Executable '%1' requires Qt %2, found Qt %3. 可執行檔「%1」 需要數量%2,找到數量%3。 Incompatible Qt Library Error 不相容的Qt庫錯誤 QDialogButtonBox OK 確認 QMessageBox Show Details... 顯示細節...... Hide Details... 隱藏細節...... QObject File Name 檔名稱 Modified Date 修改日期 File Type 檔案類型 File Size 檔大小 Original Path 原始路徑 Descending 降序 Ascending 升序 Use global sorting 使用全域排序 List View 清單檢視 Icon View 圖示檢視 Close 關閉 UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide 默認slide Let tab widget switch with a slide animation. 讓選項卡小部件切換為幻燈片動畫。 UKUIFileDialog::KyFileDialogHelper Open File 打開 Save File 保存 All Files (*) 所有(*) UKUIFileDialog::KyNativeFileDialog Go Back 後退 Go Forward 前進 Cd Up 向上 Search 搜索 View Type 視圖類型 Sort Type 排序類型 Maximize 最大化 Close 關閉 Restore 還原 Name 檔名 Open 打開 Cancel 取消 Save as 另存為 New Folder 新建資料夾 Save 保存 Directories 目錄 Warning 警告 exist, are you sure replace? 已存在,是否替換? NewFolder 新建資料夾 Undo 撤銷 Redo 重做 warn 警告 This operation is not supported. 不支援此操作。 qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_Hant.ts0000664000175000017500000004044715154306200025134 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close 關閉 QApplication Executable '%1' requires Qt %2, found Qt %3. 可執行檔「%1」 需要數量%2,找到數量%3。 Incompatible Qt Library Error 不相容的Qt庫錯誤 QDialogButtonBox OK 確認 QMessageBox Show Details... 顯示細節...... Hide Details... 隱藏細節...... QObject File Name 檔名稱 Modified Date 修改日期 File Type 檔案類型 File Size 檔大小 Original Path 原始路徑 Descending 降序 Ascending 升序 Use global sorting 使用全域排序 List View 清單檢視 Icon View 圖示檢視 Close 關閉 UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide 默認slide Let tab widget switch with a slide animation. 讓選項卡小部件切換為幻燈片動畫。 UKUIFileDialog::KyFileDialogHelper Open File 打開 Save File 保存 All Files (*) 所有(*) UKUIFileDialog::KyNativeFileDialog Go Back 後退 Go Forward 前進 Cd Up 向上 Search 搜索 View Type 視圖類型 Sort Type 排序類型 Maximize 最大化 Close 關閉 Restore 還原 Name 檔名 Open 打開 Cancel 取消 Save as 另存為 New Folder 新建資料夾 Save 保存 Directories 目錄 Warning 警告 exist, are you sure replace? 已存在,是否替換? NewFolder 新建資料夾 Undo 撤銷 Redo 重做 warn 警告 This operation is not supported. 不支援此操作。 qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_fa.ts0000664000175000017500000003511515154306200024123 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close QApplication Executable '%1' requires Qt %2, found Qt %3. Incompatible Qt Library Error QDialogButtonBox OK QMessageBox Show Details... Hide Details... QObject File Name Modified Date File Type File Size Original Path Descending Ascending Use global sorting List View Icon View Close UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Let tab widget switch with a slide animation. UKUIFileDialog::KyFileDialogHelper Open File Save File All Files (*) UKUIFileDialog::KyNativeFileDialog Go Back Go Forward Cd Up Search View Type Sort Type Maximize Close Restore Name Open Cancel Save as New Folder Save Directories Warning exist, are you sure replace? NewFolder Undo Redo warn This operation is not supported. qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_de.ts0000664000175000017500000003477515154306200024140 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close Schließen QApplication Executable '%1' requires Qt %2, found Qt %3. Die ausführbare Datei '%1' erfordert Qt %2, Qt %3 gefunden. Incompatible Qt Library Error Fehler in der inkompatiblen Qt-Bibliothek QDialogButtonBox OK OKAY QMessageBox Show Details... Details anzeigen... Hide Details... Details ausblenden... QObject File Name Dateiname Modified Date Änderungsdatum File Type Dateityp File Size Dateigröße Original Path Ursprünglicher Pfad Descending Absteigend Ascending Aufsteigend Use global sorting Globale Sortierung verwenden List View Listenansicht Icon View Icon-Ansicht Close Schließen UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Standard-Folie Let tab widget switch with a slide animation. Lassen Sie das Tab-Widget mit einer Folienanimation wechseln. UKUIFileDialog::KyFileDialogHelper Open File Offene Linie Save File Datei speichern All Files (*) Alle Dateien (*) UKUIFileDialog::KyNativeFileDialog Go Back Zurück Go Forward Vorwärts gehen Cd Up Cd nach oben Search Suchen View Type Typ der Ansicht Sort Type Art der Sortierung Maximize Maximieren Close Schließen Restore Wiederherstellen Name Name Open Offen Cancel Abbrechen Save as Speichern unter New Folder Neuer Ordner Save Retten Directories Verzeichnisse Warning Warnung exist, are you sure replace? existieren, sind Sie sicher, ersetzen? NewFolder Neuer Ordner Undo Aufmachen Redo Noch einmal machen warn warnen This operation is not supported. Dieser Vorgang wird nicht unterstützt. qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_mn.ts0000664000175000017500000003733015154306200024150 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close ᠬᠠᠭᠠᠬᠤ QApplication Executable '%1' requires Qt %2, found Qt %3. ᠭᠦᠢᠴᠡᠳᠬᠡᠵᠦ ᠪᠣᠯᠬᠤ ᠹᠠᠢᠯ '%1' Qt% 2 ᠬᠡᠷᠡᠭᠰᠡᠵᠦ ᠂ Qt% 3 ᠢ᠋/ ᠵᠢ ᠡᠷᠢᠵᠦ ᠣᠯᠬᠤ ᠬᠡᠷᠡᠭᠲᠡᠶ . Incompatible Qt Library Error QDialogButtonBox OK OK QMessageBox Show Details... Hide Details... QObject File Name ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠨᠡᠷᠡᠢᠳᠦᠯ Modified Date ᠵᠠᠰᠠᠭᠰᠠᠨ ᠡᠳᠦᠷ ᠰᠠᠷ᠎ᠠ File Type ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ File Size ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠶᠡᠬᠡ ᠪᠠᠭ᠎ᠠ Original Path ᠤᠭ ᠤ᠋ᠨ ᠵᠠᠮ ᠱᠤᠭᠤᠮ Descending ᠪᠠᠭᠠᠰᠬᠠᠬᠤ Ascending ᠶᠡᠬᠡᠰᠬᠡᠬᠦ Use global sorting ᠪᠦᠬᠦ ᠪᠠᠢᠳᠠᠯ ᠤ᠋ᠨ ᠳᠠᠷᠠᠭᠠᠯᠠᠯ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ List View ᠵᠢᠭᠰᠠᠭᠠᠯᠳᠠ ᠵᠢᠨ ᠬᠠᠷᠠᠭᠠᠨ ᠵᠢᠷᠤᠭ Icon View ᠰᠢᠪᠠᠭ᠎ᠠ ᠵᠢᠨ ᠬᠠᠷᠠᠭᠠᠨ ᠵᠢᠷᠤᠭ Close ᠬᠠᠭᠠᠬᠤ UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Default Slide Let tab widget switch with a slide animation. UKUIFileDialog::KyFileDialogHelper Open File ᠨᠡᠬᠡᠬᠡᠬᠦ Save File ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ All Files (*) ᠪᠦᠬᠦᠢᠯᠡ (*) UKUIFileDialog::KyNativeFileDialog Go Back ᠤᠬᠤᠷᠢᠬᠤ Go Forward ᠤᠷᠤᠭᠰᠢᠯᠠᠬᠤ Cd Up ᠳᠡᠭᠡᠭᠰᠢ Search ᠬᠠᠢᠯᠳᠠ View Type ᠬᠠᠷᠠᠭᠠᠨ ᠵᠢᠷᠤᠭ ᠤ᠋ᠨ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ Sort Type ᠳᠠᠷᠠᠭᠠᠯᠠᠯ ᠤ᠋ᠨ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ Maximize ᠬᠠᠮᠤᠭ ᠤ᠋ᠨ ᠶᠡᠬᠡᠴᠢᠯᠡᠯ Close ᠬᠠᠭᠠᠬᠤ Restore ᠡᠬᠡᠬᠦᠯᠬᠦ Name ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠨᠡᠷ᠎ᠡ Open ᠨᠡᠬᠡᠬᠡᠬᠦ Cancel ᠦᠬᠡᠢᠰᠭᠡᠬᠦ᠌ Save as ᠦᠭᠡᠷ᠎ᠡ ᠭᠠᠵᠠᠷ ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ New Folder ᠰᠢᠨ᠎ᠡ ᠪᠡᠷ ᠪᠠᠢᠭᠤᠯᠤᠭᠰᠠᠨ ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠬᠠᠪᠳᠠᠰᠤ Save ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ Directories ᠭᠠᠷᠴᠠᠭ Warning ᠰᠡᠷᠡᠮᠵᠢᠯᠡᠬᠦᠯᠦᠯ exist, are you sure replace? ᠪᠠᠢᠨ᠎ᠠ᠂ ᠰᠤᠯᠢᠬᠤ ᠤᠤ? NewFolder ᠰᠢᠨ᠎ᠡ ᠪᠡᠷ ᠪᠠᠢᠭᠤᠯᠤᠭᠰᠠᠨ ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠬᠠᠪᠳᠠᠰᠤ Undo ᠬᠦᠴᠦᠨ ᠦᠬᠡᠢ ᠪᠤᠯᠭᠠᠬᠤ Redo ᠳᠠᠬᠢᠵᠤ ᠬᠢᠬᠦ warn ᠰᠡᠷᠡᠮᠵᠢᠯᠡᠬᠦᠯᠬᠦ This operation is not supported. ᠳᠤᠰ ᠠᠵᠢᠯᠯᠠᠬᠤᠢ ᠵᠢ ᠳᠡᠮᠵᠢᠬᠦ ᠦᠬᠡᠢ. qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_ug.ts0000664000175000017500000003700215154306200024145 0ustar fengfeng MainWindow MainWindow MainWindow test open سېناقنى ئېچىش directory مۇندەرىجە selected uri تاللانغان uri test show سىناقنى كۆرسىتىش test exec ئىجرا قىلغۇچنى ئۆلچەش test save سىناقنى ساقلاش test static open تىنچ ھالەتتە ئېچىشنى سىناش PushButton PushButton use auto highlight icon ئاپتوماتىك يارقىن كۆرسىتىش سىنبەلگىسىنى ئىشلىتىڭ ... ... highlightOnly پەقەت يۇقىرى يورۇقلۇقتا كۆرسىتىلىدۇ. bothDefaultAndHighlight كۆڭۈلدىكى ۋە گەۋدىلىك كۆرسىتىش RadioButton تاق تاللاش كۇنۇپكىسى style ئۇسلۇب icon ئايكون menu opacity تاماق تىزىملىكىنىڭ سۈزۈكلۈك دەرىجىسى يوق font خەت نۇسخىسى MessageBox Close تاقاش QApplication Executable '%1' requires Qt %2, found Qt %3. ئىجرا قىلىشقا بولىدىغان ھۆججەت 1، ئىھتىياجلىق سان 2، ئىزدەپ تاپقان سان 3 Incompatible Qt Library Error سىغىشمىغانQT ئامبىرىدا خاتالىق كۆرۈلدى QDialogButtonBox OK ماقۇل QMessageBox Show Details... تەپسىلاتىنى كۆرسىتىش Hide Details... تەپسىلاتىنى يوشۇرۇش QObject File Name ھۆججەت نامى Modified Date ئۆزگەرتىلگەن ۋاقتى File Type ھۆججەت تۈرى File Size ھۆججەت چوڭلۇقى Original Path ئەسلى يول Descending چوڭدىن كىچىككە قارىتىپ تىزىش Ascending كىچىكتىن چوڭغا قارىتىپ تىزىش Use global sorting ئومومىيلىق بىلەن تىزىشنى ئىشلىتىش List View تىزىملىك كۆرۈنۈشى Icon View شەكىل كۆرۈنۈشى Close تاقاش UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide ئالدىن بىكىتىلگەن slide Let tab widget switch with a slide animation. تاللانما كارتىدىكى كىچىك زاپچاسلارنى پرويېكسىيە كارتون فىلىمىگە ئالماشتۇرۇش UKUIFileDialog::KyFileDialogHelper Open File ھۆججەتنى ئېچىش Save File ھۆججەتنى ساقلاش All Files (*) بارلىق ھۆججەتلەر (*) UKUIFileDialog::KyNativeFileDialog Go Back قايت Go Forward ئالدىغا ماڭ Cd Up Cd نىڭ ئۈستى Search ئىزدە View Type كۆرۈنۈش تىپى Sort Type رەتلەنگەن تىپ Maximize چوڭايتىش Close تاقاش Restore ئەسلىگە كەلتۈرۈش Name ئىسىم-فامىلىسى Open ئېچىش Cancel ئەمەلدىن قالدۇرۇش Save as تېجەش New Folder يېڭى ھۆججەت قىسقۇچ Save ساقلاش Directories مۇندەرىجىلەر Warning ئاگاھلاندۇرۇش exist, are you sure replace? مەۋجۇت، ئالماشتۇرۇشنى جەزىملەشتۈرەلەمسىز؟ NewFolder يېڭى قاتلىغۇچ Undo Undo Redo قايتا-قايتا warn ئاگاھلاندۇرۇش This operation is not supported. بۇ مەشغۇلاتنى قوللىمايدۇ. qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_fr.ts0000664000175000017500000003511015154306200024137 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close Fermer QApplication Executable '%1' requires Qt %2, found Qt %3. L’exécutable '%1' nécessite Qt %2, trouvé Qt %3. Incompatible Qt Library Error Erreur de bibliothèque Qt incompatible QDialogButtonBox OK D’ACCORD QMessageBox Show Details... Afficher les détails... Hide Details... Masquer les détails... QObject File Name Nom du fichier Modified Date Date de modification File Type Type de fichier File Size Taille du fichier Original Path Chemin d’accès d’origine Descending Descendant Ascending Ascendant Use global sorting Utiliser le tri global List View Affichage en liste Icon View Affichage de l’icône Close Fermer UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Diapositive par défaut Let tab widget switch with a slide animation. Laissez le widget d’onglet basculer avec une animation de diapositive. UKUIFileDialog::KyFileDialogHelper Open File Ouvrir un fichier Save File Enregistrer le fichier All Files (*) Tous les fichiers (*) UKUIFileDialog::KyNativeFileDialog Go Back Retour Go Forward Avancer Cd Up Cd Up Search Rechercher View Type Type de vue Sort Type Type de tri Maximize Maximiser Close Fermer Restore Restaurer Name Nom Open Ouvrir Cancel Annuler Save as Enregistrer sous New Folder Nouveau dossier Save Sauvegarder Directories Téléphonique Warning Avertissement exist, are you sure replace? exister, êtes-vous sûr de remplacer ? NewFolder NouveauDossier Undo Défaire Redo Refaire warn avertir This operation is not supported. Cette opération n’est pas prise en charge. qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_es.ts0000664000175000017500000003511215154306200024141 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close QApplication Executable '%1' requires Qt %2, found Qt %3. Incompatible Qt Library Error QDialogButtonBox OK QMessageBox Show Details... Hide Details... QObject File Name Modified Date File Type File Size Original Path Descending Ascending Use global sorting List View Icon View Close UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide Let tab widget switch with a slide animation. UKUIFileDialog::KyFileDialogHelper Open File Save File All Files (*) UKUIFileDialog::KyNativeFileDialog Go Back Go Forward Cd Up Search View Type Sort Type Maximize Close Restore Name Open Cancel Save as New Folder Save Directories Warning exist, are you sure replace? NewFolder Undo Redo warn This operation is not supported. qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_CN.ts0000664000175000017500000003450015154306200024533 0ustar fengfeng MainWindow MainWindow test open directory selected uri test show test exec test save test static open PushButton use auto highlight icon ... highlightOnly bothDefaultAndHighlight RadioButton style icon menu opacity font MessageBox Close 关闭 QApplication Executable '%1' requires Qt %2, found Qt %3. 可执行文件“%1”需要数量%2,找到数量%3。 Incompatible Qt Library Error 不兼容的Qt库错误 QDialogButtonBox OK 确认 QMessageBox Show Details... 显示细节…… Hide Details... 隐藏细节…… QObject File Name 文件名称 Modified Date 修改日期 File Type 文件类型 File Size 文件大小 Original Path 原始路径 Descending 降序 Ascending 升序 Use global sorting 使用全局排序 List View 列表视图 Icon View 图标视图 Close 关闭 UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide 默认slide Let tab widget switch with a slide animation. 让选项卡小部件切换为幻灯片动画。 UKUIFileDialog::KyFileDialogHelper Open File 打开 Save File 保存 All Files (*) 所有(*) UKUIFileDialog::KyNativeFileDialog Go Back 后退 Go Forward 前进 Cd Up 向上 Search 搜索 View Type 视图类型 Sort Type 排序类型 Maximize 最大化 Close 关闭 Restore 还原 Name 文件名 Open 打开 Cancel 取消 Save as 另存为 New Folder 新建文件夹 Save 保存 Directories 目录 Warning 警告 exist, are you sure replace? 已存在,是否替换? NewFolder 新建文件夹 Undo 撤销 Redo 重做 warn 警告 This operation is not supported. 不支持此操作。 qt6-ukui-platformtheme/translations/qt5-ukui-platformtheme_ky.ts0000664000175000017500000003706715154306200024170 0ustar fengfeng MainWindow MainWindow نەگىزگى كۅزۅنۅك test open سېناقنى اچۇۇ directory تىزىمدىك selected uri تاندالعان uri test show سىناقتى كۅرسۅتۉۉ test exec اتقارماق قىلۇۇچۇنۇ ۅلچۅ test save سىناقتى ساقتوو test static open تىنچ ، تىم تىرس ابالدا اچۇۇنۇ سىنوو PushButton تانداش كونۇپكاسى use auto highlight icon اپتوماتتىك يارقىن كۅرسۅتۉۉ سىن بەلگىسىن ىشتەتىڭ ... ... highlightOnly جالاڭ عانا جوعورۇ يورۇقلۇقتا كۅرسۅتۉلۅت . bothDefaultAndHighlight ويۇنداقى جانا ورقويۇپ چىعۇۇ كۅرسۅتۉۉ RadioButton تاق تانداش كونۇپكاسى style ۇسلۇپ icon ايكون menu opacity تاماق ، اش تىزىمدىگىنىن تۇنۇقتۇق داراجاسى جوق font قات ۉلگۉسۉ MessageBox Close بەكىتىش QApplication Executable '%1' requires Qt %2, found Qt %3. اتقارماق جاسووعو بولوتۇرعان ۅجۅت 1، كەرەكتۉۉ سان 2، ىزدەپ تاپقان سان 3 Incompatible Qt Library Error سىغىشمىغانQT قامپادا قاتاالىق كۅرۉلدۉ QDialogButtonBox OK ماقۇل QMessageBox Show Details... جۅن جايىن كۅرسۅتۉۉ Hide Details... جۅن جايىن جاشىرۇۇ QObject File Name ۅجۅت ناامى Modified Date ۅزگۅرتۉلگۅن ۇباقتى File Type ۅجۅت تۉرۉ File Size ۅجۅت چوڭدۇعۇ Original Path العاچى جول Descending چوڭدىن كىچىككە قاراتىپ تىزۉۉ Ascending كىچىكتەن چوڭعو قاراتىپ تىزۉۉ Use global sorting ئومومىيلىق مەنەن تىزۉۉنۉ ىشتەتىش List View تىزىمدىك گۅرۉنۉشۉ Icon View تۉر گۅرۉنۉشۉ Close بەكىتىش UKUI::TabWidget::DefaultSlideAnimatorFactory Default Slide الدىن بەكىتىلگەن slide Let tab widget switch with a slide animation. تاندالما كارتاداقى كىچىك شايمانداردى پرويەكسىيە كارتون فىلىمىگە الماشتىرۇۇ UKUIFileDialog::KyFileDialogHelper Open File ۅجۅتۉن اچۇۇ Save File ۅجۅتۉن ساقتوو All Files (*) باردىق ۅجۅتتۅر (*) UKUIFileDialog::KyNativeFileDialog Go Back قايتۇۇ Go Forward ىلگەرلۅۅ Cd Up Cd نىڭ ۉستۉ Search ىزدۅۅ View Type كۅرۉنۉش تۉرۉ Sort Type ىرەتتەلگەن تىپ Maximize چوڭويتۇش Close بەكىتىش Restore العاچىنا كەلتىرۉۉ Name اتى Open اچۇۇ Cancel ارعادان قالتىرىش Save as تەجۅۅ New Folder جاڭى ۅجۅت قىپچىعىچ Save ساقتوو Directories مازمۇۇندار Warning ەسكەرتۉۉ exist, are you sure replace? باربولۇۇسۇ ، الماشتىرۇۇنۇ تۇراقتاندىرا الاسىزبى؟ NewFolder جاڭى قاتتاعىچ Undo اچۇۇ Redo قايرا-قايرا سىنوو warn ەسكەرتۉۉ This operation is not supported. بۇل ماشقۇلدانۇۇنۇ قولدوبويت. qt6-ukui-platformtheme/README.md0000664000175000017500000000361315154306200015310 0ustar fengfeng# qt5-ukui-platformtheme The UKUI platform theme for qt5 QPA. ## Wiki on Gitee [Wiki](https://gitee.com/openkylin/qt5-ukui-platformtheme/wikis/Home) # Introduction [zh_CN](https://gitee.com/openkylin/qt5-ukui-platformtheme/wikis/%E9%A1%B9%E7%9B%AE%E7%AE%80%E4%BB%8B) [安装和测试](https://gitee.com/openkylin/qt5-ukui-platformtheme/wikis/%E5%AE%89%E8%A3%85%26%E6%B5%8B%E8%AF%95%E6%B5%81%E7%A8%8B) ## Document See [doxygen/README.md](doxygen/README.md). ## Description In the early development of the UKUI 3.0, we used qt5-gtk2-platformtheme to ensure the unity of the UKUI desktop style. However, it has many limitations for our new desgin. This project is intend to provide a common resolution of desktop application development with qt5 in UKUI3.0. We hope provide a platform theme to unify and beautify all qt applications according to the design of UKUI3.0, not only our own applications. We are also committed to building our applications that can adapt to different styles. This project is first step to archive those objectives. qt5-ukui-platformtheme's route brings us closer to the upstream communities. It is not a division, but a desire for fusion and individuality in a compatible way. ## Build and Test ### Build Depends (reference debian/contorl) - pkg-config - qt5-default - qtbase5-private-dev - libkf5windowsystem-dev - libgsettings-qt-dev - libglib2.0-dev ### Testing To test the project, you should first install it into system and make sure that the current qpa platform is ukui. You can export the QT_QPA_PLATFORMTHEME in terminal. > export QT_QPA_PLATFORMTHEME=ukui One more important job, > sudo glib-compile-schemas /usr/share/glib-2.0/schemas That will let the gsettings used by qt5-ukui-platformtheme worked. Then you can run the test in project, or run any qt5 program for testing with ukui platformtheme. ### ToDoList - change style's details through configuration file - animations qt6-ukui-platformtheme/ukui-qml-style-helper/0000775000175000017500000000000015154306200020205 5ustar fengfengqt6-ukui-platformtheme/ukui-qml-style-helper/KyIcon.h0000664000175000017500000000705215154306200021556 0ustar fengfeng/* * 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 . * * Authors: Yan Wang * */ #ifndef KYICON_H #define KYICON_H #include #include #include #include #include "styleparameter/imageprovider.h" class QStyle; class KyIcon : public QQuickPaintedItem { Q_OBJECT Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged) Q_PROPERTY(QIcon icon READ icon WRITE setIcon) Q_PROPERTY( bool hover READ hover WRITE setHover NOTIFY hoverChanged) Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectedChanged) Q_PROPERTY( bool hasFocus READ hasFocus WRITE sethasFocus NOTIFY hasFocusChanged) Q_PROPERTY( bool active READ active WRITE setActive NOTIFY activeChanged) Q_PROPERTY( bool sunken READ sunken WRITE setSunken NOTIFY sunkenChanged) Q_PROPERTY( bool on READ on WRITE setOn NOTIFY onChanged) Q_PROPERTY( QString icontype READ icontype WRITE seticontype NOTIFY icontypeChanged) public: KyIcon(QQuickPaintedItem *parent = nullptr); QIcon icon() { return m_icon; } void setIcon(const QIcon &icon); QString iconName(){ return m_iconName; } void setIconName(const QString &iconName); bool hover() const { return m_hover; } void setHover(bool hover) { if (m_hover != hover) {m_hover = hover ; emit hoverChanged();}} bool selected() const { return m_selected; } void setSelected(bool selected) { if (m_selected!= selected) { m_selected = selected; emit selectedChanged(); } } bool hasFocus() const { return m_focus; } void sethasFocus(bool focus) { if (m_focus != focus) {m_focus = focus; emit hasFocusChanged();}} bool active() const { return m_active; } void setActive(bool active) { if (m_active!= active) {m_active = active; emit activeChanged();}} bool sunken() const { return m_sunken; } void setSunken(bool sunken) { if (m_sunken != sunken) {m_sunken = sunken; emit sunkenChanged();}} bool on() const { return m_on; } void setOn(bool on) { if (m_on != on) {m_on = on ; emit onChanged();}} QString icontype() const { return m_icontype;} void seticontype(QString icontype) { m_icontype = icontype ; emit icontypeChanged(); } void paint(QPainter *painter); static QStyle *style(); public Q_SLOTS: void updateItem(){update();} Q_SIGNALS: void hoverChanged(); void selectedChanged(); void hasFocusChanged(); void activeChanged(); void sunkenChanged(); void onChanged(); void icontypeChanged(); void iconNameChanged(); protected: bool m_hover; bool m_selected; bool m_focus; bool m_active; bool m_sunken; bool m_on; QString m_icontype; private: QIcon m_icon; QString m_iconName; UKUIQQC2Style::IconHelper m_iconHelper; }; #endif // KYICON_H qt6-ukui-platformtheme/ukui-qml-style-helper/kystylehelper.cpp0000664000175000017500000000320715154306200023617 0ustar fengfeng/* * 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 . * * Authors: Yan Wang * */ #include "kystylehelper.h" #include #include #include KyStyleHelper::KyStyleHelper(QQuickItem *parent) : QQuickItem(parent) { if (QGSettings::isSchemaInstalled("org.ukui.style")) { QGSettings* styleSettings = new QGSettings("org.ukui.style", QByteArray(), this); connect(styleSettings, &QGSettings::changed, this, [&](const QString &key){ if (key == "styleName" || key == "themeColor") { emit paletteChanged(); emit qcolorChanged(); } if (key == "systemFontSize" || key == "systemFont") { emit fontChanged(); } }); } } KyStyleHelper::~KyStyleHelper() {} KyStyleHelper* KyStyleHelper::qmlAttachedProperties(QObject *parent) { auto p = qobject_cast(parent); return new KyStyleHelper(p); } qt6-ukui-platformtheme/ukui-qml-style-helper/qmldir0000664000175000017500000000007715154306200021424 0ustar fengfengmodule org.ukui.qqc2style.private plugin ukui-qml-style-helper qt6-ukui-platformtheme/ukui-qml-style-helper/kyquickstyleitem.cpp0000664000175000017500000022702315154306200024337 0ustar fengfeng/* * 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 . * * Authors: Yan Wang * */ #include "kyquickstyleitem.h" #include #include #include #include #include #include #include #include #include //#include //#include #include #include QStyle *KyQuickStyleItem::s_style = nullptr; QStyle *KyQuickStyleItem::style() { auto style = qApp->style(); return style ? style : s_style; } KyQuickStyleItem::KyQuickStyleItem(QQuickItem *parent) : QQuickItem(parent), m_styleoption(nullptr), m_itemType(Undefined), m_sunken(false), m_raised(false), m_active(true), m_selected(false), m_focus(false), m_hover(false), m_on(false), m_horizontal(true), m_transient(false), m_sharedWidget(false), m_minimum(0), m_maximum(100), m_value(0), m_step(0), m_paintMargins(0), m_contentWidth(0), m_contentHeight(0), m_textureWidth(0), m_textureHeight(0), m_lastFocusReason(Qt::NoFocusReason) { // There is no styleChanged signal and QApplication sends QEvent::StyleChange only to all QWidgets if (qApp->style()) { connect(qApp->style(), &QObject::destroyed, this, &KyQuickStyleItem::styleChanged); } else { // KSharedConfig::Ptr kdeglobals = KSharedConfig::openConfig(); // KConfigGroup cg(kdeglobals, "KDE"); // auto style = s_style; // s_style = QStyleFactory::create(cg.readEntry("widgetStyle", QStringLiteral("Fusion"))); // if (style) { // delete style; // } } if (QGSettings::isSchemaInstalled("org.ukui.style")) { QGSettings* styleSettings = new QGSettings("org.ukui.style", QByteArray(), this); connect(styleSettings, &QGSettings::changed, this, [&](const QString &key){ if (key == "systemFontSize" || key == "systemFont") { emit fontChanged(); updatePolish(); } if (key == "iconThemeName"){ polish(); } }); } m_font = qApp->font(); setFlag(QQuickItem::ItemHasContents, true); setSmooth(false); connect(this, &KyQuickStyleItem::visibleChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::widthChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::heightChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::enabledChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::infoChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::onChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::selectedChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::activeChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::textChanged, this, &KyQuickStyleItem::updateSizeHint); connect(this, &KyQuickStyleItem::textChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::activeChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::raisedChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::sunkenChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::hoverChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::maximumChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::minimumChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::valueChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::horizontalChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::transientChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::activeControlChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::hasFocusChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::activeControlChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::hintChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::propertiesChanged, this, &KyQuickStyleItem::updateSizeHint); connect(this, &KyQuickStyleItem::propertiesChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::elementTypeChanged, this, &KyQuickStyleItem::updateItem); connect(this, &KyQuickStyleItem::contentWidthChanged, this, &KyQuickStyleItem::updateSizeHint); connect(this, &KyQuickStyleItem::contentHeightChanged, this, &KyQuickStyleItem::updateSizeHint); connect(this, &KyQuickStyleItem::widthChanged, this, &KyQuickStyleItem::updateRect); connect(this, &KyQuickStyleItem::heightChanged, this, &KyQuickStyleItem::updateRect); connect(this, &KyQuickStyleItem::heightChanged, this, &KyQuickStyleItem::updateBaselineOffset); connect(this, &KyQuickStyleItem::contentHeightChanged, this, &KyQuickStyleItem::updateBaselineOffset); connect(qApp, &QApplication::fontChanged, this, &KyQuickStyleItem::updateSizeHint, Qt::QueuedConnection); } KyQuickStyleItem::~KyQuickStyleItem() { if (const QStyleOptionButton *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionViewItem *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionHeader *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionToolButton *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionToolBar *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionTab *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionFrame *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionFocusRect *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionTabWidgetFrame *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionMenuItem *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionComboBox *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionSpinBox *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionSlider *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionProgressBar *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionGroupBox *aux = qstyleoption_cast(m_styleoption)) delete aux; else delete m_styleoption; m_styleoption = nullptr; } void KyQuickStyleItem::initStyleOption() { if (m_styleoption) m_styleoption->state = {}; QString sizeHint = m_hints.value(QStringLiteral("size")).toString(); bool needsResolvePalette = true; update(); switch (m_itemType) { case Button: { if (!m_styleoption) m_styleoption = new QStyleOptionButton(); QStyleOptionButton *opt = qstyleoption_cast(m_styleoption); opt->text = text(); const QVariant icon = m_properties[QStringLiteral("icon")]; if (icon.canConvert()) { opt->icon = icon.value(); } else if (icon.canConvert() && icon.value().isLocalFile()) { opt->icon = QIcon(icon.value().toLocalFile()); } else if (icon.canConvert()) { opt->icon = QIcon::fromTheme(icon.value()); } auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); if (iconSize.isEmpty()) { int e = KyQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); if (iconSize.width() <= 0) { iconSize.setWidth(e); } if (iconSize.height() <= 0) { iconSize.setHeight(e); } } opt->iconSize = iconSize; opt->features = activeControl() == QLatin1String("default") ? QStyleOptionButton::DefaultButton : QStyleOptionButton::None; if (m_properties[QStringLiteral("flat")].toBool()) { opt->features |= QStyleOptionButton::Flat; } const QFont font = qApp->font("QPushButton"); opt->fontMetrics = QFontMetrics(font); QObject * menu = m_properties[QStringLiteral("menu")].value(); if (menu) { opt->features |= QStyleOptionButton::HasMenu; } } break; case ItemRow: { if (!m_styleoption) m_styleoption = new QStyleOptionViewItem(); QStyleOptionViewItem *opt = qstyleoption_cast(m_styleoption); opt->features = {}; if (activeControl() == QLatin1String("alternate")) opt->features |= QStyleOptionViewItem::Alternate; } break; case Splitter: { if (!m_styleoption) { m_styleoption = new QStyleOption; } } break; case Item: { if (!m_styleoption) { m_styleoption = new QStyleOptionViewItem(); } QStyleOptionViewItem *opt = qstyleoption_cast(m_styleoption); opt->features = QStyleOptionViewItem::HasDisplay; opt->text = text(); opt->textElideMode = Qt::ElideRight; opt->displayAlignment = Qt::AlignLeft | Qt::AlignVCenter; opt->decorationAlignment = Qt::AlignCenter; resolvePalette(); needsResolvePalette = false; QPalette pal = m_styleoption->palette; pal.setBrush(QPalette::Base, Qt::NoBrush); m_styleoption->palette = pal; const QFont font = qApp->font("QAbstractItemView"); opt->font = font; opt->fontMetrics = QFontMetrics(font); break; } case ItemBranchIndicator: { if (!m_styleoption) m_styleoption = new QStyleOption; m_styleoption->state = QStyle::State_Item; // We don't want to fully support Win 95 if (m_properties.value(QStringLiteral("hasChildren")).toBool()) m_styleoption->state |= QStyle::State_Children; if (m_properties.value(QStringLiteral("hasSibling")).toBool()) // Even this one could go away m_styleoption->state |= QStyle::State_Sibling; if (m_on) m_styleoption->state |= QStyle::State_Open; } break; case Header: { if (!m_styleoption) m_styleoption = new QStyleOptionHeader(); QStyleOptionHeader *opt = qstyleoption_cast(m_styleoption); opt->text = text(); opt->textAlignment = static_cast(m_properties.value(QStringLiteral("textalignment")).toInt()); opt->sortIndicator = activeControl() == QLatin1String("down") ? QStyleOptionHeader::SortDown : activeControl() == QLatin1String("up") ? QStyleOptionHeader::SortUp : QStyleOptionHeader::None; QString headerpos = m_properties.value(QStringLiteral("headerpos")).toString(); if (headerpos == QLatin1String("beginning")) opt->position = QStyleOptionHeader::Beginning; else if (headerpos == QLatin1String("end")) opt->position = QStyleOptionHeader::End; else if (headerpos == QLatin1String("only")) opt->position = QStyleOptionHeader::OnlyOneSection; else opt->position = QStyleOptionHeader::Middle; const QFont font = qApp->font("QHeaderView"); opt->fontMetrics = QFontMetrics(font); } break; case ToolButton: { if (!m_styleoption) m_styleoption = new QStyleOptionToolButton(); QStyleOptionToolButton *opt = qstyleoption_cast(m_styleoption); opt->subControls = QStyle::SC_ToolButton; opt->state |= QStyle::State_AutoRaise; opt->activeSubControls = QStyle::SC_ToolButton; opt->text = text(); const QVariant icon = m_properties[QStringLiteral("icon")]; if (icon.canConvert()) { opt->icon = icon.value(); } else if (icon.canConvert() && icon.value().isLocalFile()) { opt->icon = QIcon(icon.value().toLocalFile()); } else if (icon.canConvert()) { opt->icon = QIcon::fromTheme(icon.value()); } auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); if (iconSize.isEmpty()) { int e = KyQuickStyleItem::style()->pixelMetric(QStyle::PM_ToolBarIconSize, m_styleoption, nullptr); if (iconSize.width() <= 0) { iconSize.setWidth(e); } if (iconSize.height() <= 0) { iconSize.setHeight(e); } } opt->iconSize = iconSize; if (m_properties.value(QStringLiteral("menu")).toBool()) { opt->subControls |= QStyle::SC_ToolButtonMenu; opt->features = QStyleOptionToolButton::HasMenu; } const int toolButtonStyle = m_properties.value(QStringLiteral("toolButtonStyle")).toInt(); switch (toolButtonStyle) { case Qt::ToolButtonIconOnly: case Qt::ToolButtonTextOnly: case Qt::ToolButtonTextBesideIcon: case Qt::ToolButtonTextUnderIcon: case Qt::ToolButtonFollowStyle: opt->toolButtonStyle = (Qt::ToolButtonStyle)toolButtonStyle; break; default: opt->toolButtonStyle = Qt::ToolButtonFollowStyle; } const QFont font = qApp->font("QToolButton"); opt->font = font; opt->fontMetrics = QFontMetrics(font); } break; case ToolBar: { if (!m_styleoption) m_styleoption = new QStyleOptionToolBar(); } break; case Tab: { if (!m_styleoption) m_styleoption = new QStyleOptionTab(); QStyleOptionTab *opt = qstyleoption_cast(m_styleoption); opt->text = text(); const QVariant icon = m_properties[QStringLiteral("icon")]; if (icon.canConvert()) { opt->icon = icon.value(); } else if (icon.canConvert() && icon.value().isLocalFile()) { opt->icon = QIcon(icon.value().toLocalFile()); } else if (icon.canConvert()) { opt->icon = QIcon::fromTheme(icon.value()); } auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); if (iconSize.isEmpty()) { int e = KyQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); if (iconSize.width() <= 0) { iconSize.setWidth(e); } if (iconSize.height() <= 0) { iconSize.setHeight(e); } } opt->iconSize = iconSize; if (m_properties.value(QStringLiteral("hasFrame")).toBool()) opt->features |= QStyleOptionTab::HasFrame; QString orientation = m_properties.value(QStringLiteral("orientation")).toString(); QString position = m_properties.value(QStringLiteral("tabpos")).toString(); QString selectedPosition = m_properties.value(QStringLiteral("selectedpos")).toString(); opt->shape = orientation == QLatin1String("Bottom") ? QTabBar::RoundedSouth : QTabBar::RoundedNorth; if (position == QLatin1String("beginning")) opt->position = QStyleOptionTab::Beginning; else if (position == QLatin1String("end")) opt->position = QStyleOptionTab::End; else if (position == QLatin1String("only")) opt->position = QStyleOptionTab::OnlyOneTab; else opt->position = QStyleOptionTab::Middle; if (selectedPosition == QLatin1String("next")) opt->selectedPosition = QStyleOptionTab::NextIsSelected; else if (selectedPosition == QLatin1String("previous")) opt->selectedPosition = QStyleOptionTab::PreviousIsSelected; else opt->selectedPosition = QStyleOptionTab::NotAdjacent; } break; case Frame: { if (!m_styleoption) m_styleoption = new QStyleOptionFrame(); QStyleOptionFrame *opt = qstyleoption_cast(m_styleoption); opt->frameShape = QFrame::StyledPanel; opt->lineWidth = KyQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); opt->midLineWidth = KyQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); } break; case FocusRect: { if (!m_styleoption) m_styleoption = new QStyleOptionFocusRect(); // Needed on windows m_styleoption->state |= QStyle::State_KeyboardFocusChange; } break; case TabFrame: { if (!m_styleoption) m_styleoption = new QStyleOptionTabWidgetFrame(); QStyleOptionTabWidgetFrame *opt = qstyleoption_cast(m_styleoption); opt->selectedTabRect = m_properties[QStringLiteral("selectedTabRect")].toRect(); opt->shape = m_properties[QStringLiteral("orientation")] == Qt::BottomEdge ? QTabBar::RoundedSouth : QTabBar::RoundedNorth; if (minimum()) opt->selectedTabRect = QRect(value(), 0, minimum(), height()); opt->tabBarSize = QSize(minimum() , height()); // oxygen style needs this hack opt->leftCornerWidgetSize = QSize(value(), 0); } break; case MenuBar: if (!m_styleoption) { QStyleOptionMenuItem *menuOpt = new QStyleOptionMenuItem(); menuOpt->menuItemType = QStyleOptionMenuItem::EmptyArea; m_styleoption = menuOpt; } break; case MenuBarItem: { if (!m_styleoption) m_styleoption = new QStyleOptionMenuItem(); QStyleOptionMenuItem *opt = qstyleoption_cast(m_styleoption); opt->text = text(); opt->menuItemType = QStyleOptionMenuItem::Normal; setProperty("_q_showUnderlined", m_hints[QStringLiteral("showUnderlined")].toBool()); const QFont font = qApp->font("QMenuBar"); opt->font = font; opt->fontMetrics = QFontMetrics(font); m_font = opt->font; } break; case Menu: { if (!m_styleoption) m_styleoption = new QStyleOptionMenuItem(); } break; case MenuItem: case ComboBoxItem: { if (!m_styleoption) m_styleoption = new QStyleOptionMenuItem(); QStyleOptionMenuItem *opt = qstyleoption_cast(m_styleoption); // For GTK style. See below, in setElementType() setProperty("_q_isComboBoxPopupItem", m_itemType == ComboBoxItem); KyQuickStyleItem::MenuItemType type = static_cast(m_properties[QStringLiteral("type")].toInt()); if (type == KyQuickStyleItem::ScrollIndicatorType) { int scrollerDirection = m_properties[QStringLiteral("scrollerDirection")].toInt(); opt->menuItemType = QStyleOptionMenuItem::Scroller; opt->state |= scrollerDirection == Qt::UpArrow ? QStyle::State_UpArrow : QStyle::State_DownArrow; } else if (type == KyQuickStyleItem::SeparatorType) { opt->menuItemType = QStyleOptionMenuItem::Separator; } else { opt->text = text(); if (type == KyQuickStyleItem::MenuType) { opt->menuItemType = QStyleOptionMenuItem::SubMenu; } else { opt->menuItemType = QStyleOptionMenuItem::Normal; QString shortcut = m_properties[QStringLiteral("shortcut")].toString(); if (!shortcut.isEmpty()) { opt->text += QLatin1Char('\t') + shortcut; // opt->tabWidth = qMax(opt->tabWidth, qRound(textWidth(shortcut))); static qreal maxShortcutWidth = 0; maxShortcutWidth = qMax(maxShortcutWidth, static_cast(qRound(textWidth(shortcut)))); qreal actualTabWidth = maxShortcutWidth + 8; } if (m_properties[QStringLiteral("checkable")].toBool()) { opt->checked = on(); QVariant exclusive = m_properties[QStringLiteral("exclusive")]; opt->checkType = exclusive.toBool() ? QStyleOptionMenuItem::Exclusive : QStyleOptionMenuItem::NonExclusive; } } if (m_properties[QStringLiteral("icon")].canConvert()) opt->icon = m_properties[QStringLiteral("icon")].value(); setProperty("_q_showUnderlined", m_hints[QStringLiteral("showUnderlined")].toBool()); const QFont font = qApp->font(m_itemType == ComboBoxItem ?"QComboMenuItem" : "QMenu"); opt->font = font; opt->fontMetrics = QFontMetrics(font); m_font = opt->font; } } break; case CheckBox: case RadioButton: { if (!m_styleoption) m_styleoption = new QStyleOptionButton(); QStyleOptionButton *opt = qstyleoption_cast(m_styleoption); if (!on()) opt->state |= QStyle::State_Off; if (m_properties.value(QStringLiteral("partiallyChecked")).toBool()) opt->state |= QStyle::State_NoChange; opt->text = text(); } break; case Edit: { if (!m_styleoption) m_styleoption = new QStyleOptionFrame(); QStyleOptionFrame *opt = qstyleoption_cast(m_styleoption); opt->lineWidth = qMax(1, KyQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr)); //this must be non zero } break; case ComboBox :{ if (!m_styleoption) m_styleoption = new QStyleOptionComboBox(); QStyleOptionComboBox *opt = qstyleoption_cast(m_styleoption); const QFont font = qApp->font("QPushButton"); //DAVE - QQC1 code does this, but if you look at QComboBox this doesn't make sense opt->fontMetrics = QFontMetrics(font); opt->currentText = text(); opt->editable = m_properties[QStringLiteral("editable")].toBool(); const QVariant icon = m_properties[QStringLiteral("currentIcon")]; if (icon.canConvert()) { opt->currentIcon = icon.value(); } else if (icon.canConvert()) { opt->currentIcon = QIcon::fromTheme(icon.value()); } auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); if (iconSize.isEmpty()) { int e = KyQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); if (iconSize.width() <= 0) { iconSize.setWidth(e); } if (iconSize.height() <= 0) { iconSize.setHeight(e); } } opt->iconSize = iconSize; } break; case SpinBox: { if (!m_styleoption) m_styleoption = new QStyleOptionSpinBox(); QStyleOptionSpinBox *opt = qstyleoption_cast(m_styleoption); opt->frame = true; opt->subControls = QStyle::SC_SpinBoxFrame | QStyle::SC_SpinBoxEditField; if (value() & 0x1) opt->activeSubControls = QStyle::SC_SpinBoxUp; else if (value() & (1<<1)) opt->activeSubControls = QStyle::SC_SpinBoxDown; opt->subControls = QStyle::SC_All; opt->stepEnabled = {}; if (value() & (1<<2)) opt->stepEnabled |= QAbstractSpinBox::StepUpEnabled; if (value() & (1<<3)) opt->stepEnabled |= QAbstractSpinBox::StepDownEnabled; } break; case Slider: case Dial: { if (!m_styleoption) m_styleoption = new QStyleOptionSlider(); QStyleOptionSlider *opt = qstyleoption_cast(m_styleoption); opt->orientation = horizontal() ? Qt::Horizontal : Qt::Vertical; opt->upsideDown = !horizontal(); int min = minimum(); int max = std::max(min, maximum()); opt->minimum = min; opt->maximum = max; opt->sliderPosition = value(); opt->singleStep = step(); if (opt->singleStep) { qreal numOfSteps = (opt->maximum - opt->minimum) / opt->singleStep; // at least 5 pixels between tick marks qreal extent = horizontal() ? width() : height(); if (numOfSteps && (extent / numOfSteps < 5)) opt->tickInterval = qRound((5 * numOfSteps / extent) + 0.5) * step(); else opt->tickInterval = opt->singleStep; } else // default Qt-components implementation opt->tickInterval = opt->maximum != opt->minimum ? 1200 / (opt->maximum - opt->minimum) : 0; opt->sliderValue = value(); opt->subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle; opt->tickPosition = activeControl() == QLatin1String("ticks") ? QSlider::TicksBelow : QSlider::NoTicks; if (opt->tickPosition != QSlider::NoTicks) opt->subControls |= QStyle::SC_SliderTickmarks; opt->activeSubControls = QStyle::SC_SliderHandle; } break; case ProgressBar: { if (!m_styleoption) m_styleoption = new QStyleOptionProgressBar(); QStyleOptionProgressBar *opt = qstyleoption_cast(m_styleoption); if (horizontal()) { opt->state |= QStyle::State_Horizontal; } else { opt->state &= ~QStyle::State_Horizontal; } opt->minimum = qMax(0, minimum()); opt->maximum = qMax(0, maximum()); opt->progress = value(); } break; case GroupBox: { if (!m_styleoption) m_styleoption = new QStyleOptionGroupBox(); QStyleOptionGroupBox *opt = qstyleoption_cast(m_styleoption); opt->text = text(); opt->lineWidth = KyQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); opt->subControls = QStyle::SC_GroupBoxLabel; opt->features = {}; if (m_properties[QStringLiteral("sunken")].toBool()) { // Qt draws an ugly line here so I ignore it opt->subControls |= QStyle::SC_GroupBoxFrame; } else { opt->features |= QStyleOptionFrame::Flat; } if (m_properties[QStringLiteral("checkable")].toBool()) opt->subControls |= QStyle::SC_GroupBoxCheckBox; } break; case ScrollBar: { if (!m_styleoption) m_styleoption = new QStyleOptionSlider(); QStyleOptionSlider *opt = qstyleoption_cast(m_styleoption); opt->minimum = qMax(0, minimum()); opt->maximum = qMax(0, maximum()); opt->pageStep = qMax(0, int(horizontal() ? width() : height())); opt->orientation = horizontal() ? Qt::Horizontal : Qt::Vertical; opt->sliderPosition = value(); opt->sliderValue = value(); opt->activeSubControls = (activeControl() == QLatin1String("up")) ? QStyle::SC_ScrollBarSubLine : (activeControl() == QLatin1String("down")) ? QStyle::SC_ScrollBarAddLine : (activeControl() == QLatin1String("handle")) ? QStyle::SC_ScrollBarSlider : hover() ? QStyle::SC_ScrollBarGroove : QStyle::SC_None; if (raised()) opt->state |= QStyle::State_On; opt->sliderValue = value(); opt->subControls = QStyle::SC_All; setTransient(KyQuickStyleItem::style()->styleHint(QStyle::SH_ScrollBar_Transient, m_styleoption)); break; } default: break; } if (!m_styleoption) m_styleoption = new QStyleOption(); if (needsResolvePalette) resolvePalette(); m_styleoption->styleObject = this; m_styleoption->direction = qApp->layoutDirection(); int w = m_textureWidth > 0 ? m_textureWidth : width(); int h = m_textureHeight > 0 ? m_textureHeight : height(); m_styleoption->rect = QRect(m_paintMargins, 0, w - 2* m_paintMargins, h); if (isEnabled()) { m_styleoption->state |= QStyle::State_Enabled; m_styleoption->palette.setCurrentColorGroup(QPalette::Active); } else { m_styleoption->palette.setCurrentColorGroup(QPalette::Disabled); } if (m_active) m_styleoption->state |= QStyle::State_Active; else m_styleoption->palette.setCurrentColorGroup(QPalette::Inactive); if (m_sunken) m_styleoption->state |= QStyle::State_Sunken; if (m_raised) m_styleoption->state |= QStyle::State_Raised; if (m_selected) m_styleoption->state |= QStyle::State_Selected; if (m_focus) m_styleoption->state |= QStyle::State_HasFocus; if (m_on) m_styleoption->state |= QStyle::State_On; if (m_hover) m_styleoption->state |= QStyle::State_MouseOver; if (m_horizontal) m_styleoption->state |= QStyle::State_Horizontal; // some styles don't draw a focus rectangle if // QStyle::State_KeyboardFocusChange is not set if (window()) { if (m_lastFocusReason == Qt::TabFocusReason || m_lastFocusReason == Qt::BacktabFocusReason) { m_styleoption->state |= QStyle::State_KeyboardFocusChange; } } if (sizeHint == QLatin1String("mini")) { m_styleoption->state |= QStyle::State_Mini; } else if (sizeHint == QLatin1String("small")) { m_styleoption->state |= QStyle::State_Small; } } const char* KyQuickStyleItem::classNameForItem() const { switch(m_itemType) { case Button: return "QPushButton"; case RadioButton: return "QRadioButton"; case CheckBox: return "QCheckBox"; case ComboBox: return "QComboBox"; case ComboBoxItem: return "QComboMenuItem"; case ToolBar: return ""; case ToolButton: return "QToolButton"; case Tab: return "QTabButton"; case TabFrame: return "QTabBar"; case Edit: return "QTextEdit"; case GroupBox: return "QGroupBox"; case Header: return "QHeaderView"; case Item: case ItemRow: return "QAbstractItemView"; case Menu: case MenuItem: return "QMenu"; case MenuBar: case MenuBarItem: return "QMenuBar"; default: return ""; } Q_UNREACHABLE(); } void KyQuickStyleItem::resolvePalette() { if (QCoreApplication::testAttribute(Qt::AA_SetPalette)) return; const QVariant controlPalette = m_control ? m_control->property("palette") : QVariant(); if (controlPalette.isValid()) { m_styleoption->palette = controlPalette.value(); } else { // m_styleoption->palette = m_theme->palette(); } } int KyQuickStyleItem::leftPadding() const { switch (m_itemType) { case Frame: { const QRect cr = KyQuickStyleItem::style()->subElementRect(QStyle::SE_ShapedFrameContents, m_styleoption); return cr.left() - m_styleoption->rect.left(); } default: return 0; } } int KyQuickStyleItem::topPadding() const { switch (m_itemType) { case Frame: { const QRect cr = KyQuickStyleItem::style()->subElementRect(QStyle::SE_ShapedFrameContents, m_styleoption); return cr.top() - m_styleoption->rect.top(); } default: return 0; } } int KyQuickStyleItem::rightPadding() const { switch (m_itemType) { case Frame: { const QRect cr = KyQuickStyleItem::style()->subElementRect(QStyle::SE_ShapedFrameContents, m_styleoption); return m_styleoption->rect.right() - cr.right(); } default: return 0; } } int KyQuickStyleItem::bottomPadding() const { switch (m_itemType) { case Frame: { const QRect cr = KyQuickStyleItem::style()->subElementRect(QStyle::SE_ShapedFrameContents, m_styleoption); return m_styleoption->rect.bottom() - cr.bottom(); } default: return 0; } } /* * Property style * * Returns a simplified style name. * * QMacStyle = "mac" * QWindowsXPStyle = "windowsxp" * QFusionStyle = "fusion" */ QString KyQuickStyleItem::styleName() const { QString style = QString::fromLatin1(KyQuickStyleItem::style()->metaObject()->className()); style = style.toLower(); if (style.startsWith(QLatin1Char('q'))) style = style.right(style.length() - 1); if (style.endsWith(QLatin1String("style"))) style = style.left(style.length() - 5); return style; } QString KyQuickStyleItem::hitTest(int px, int py) { QStyle::SubControl subcontrol = QStyle::SC_All; switch (m_itemType) { case SpinBox :{ subcontrol = KyQuickStyleItem::style()->hitTestComplexControl(QStyle::CC_SpinBox, qstyleoption_cast(m_styleoption), QPoint(px,py), nullptr); if (subcontrol == QStyle::SC_SpinBoxUp) return QStringLiteral("up"); else if (subcontrol == QStyle::SC_SpinBoxDown) return QStringLiteral("down"); } break; case Slider: { subcontrol = KyQuickStyleItem::style()->hitTestComplexControl(QStyle::CC_Slider, qstyleoption_cast(m_styleoption), QPoint(px,py), nullptr); if (subcontrol == QStyle::SC_SliderHandle) return QStringLiteral("handle"); } break; case ScrollBar: { subcontrol = KyQuickStyleItem::style()->hitTestComplexControl(QStyle::CC_ScrollBar, qstyleoption_cast(m_styleoption), QPoint(px,py), nullptr); switch (subcontrol) { case QStyle::SC_ScrollBarSlider: return QStringLiteral("handle"); case QStyle::SC_ScrollBarSubLine: return QStringLiteral("up"); case QStyle::SC_ScrollBarSubPage: return QStringLiteral("upPage"); case QStyle::SC_ScrollBarAddLine: return QStringLiteral("down"); case QStyle::SC_ScrollBarAddPage: return QStringLiteral("downPage"); default: break; } } break; default: break; } return QStringLiteral("none"); } QSize KyQuickStyleItem::sizeFromContents(int width, int height) { initStyleOption(); QSize size; switch (m_itemType) { case RadioButton: size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_RadioButton, m_styleoption, QSize(width,height)); break; case CheckBox: size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_CheckBox, m_styleoption, QSize(width,height)); break; case ToolBar: size = QSize(200, styleName().contains(QLatin1String("windows")) ? 30 : 42); break; case ToolButton: { QStyleOptionToolButton *btn = qstyleoption_cast(m_styleoption); int w = 0; int h = 0; if (btn->toolButtonStyle != Qt::ToolButtonTextOnly) { QSize icon = btn->iconSize; w = icon.width(); h = icon.height(); } if (btn->toolButtonStyle != Qt::ToolButtonIconOnly) { QSize textSize = btn->fontMetrics.size(Qt::TextShowMnemonic, btn->text); textSize.setWidth(textSize.width() + btn->fontMetrics.horizontalAdvance(QLatin1Char(' '))*2); if (btn->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { h += 4 + textSize.height(); if (textSize.width() > w) w = textSize.width(); } else if (btn->toolButtonStyle == Qt::ToolButtonTextBesideIcon) { w += 4 + textSize.width(); if (textSize.height() > h) h = textSize.height(); } else { // TextOnly w = textSize.width(); h = textSize.height(); } } btn->rect.setSize(QSize(w, h)); size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_ToolButton, m_styleoption, QSize(w, h)); } break; case Button: { QStyleOptionButton *btn = qstyleoption_cast(m_styleoption); int contentWidth = btn->fontMetrics.boundingRect(btn->text).width(); int contentHeight = btn->fontMetrics.height(); if (!btn->icon.isNull()) { //+4 matches a hardcoded value in QStyle and acts as a margin between the icon and the text. contentWidth += btn->iconSize.width() + 4; contentHeight = qMax(btn->fontMetrics.height(), btn->iconSize.height()); } int newWidth = qMax(width, contentWidth); int newHeight = qMax(height, contentHeight); size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_PushButton, m_styleoption, QSize(newWidth, newHeight)); } break; case ComboBox: { QStyleOptionComboBox *btn = qstyleoption_cast(m_styleoption); int newWidth = qMax(width, btn->fontMetrics.boundingRect(btn->currentText).width()); int newHeight = qMax(height, btn->fontMetrics.height()); size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_ComboBox, m_styleoption, QSize(newWidth, newHeight)); } break; case Tab: { QStyleOptionTab *tab = qstyleoption_cast(m_styleoption); int contentWidth = tab->fontMetrics.boundingRect(tab->text).width(); int contentHeight = tab->fontMetrics.height(); if (!tab->icon.isNull()) { //+4 matches a hardcoded value in QStyle and acts as a margin between the icon and the text. contentWidth += tab->iconSize.width() + 4; contentHeight = qMax(contentHeight, tab->iconSize.height()); } contentWidth += KyQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabHSpace, tab); contentHeight += KyQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabVSpace, tab); const int newWidth = qMax(width, contentWidth); const int newHeight = qMax(height, contentHeight); size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_TabBarTab, m_styleoption, QSize(newWidth, newHeight)); break; } case Slider: size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_Slider, m_styleoption, QSize(width,height)); break; case ProgressBar: size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_ProgressBar, m_styleoption, QSize(width,height)); break; case SpinBox: case Edit: { // We have to create a new style option since we might be calling with a QStyleOptionSpinBox QStyleOptionFrame frame; //+2 to be consistent with the hardcoded verticalmargin in QLineEdit int contentHeight = frame.fontMetrics.height() + 2; frame.state = m_styleoption->state | QStyle::State_Sunken; frame.lineWidth = KyQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); frame.rect = m_styleoption->rect; frame.styleObject = this; size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_LineEdit, &frame, QSize(width, qMax(height, contentHeight))); if (m_itemType == SpinBox) { size.setWidth(KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_SpinBox, m_styleoption, QSize(width + 2, height)).width()); } } break; case GroupBox: { QStyleOptionGroupBox *box = qstyleoption_cast(m_styleoption); QFontMetrics metrics(box->fontMetrics); int baseWidth = metrics.boundingRect(box->text + QLatin1Char(' ')).width(); int baseHeight = metrics.height() + m_contentHeight; if (box->subControls & QStyle::SC_GroupBoxCheckBox) { baseWidth += KyQuickStyleItem::style()->pixelMetric(QStyle::PM_IndicatorWidth); baseWidth += KyQuickStyleItem::style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing); baseHeight = qMax(baseHeight, KyQuickStyleItem::style()->pixelMetric(QStyle::PM_IndicatorHeight)); } size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_GroupBox, m_styleoption, QSize(qMax(baseWidth, m_contentWidth), baseHeight)); } break; case Header: size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_HeaderSection, m_styleoption, QSize(width,height)); break; case ItemRow: case Item: //fall through size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_ItemViewItem, m_styleoption, QSize(width,height)); break; case MenuBarItem: size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_MenuBarItem, m_styleoption, QSize(width,height)); break; case MenuBar: size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_MenuBar, m_styleoption, QSize(width,height)); break; case Menu: size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_Menu, m_styleoption, QSize(width,height)); break; case MenuItem: case ComboBoxItem: if (static_cast(m_styleoption)->menuItemType == QStyleOptionMenuItem::Scroller) { // Qt6 不再支持 globalStrut,直接使用 PM_MenuScrollerHeight size.setHeight(KyQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuScrollerHeight, nullptr, nullptr)); } else { size = KyQuickStyleItem::style()->sizeFromContents(QStyle::CT_MenuItem, m_styleoption, QSize(width, height)); } break; default: break; } return size.expandedTo(QSize(m_contentWidth, m_contentHeight)); } qreal KyQuickStyleItem::baselineOffset() { QRect r; bool ceilResult = true; // By default baseline offset rounding is done upwards switch (m_itemType) { case RadioButton: r = KyQuickStyleItem::style()->subElementRect(QStyle::SE_RadioButtonContents, m_styleoption); break; case Button: r = KyQuickStyleItem::style()->subElementRect(QStyle::SE_PushButtonContents, m_styleoption); break; case CheckBox: r = KyQuickStyleItem::style()->subElementRect(QStyle::SE_CheckBoxContents, m_styleoption); break; case Edit: r = KyQuickStyleItem::style()->subElementRect(QStyle::SE_LineEditContents, m_styleoption); break; case ComboBox: if (const QStyleOptionComboBox *combo = qstyleoption_cast(m_styleoption)) { r = KyQuickStyleItem::style()->subControlRect(QStyle::CC_ComboBox, combo, QStyle::SC_ComboBoxEditField); if (styleName() != QLatin1String("mac")) r.adjust(0,0,0,1); } break; case SpinBox: if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast(m_styleoption)) { r = KyQuickStyleItem::style()->subControlRect(QStyle::CC_SpinBox, spinbox, QStyle::SC_SpinBoxEditField); ceilResult = false; } break; default: break; } if (r.height() > 0) { const QFontMetrics &fm = m_styleoption->fontMetrics; int surplus = r.height() - fm.height(); if ((surplus & 1) && ceilResult) surplus++; int result = r.top() + surplus/2 + fm.ascent(); return result; } return 0.; } void KyQuickStyleItem::updateBaselineOffset() { const qreal baseline = baselineOffset(); if (baseline > 0) setBaselineOffset(baseline); } void KyQuickStyleItem::setContentWidth(int arg) { if (m_contentWidth != arg) { m_contentWidth = arg; emit contentWidthChanged(arg); } } void KyQuickStyleItem::setContentHeight(int arg) { if (m_contentHeight != arg) { m_contentHeight = arg; emit contentHeightChanged(arg); } } void KyQuickStyleItem::updateSizeHint() { QSize implicitSize = sizeFromContents(m_contentWidth, m_contentHeight); setImplicitSize(implicitSize.width(), implicitSize.height()); } void KyQuickStyleItem::updateRect() { initStyleOption(); m_styleoption->rect.setWidth(width()); m_styleoption->rect.setHeight(height()); } int KyQuickStyleItem::pixelMetric(const QString &metric) { if (metric == QLatin1String("scrollbarExtent")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr); else if (metric == QLatin1String("defaultframewidth")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption); else if (metric == QLatin1String("taboverlap")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabOverlap, nullptr); else if (metric == QLatin1String("tabbaseoverlap")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, m_styleoption); else if (metric == QLatin1String("tabhspace")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabHSpace, nullptr); else if (metric == QLatin1String("indicatorwidth")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_IndicatorWidth, nullptr); else if (metric == QLatin1String("exclusiveindicatorwidth")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, nullptr); else if (metric == QLatin1String("checkboxlabelspacing")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, nullptr); else if (metric == QLatin1String("ratiobuttonlabelspacing")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_RadioButtonLabelSpacing, nullptr); else if (metric == QLatin1String("tabvspace")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabVSpace, nullptr); else if (metric == QLatin1String("tabbaseheight")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarBaseHeight, nullptr); else if (metric == QLatin1String("tabvshift")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, nullptr); else if (metric == QLatin1String("menubarhmargin")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr); else if (metric == QLatin1String("menubarvmargin")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr); else if (metric == QLatin1String("menubarpanelwidth")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr); else if (metric == QLatin1String("menubaritemspacing")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarItemSpacing, nullptr); else if (metric == QLatin1String("spacebelowmenubar")) return KyQuickStyleItem::style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, m_styleoption); else if (metric == QLatin1String("menuhmargin")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuHMargin, nullptr); else if (metric == QLatin1String("menuvmargin")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr); else if (metric == QLatin1String("menupanelwidth")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr); else if (metric == QLatin1String("submenuoverlap")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr); else if (metric == QLatin1String("splitterwidth")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_SplitterWidth, nullptr); else if (metric == QLatin1String("scrollbarspacing")) return abs(KyQuickStyleItem::style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, nullptr)); else if (metric == QLatin1String("treeviewindentation")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_TreeViewIndentation, nullptr); else if (metric == QLatin1String("layouthorizontalspacing")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing, nullptr); else if (metric == QLatin1String("layoutverticalspacing")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, nullptr); else if (metric == QLatin1String("layoutleftmargin")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr); else if (metric == QLatin1String("layouttopmargin")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr); else if (metric == QLatin1String("layoutrightmargin")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr); else if (metric == QLatin1String("layoutbottommargin")) return KyQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr); return 0; } QVariant KyQuickStyleItem::styleHint(const QString &metric) { initStyleOption(); if (metric == QLatin1String("comboboxpopup")) { return KyQuickStyleItem::style()->styleHint(QStyle::SH_ComboBox_Popup, m_styleoption); } else if (metric == QLatin1String("highlightedTextColor")) { return m_styleoption->palette.highlightedText().color().name(); } else if (metric == QLatin1String("textColor")) { QPalette pal = m_styleoption->palette; pal.setCurrentColorGroup(active()? QPalette::Active : QPalette::Inactive); return pal.text().color().name(); } else if (metric == QLatin1String("focuswidget")) { return KyQuickStyleItem::style()->styleHint(QStyle::SH_FocusFrame_AboveWidget); } else if (metric == QLatin1String("tabbaralignment")) { int result = KyQuickStyleItem::style()->styleHint(QStyle::SH_TabBar_Alignment); if (result == Qt::AlignCenter) return QStringLiteral("center"); return QStringLiteral("left"); } else if (metric == QLatin1String("externalScrollBars")) { return KyQuickStyleItem::style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents); } else if (metric == QLatin1String("scrollToClickPosition")) return KyQuickStyleItem::style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition); else if (metric == QLatin1String("activateItemOnSingleClick")) return KyQuickStyleItem::style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick); else if (metric == QLatin1String("submenupopupdelay")) return KyQuickStyleItem::style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, m_styleoption); else if (metric == QLatin1String("wheelScrollLines")) return qApp->wheelScrollLines(); return 0; // Add SH_Menu_SpaceActivatesItem } void KyQuickStyleItem::setHints(const QVariantMap &str) { if (m_hints != str) { m_hints = str; initStyleOption(); updateSizeHint(); if (m_styleoption->state & QStyle::State_Mini) { m_font.setPointSize(9.); emit fontChanged(); } else if (m_styleoption->state & QStyle::State_Small) { m_font.setPointSize(11.); emit fontChanged(); } else { emit hintChanged(); } } } void KyQuickStyleItem::resetHints() { m_hints.clear(); } void KyQuickStyleItem::setElementType(const QString &str) { if (m_type == str) return; m_type = str; emit elementTypeChanged(); if (m_styleoption) { delete m_styleoption; m_styleoption = nullptr; } // Only enable visible if the widget can animate if (str == QLatin1String("menu")) { m_itemType = Menu; } else if (str == QLatin1String("menuitem")) { m_itemType = MenuItem; } else if (str == QLatin1String("item") || str == QLatin1String("itemrow") || str == QLatin1String("header")) { if (str == QLatin1String("header")) { m_itemType = Header; } else { m_itemType = str == QLatin1String("item") ? Item : ItemRow; } } else if (str == QLatin1String("itembranchindicator")) { m_itemType = ItemBranchIndicator; } else if (str == QLatin1String("groupbox")) { m_itemType = GroupBox; } else if (str == QLatin1String("tab")) { m_itemType = Tab; } else if (str == QLatin1String("tabframe")) { m_itemType = TabFrame; } else if (str == QLatin1String("comboboxitem")) { // Gtk uses qobject cast, hence we need to separate this from menuitem // On mac, we temporarily use the menu item because it has more accurate // palette. m_itemType = ComboBoxItem; } else if (str == QLatin1String("toolbar")) { m_itemType = ToolBar; } else if (str == QLatin1String("toolbutton")) { m_itemType = ToolButton; } else if (str == QLatin1String("slider")) { m_itemType = Slider; } else if (str == QLatin1String("frame")) { m_itemType = Frame; } else if (str == QLatin1String("combobox")) { m_itemType = ComboBox; } else if (str == QLatin1String("splitter")) { m_itemType = Splitter; } else if (str == QLatin1String("progressbar")) { m_itemType = ProgressBar; } else if (str == QLatin1String("button")) { m_itemType = Button; } else if (str == QLatin1String("checkbox")) { m_itemType = CheckBox; } else if (str == QLatin1String("radiobutton")) { m_itemType = RadioButton; } else if (str == QLatin1String("edit")) { m_itemType = Edit; } else if (str == QLatin1String("spinbox")) { m_itemType = SpinBox; } else if (str == QLatin1String("scrollbar")) { m_itemType = ScrollBar; } else if (str == QLatin1String("widget")) { m_itemType = Widget; } else if (str == QLatin1String("focusframe")) { m_itemType = FocusFrame; } else if (str == QLatin1String("focusrect")) { m_itemType = FocusRect; } else if (str == QLatin1String("dial")) { m_itemType = Dial; } else if (str == QLatin1String("statusbar")) { m_itemType = StatusBar; } else if (str == QLatin1String("machelpbutton")) { m_itemType = MacHelpButton; } else if (str == QLatin1String("scrollareacorner")) { m_itemType = ScrollAreaCorner; } else if (str == QLatin1String("menubar")) { m_itemType = MenuBar; } else if (str == QLatin1String("menubaritem")) { m_itemType = MenuBarItem; } else { m_itemType = Undefined; } emit leftPaddingChanged(); emit rightPaddingChanged(); emit topPaddingChanged(); emit bottomPaddingChanged(); updateSizeHint(); } QRectF KyQuickStyleItem::subControlRect(const QString &subcontrolString) { QStyle::SubControl subcontrol = QStyle::SC_None; initStyleOption(); switch (m_itemType) { case SpinBox: { QStyle::ComplexControl control = QStyle::CC_SpinBox; if (subcontrolString == QLatin1String("down")) subcontrol = QStyle::SC_SpinBoxDown; else if (subcontrolString == QLatin1String("up")) subcontrol = QStyle::SC_SpinBoxUp; else if (subcontrolString == QLatin1String("edit")){ subcontrol = QStyle::SC_SpinBoxEditField; } return KyQuickStyleItem::style()->subControlRect(control, qstyleoption_cast(m_styleoption), subcontrol); } break; case Slider: { QStyle::ComplexControl control = QStyle::CC_Slider; if (subcontrolString == QLatin1String("handle")) subcontrol = QStyle::SC_SliderHandle; else if (subcontrolString == QLatin1String("groove")) subcontrol = QStyle::SC_SliderGroove; return KyQuickStyleItem::style()->subControlRect(control, qstyleoption_cast(m_styleoption), subcontrol); } break; case ScrollBar: { QStyle::ComplexControl control = QStyle::CC_ScrollBar; if (subcontrolString == QLatin1String("slider")) subcontrol = QStyle::SC_ScrollBarSlider; if (subcontrolString == QLatin1String("groove")) subcontrol = QStyle::SC_ScrollBarGroove; else if (subcontrolString == QLatin1String("handle")) subcontrol = QStyle::SC_ScrollBarSlider; else if (subcontrolString == QLatin1String("add")) subcontrol = QStyle::SC_ScrollBarAddPage; else if (subcontrolString == QLatin1String("sub")) subcontrol = QStyle::SC_ScrollBarSubPage; return KyQuickStyleItem::style()->subControlRect(control, qstyleoption_cast(m_styleoption), subcontrol); } break; case ItemBranchIndicator: { QStyleOption opt; opt.rect = QRect(0, 0, implicitWidth(), implicitHeight()); return KyQuickStyleItem::style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &opt, nullptr); } default: break; } return QRectF(); } namespace { class QHighDpiPixmapsEnabler1 { public: QHighDpiPixmapsEnabler1() :wasEnabled(false) { if (!qApp->testAttribute(Qt::AA_UseHighDpiPixmaps)) { qApp->setAttribute(Qt::AA_UseHighDpiPixmaps); wasEnabled = true; } } ~QHighDpiPixmapsEnabler1() { if (wasEnabled) qApp->setAttribute(Qt::AA_UseHighDpiPixmaps, false); } private: bool wasEnabled; }; } void KyQuickStyleItem::paint(QPainter *painter) { return ; initStyleOption(); if (QStyleOptionMenuItem *opt = qstyleoption_cast(m_styleoption)) painter->setFont(opt->font); else { QFont font; if (m_styleoption->state & QStyle::State_Mini) { font = qApp->font("QMiniFont"); } else if (m_styleoption->state & QStyle::State_Small) { font = qApp->font("QSmallFont"); } painter->setFont(font); } // Set AA_UseHighDpiPixmaps when calling style code to make QIcon return // "retina" pixmaps. The flag is controlled by the application so we can't // set it unconditinally. QHighDpiPixmapsEnabler1 enabler; switch (m_itemType) { case Button:{ QWidget wid; if(m_buttonType == "MaxButton" || m_buttonType == "MinButton" || m_buttonType == "WindowButton") { wid.setProperty("isWindowButton", QVariant(0x01)); } else if(m_buttonType == "CloseButton") { wid.setProperty("isWindowButton", QVariant(0x02)); } if(m_buttonType == "BlueButton" || m_buttonType == "ImportantButton") { wid.setProperty("isImportant", true); } if(m_roundButton == "RoundButton") { wid.setProperty("isRoundButton", true); } KyQuickStyleItem::style()->drawControl(QStyle::CE_PushButton, m_styleoption, painter,&wid); } break; case ItemRow :{ QPixmap pixmap; // Only draw through style once const QString pmKey = QLatin1String("itemrow") % QString::number(m_styleoption->state,16) % activeControl(); if (!QPixmapCache::find(pmKey, &pixmap) || pixmap.width() < width() || height() != pixmap.height()) { int newSize = width(); pixmap = QPixmap(newSize, height()); pixmap.fill(Qt::transparent); QPainter pixpainter(&pixmap); KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelItemViewRow, m_styleoption, &pixpainter); if ((styleName() == QLatin1String("mac") || !KyQuickStyleItem::style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected)) && selected()) { QPalette pal = QApplication::palette("QAbstractItemView"); pal.setCurrentColorGroup(m_styleoption->palette.currentColorGroup()); pixpainter.fillRect(m_styleoption->rect, pal.highlight()); } QPixmapCache::insert(pmKey, pixmap); } painter->drawPixmap(0, 0, pixmap); } break; case Item: KyQuickStyleItem::style()->drawControl(QStyle::CE_ItemViewItem, m_styleoption, painter); break; case ItemBranchIndicator: KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_IndicatorBranch, m_styleoption, painter); break; case Header: KyQuickStyleItem::style()->drawControl(QStyle::CE_Header, m_styleoption, painter); break; case ToolButton: KyQuickStyleItem::style()->drawComplexControl(QStyle::CC_ToolButton, qstyleoption_cast(m_styleoption), painter); break; case Tab: { if (m_lastFocusReason != Qt::TabFocusReason && m_lastFocusReason != Qt::BacktabFocusReason) { m_styleoption->state &= ~QStyle::State_HasFocus; } KyQuickStyleItem::style()->drawControl(QStyle::CE_TabBarTab, m_styleoption, painter); } break; case Frame: m_styleoption->state |= QStyle::State_Sunken; m_styleoption->state &= ~QStyle::State_Raised; KyQuickStyleItem::style()->drawControl(QStyle::CE_ShapedFrame, m_styleoption, painter); break; case FocusFrame: KyQuickStyleItem::style()->drawControl(QStyle::CE_FocusFrame, m_styleoption, painter); break; case FocusRect: KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_FrameFocusRect, m_styleoption, painter); break; case TabFrame: KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_FrameTabWidget, m_styleoption, painter); break; case MenuBar: KyQuickStyleItem::style()->drawControl(QStyle::CE_MenuBarEmptyArea, m_styleoption, painter); break; case MenuBarItem: KyQuickStyleItem::style()->drawControl(QStyle::CE_MenuBarItem, m_styleoption, painter); break; case MenuItem: case ComboBoxItem: { // fall through QStyle::ControlElement menuElement = static_cast(m_styleoption)->menuItemType == QStyleOptionMenuItem::Scroller ? QStyle::CE_MenuScroller : QStyle::CE_MenuItem; KyQuickStyleItem::style()->drawControl(menuElement, m_styleoption, painter); } break; case CheckBox: KyQuickStyleItem::style()->drawControl(QStyle::CE_CheckBox, m_styleoption, painter); break; case RadioButton: KyQuickStyleItem::style()->drawControl(QStyle::CE_RadioButton, m_styleoption, painter); break; case Edit: KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelLineEdit, m_styleoption, painter); break; case MacHelpButton: //Not managed as mac is not supported break; case Widget: KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_Widget, m_styleoption, painter); break; case ScrollAreaCorner: KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, m_styleoption, painter); break; case Splitter: if (m_styleoption->rect.width() == 1) painter->fillRect(0, 0, width(), height(), m_styleoption->palette.dark().color()); else KyQuickStyleItem::style()->drawControl(QStyle::CE_Splitter, m_styleoption, painter); break; case ComboBox: { KyQuickStyleItem::style()->drawComplexControl(QStyle::CC_ComboBox, qstyleoption_cast(m_styleoption), painter); // This is needed on mac as it will use the painter color and ignore the palette QPen pen = painter->pen(); painter->setPen(m_styleoption->palette.text().color()); KyQuickStyleItem::style()->drawControl(QStyle::CE_ComboBoxLabel, m_styleoption, painter); painter->setPen(pen); } break; case SpinBox: #ifdef Q_OS_MAC // macstyle depends on the embedded qlineedit to fill the editfield background if (styleName() == QLatin1String("mac")) { QRect editRect = KyQuickStyleItem::style()->subControlRect(QStyle::CC_SpinBox, qstyleoption_cast(m_styleoption), QStyle::SC_SpinBoxEditField); painter->fillRect(editRect.adjusted(-1, -1, 1, 1), m_styleoption->palette.base()); } #endif KyQuickStyleItem::style()->drawComplexControl(QStyle::CC_SpinBox, qstyleoption_cast(m_styleoption), painter); break; case Slider: KyQuickStyleItem::style()->drawComplexControl(QStyle::CC_Slider, qstyleoption_cast(m_styleoption), painter); break; case Dial: KyQuickStyleItem::style()->drawComplexControl(QStyle::CC_Dial, qstyleoption_cast(m_styleoption), painter); break; case ProgressBar: KyQuickStyleItem::style()->drawControl(QStyle::CE_ProgressBar, m_styleoption, painter); break; case ToolBar: painter->fillRect(m_styleoption->rect, m_styleoption->palette.window().color()); KyQuickStyleItem::style()->drawControl(QStyle::CE_ToolBar, m_styleoption, painter); painter->save(); painter->setPen(styleName() != QLatin1String("fusion") ? m_styleoption->palette.dark().color().darker(120) : m_styleoption->palette.window().color().lighter(107)); painter->drawLine(m_styleoption->rect.bottomLeft(), m_styleoption->rect.bottomRight()); painter->restore(); break; case StatusBar: { painter->fillRect(m_styleoption->rect, m_styleoption->palette.window().color()); painter->setPen(m_styleoption->palette.dark().color().darker(120)); painter->drawLine(m_styleoption->rect.topLeft(), m_styleoption->rect.topRight()); KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelStatusBar, m_styleoption, painter); } break; case GroupBox: KyQuickStyleItem::style()->drawComplexControl(QStyle::CC_GroupBox, qstyleoption_cast(m_styleoption), painter); break; case ScrollBar: KyQuickStyleItem::style()->drawComplexControl(QStyle::CC_ScrollBar, qstyleoption_cast(m_styleoption), painter); break; case Menu: { QStyleHintReturnMask val; KyQuickStyleItem::style()->styleHint(QStyle::SH_Menu_Mask, m_styleoption, nullptr, &val); painter->save(); painter->setClipRegion(val.region); painter->fillRect(m_styleoption->rect, m_styleoption->palette.window()); painter->restore(); KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelMenu, m_styleoption, painter); if (int fw = KyQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuPanelWidth)) { QStyleOptionFrame frame; frame.state = QStyle::State_None; frame.lineWidth = fw; frame.midLineWidth = 0; frame.rect = m_styleoption->rect; frame.styleObject = this; frame.palette = m_styleoption->palette; KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_FrameMenu, &frame, painter); } } break; default: break; } } qreal KyQuickStyleItem::textWidth(const QString &text) { QFontMetricsF fm = QFontMetricsF(m_styleoption->fontMetrics); return fm.boundingRect(text).width(); } qreal KyQuickStyleItem::textHeight(const QString &text) { QFontMetricsF fm = QFontMetricsF(m_styleoption->fontMetrics); return text.isEmpty() ? fm.height() : fm.boundingRect(text).height(); } QString KyQuickStyleItem::elidedText(const QString &text, int elideMode, int width) { return m_styleoption->fontMetrics.elidedText(text, Qt::TextElideMode(elideMode), width); } bool KyQuickStyleItem::hasThemeIcon(const QString &icon) const { return QIcon::hasThemeIcon(icon); } bool KyQuickStyleItem::event(QEvent *ev) { if (ev->type() == QEvent::StyleAnimationUpdate) { if (isVisible()) { ev->accept(); polish(); } return true; } return QQuickItem::event(ev); } void KyQuickStyleItem::setTextureWidth(int w) { if (m_textureWidth == w) return; m_textureWidth = w; emit textureWidthChanged(m_textureWidth); update(); } void KyQuickStyleItem::setTextureHeight(int h) { if (m_textureHeight == h) return; m_textureHeight = h; emit textureHeightChanged(m_textureHeight); update(); } QQuickItem *KyQuickStyleItem::control() const { return m_control; } void KyQuickStyleItem::setControl(QQuickItem *control) { if (control == m_control) { return; } if (m_control) { m_control->removeEventFilter(this); disconnect(m_control, nullptr, this, nullptr); } m_control = control; if (m_control) { m_control->installEventFilter(this); if (m_control->window()) { m_window = m_control->window(); m_window->installEventFilter(this); } connect(m_control, &QQuickItem::windowChanged, this, [this](QQuickWindow *window) { if (m_window) { m_window->removeEventFilter(this); } m_window = window; if (m_window) { m_window->installEventFilter(this); } }); } emit controlChanged(); } QSGNode *KyQuickStyleItem::updatePaintNode(QSGNode *node, UpdatePaintNodeData *) { if (m_image.isNull()) { delete node; return nullptr; } QSGNinePatchNode *styleNode = static_cast(node); if (!styleNode) styleNode = window()->createNinePatchNode(); #ifdef QSG_RUNTIME_DESCRIPTION qsgnode_set_description(styleNode, QString::fromLatin1("%1:%2, '%3'") .arg(styleName()) .arg(elementType()) .arg(text())); #endif styleNode->setTexture(window()->createTextureFromImage(m_image, QQuickWindow::TextureCanUseAtlas)); styleNode->setBounds(boundingRect()); styleNode->setDevicePixelRatio(window()->devicePixelRatio()); styleNode->setPadding(m_border.left(), m_border.top(), m_border.right(), m_border.bottom()); styleNode->update(); return styleNode; } void KyQuickStyleItem::updatePolish() { if (width() >= 1 && height() >= 1) { // Note these are reals so 1 pixel is minimum float devicePixelRatio = window() ? window()->devicePixelRatio() : qApp->devicePixelRatio(); int w = m_textureWidth > 0 ? m_textureWidth : width(); int h = m_textureHeight > 0 ? m_textureHeight : height(); m_image = QImage(w * devicePixelRatio, h * devicePixelRatio, QImage::Format_ARGB32_Premultiplied); m_image.setDevicePixelRatio(devicePixelRatio); m_image.fill(Qt::transparent); QPainter painter(&m_image); painter.setLayoutDirection(qApp->layoutDirection()); paint(&painter); QQuickItem::update(); } else if (!m_image.isNull()) { m_image = QImage(); QQuickItem::update(); } } bool KyQuickStyleItem::eventFilter(QObject *watched, QEvent *event) { if (watched == m_control) { if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut) { QFocusEvent *fe = static_cast(event); m_lastFocusReason = fe->reason(); } } else if (watched == m_window.data()) { if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) { QKeyEvent *ke = static_cast(event); if (ke->key() == Qt::Key_Alt) { updateItem(); } } } return QQuickItem::eventFilter(watched, event); } void KyQuickStyleItem::styleChanged() { if (!qApp->style() || QApplication::closingDown()) { return; } Q_ASSERT(qApp->style() != sender()); connect(qApp->style(), &QObject::destroyed, this, &KyQuickStyleItem::styleChanged); updateSizeHint(); updateItem(); } QPixmap QQuickTableRowImageProvider1::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) { Q_UNUSED (requestedSize); int width = 16; int height = 16; if (size) *size = QSize(width, height); QPixmap pixmap(width, height); QStyleOptionViewItem opt; opt.state |= QStyle::State_Enabled; opt.rect = QRect(0, 0, width, height); QString style = QString::fromLatin1(KyQuickStyleItem::style()->metaObject()->className()); opt.features = {}; if (id.contains(QLatin1String("selected"))) opt.state |= QStyle::State_Selected; if (id.contains(QLatin1String("active"))) { opt.state |= QStyle::State_Active; opt.palette.setCurrentColorGroup(QPalette::Active); } else opt.palette.setCurrentColorGroup(QPalette::Inactive); if (id.contains(QLatin1String("alternate"))) opt.features |= QStyleOptionViewItem::Alternate; QPalette pal = QApplication::palette("QAbstractItemView"); if (opt.state & QStyle::State_Selected && (style.contains(QLatin1String("Mac")) || !KyQuickStyleItem::style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected))) { pal.setCurrentColorGroup(opt.palette.currentColorGroup()); pixmap.fill(pal.highlight().color()); } else { pixmap.fill(pal.base().color()); QPainter pixpainter(&pixmap); KyQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, &pixpainter); } return pixmap; } qt6-ukui-platformtheme/ukui-qml-style-helper/CMakeLists.txt0000664000175000017500000001167715154306200022761 0ustar fengfengcmake_minimum_required(VERSION 3.16) include(GNUInstallDirs) project(ukui-qml-style-helper) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(QT_MIN_VERSION "5.12.0") set(KF5_MIN_VERSION "5.66.0") find_package(Qt6Quick) find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets DBus # X11Extras Gui ) #find_package(KF5Kirigami2 CONFIG REQUIRED COMPONENTS) #find_package(KF5Config CONFIG REQUIRED COMPONENTS) #find_package(KF5WindowSystem REQUIRED) #find_package(KF5Wayland) find_package(PkgConfig REQUIRED) pkg_check_modules(Qsettings REQUIRED gsettings-qt6) pkg_check_modules(FONTCONFIG REQUIRED fontconfig) pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0 ) # pkg_check_modules(UKUIWINDOWHELPER REQUIRED kysdk-ukuiwindowhelper) set(EXTERNAL_LIBS "") include_directories(${GLIB2_INCLUDE_DIRS}) include_directories(${Qsettings_INCLUDE_DIRS}) if (FONTCONFIG_FOUND) include_directories(${FONTCONFIG_INCLUDE_DIRS}) link_directories(${FONTCONFIG_LIBRARY_DIRS}) endif() if (UKUIWINDOWHELPER_FOUND) include_directories(${UKUIWINDOWHELPER_INCLUDE_DIRS}) link_directories(${UKUIWINDOWHELPER_LIBRARY_DIRS}) endif() file(GLOB_RECURSE HEADER_FILES "kyquickpadding_p.h" "KyIcon.h" "kyquickstyleitem.h" "kystylehelper.h" "qqc2styleplugin.h" "../qt6-ukui-platformtheme/platform-theme-fontdata.h" "../ukui-styles/readconfig.h" "../../libqt6-ukui-style/settings/ukui-style-settings.h" # "styleparameter/tooltip/tooltip.h" # "styleparameter/tooltip/shared-qml-engine.h" # "styleparameter/tooltip/shared-engine-component.h" "styleparameter/tokenparameter.h" "styleparameter/appparameter.h" "styleparameter/ukuilabel.h" "styleparameter/ukuiprogressbar.h" "styleparameter/ukuiswitch.h" "styleparameter/icon.h" "styleparameter/ukuibutton.h" "styleparameter/ukuimenu.h" "styleparameter/ukuiradiobutton.h" "styleparameter/ukuitabbar.h" "styleparameter/imageprovider.h" "styleparameter/ukuicheckbox.h" "styleparameter/ukuimenuitem.h" "styleparameter/ukuiscrollbar.h" "styleparameter/ukuitabbutton.h" "styleparameter/parsecolorinterface.h" "styleparameter/ukuipopupwindowhandle.h" "styleparameter/ukuipopup.h" "styleparameter/ukuitextfiled.h" "styleparameter/ukuicombobox.h" "styleparameter/ukuislider.h" "styleparameter/ukuitextarea.h" "styleparameter/ukuiheaderview.h" ) file(GLOB_RECURSE SRC_FILES "KyIcon.cpp" "kyquickstyleitem.cpp" "kystylehelper.cpp" "qqc2styleplugin.cpp" "../qt6-ukui-platformtheme/platform-theme-fontdata.cpp" "../ukui-styles/readconfig.cpp" # "styleparameter/tooltip/tooltip.cpp" # "styleparameter/tooltip/shared-qml-engine.cpp" # "styleparameter/tooltip/shared-engine-component.cpp" "styleparameter/tokenparameter.cpp" "styleparameter/appparameter.cpp" "styleparameter/ukuilabel.cpp" "styleparameter/ukuiprogressbar.cpp" "styleparameter/ukuiswitch.cpp" "styleparameter/icon.cpp" "styleparameter/ukuibutton.cpp" "styleparameter/ukuimenu.cpp" "styleparameter/ukuiradiobutton.cpp" "styleparameter/ukuitabbar.cpp" "styleparameter/imageprovider.cpp" "styleparameter/ukuicheckbox.cpp" "styleparameter/ukuimenuitem.cpp" "styleparameter/ukuiscrollbar.cpp" "styleparameter/ukuitabbutton.cpp" "styleparameter/ukuicombobox.cpp" "styleparameter/ukuipopup.cpp" "styleparameter/ukuislider.cpp" "styleparameter/ukuitextfiled.cpp" "styleparameter/parsecolorinterface.cpp" "styleparameter/ukuiitemdelegate.cpp" "styleparameter/ukuipopupwindowhandle.cpp" "styleparameter/ukuispinbox.cpp" "styleparameter/ukuitooltip.cpp" "styleparameter/ukuitextarea.cpp" "styleparameter/ukuiheaderview.cpp" ) file(GLOB_RECURSE OTHER_FILES qmldir) SOURCE_GROUP("Header Files" FILES ${HEADER_FILES}) SOURCE_GROUP("Source Files" FILES ${SRC_FILES}) SOURCE_GROUP("other files" FILES ${OTHER_FILES}) #set(QRC_FILES qml/qml.qrc) include_directories(../libqt6-ukui-style/) find_package(Qt6 REQUIRED COMPONENTS Quick) add_library(ukui-qml-style-helper MODULE ${HEADER_FILES} ${SRC_FILES} ${OTHER_FILES} #[[${QRC_FILES}]]) target_link_libraries(ukui-qml-style-helper PRIVATE # KF5::ConfigCore # KF5::Kirigami2 Qt6::Quick Qt6::Widgets Qt6::DBus # Qt6::X11Extras Qt6::Gui Qt::GuiPrivate gsettings-qt6 qt6-ukui-style glib-2.0 ${FONTCONFIG_LIBRARIES} ${EXTERNAL_LIBS} ${UKUIWINDOWHELPER_LIBRARIES} # KF5::WindowSystem # KF5::WaylandClient ) if(UNIX) set(TARGET_PATH "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/qt5/qml/org/ukui/qqc2style/private/") MESSAGE("libukui-qml-style-helper TARGET_PATH: ${TARGET_PATH}") install(TARGETS ${PROJECT_NAME} DESTINATION ${TARGET_PATH}) install(FILES ${OTHER_FILES} DESTINATION "${TARGET_PATH}") # install(DIRECTORY "qml" DESTINATION "${TARGET_PATH}") endif() qt6-ukui-platformtheme/ukui-qml-style-helper/qqc2styleplugin.cpp0000664000175000017500000001022015154306200024052 0ustar fengfeng/* * 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 . * * Authors: Yan Wang * */ #include #include "qqc2styleplugin.h" #include "kyquickstyleitem.h" #include "kystylehelper.h" #include "KyIcon.h" #include "qdebug.h" #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" #include "styleparameter/parsecolorinterface.h" #include "styleparameter/ukuiswitch.h" #include "styleparameter/ukuipopupwindowhandle.h" #include "styleparameter/ukuitextarea.h" #include "styleparameter/ukuiheaderview.h" using namespace UKUIQQC2Style; Qqc2StylePlugin::~Qqc2StylePlugin() { if(m_token){ delete m_token; m_token = nullptr; } } void Qqc2StylePlugin::initializeEngine(QQmlEngine *engine, const char *uri) { m_token = new TokenParameter(); qApp->setProperty("qqc2-globaltoken", QVariant::fromValue(m_token)); engine->addImageProvider("imageProvider", new ImageProvider()); } void Qqc2StylePlugin::registerTypes(const char *uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("org.ukui.qqc2style.private")); // @uri org.ukui.qqc2style.private qmlRegisterType(uri, 1, 0, "StyleHelper"); qmlRegisterType(uri, 1, 0, "KyIcon"); qmlRegisterType(uri, 1, 0, "UKUIButton"); qmlRegisterType(uri, 1, 0, "UKUIButton"); qmlRegisterType(uri, 1, 0, "APPParameter"); qmlRegisterType(uri, 1, 0, "UKUILabel"); qmlRegisterType(uri, 1, 0, "UKUIMenuItem"); qmlRegisterType(uri, 1, 0, "UKUIMenu"); qmlRegisterType(uri, 1, 0, "UKUIPopup"); qmlRegisterType(uri, 1, 0, "UKUIScrollBar"); qmlRegisterType(uri, 1, 0, "UKUITabButton"); qmlRegisterType(uri, 1, 0, "UKUIToolTip"); qmlRegisterType(uri, 1, 0, "UKUIRadioButton"); qmlRegisterType(uri, 1, 0, "UKUICheckBox"); qmlRegisterType(uri, 1, 0, "UKUIComboBox"); qmlRegisterType(uri, 1, 0, "UKUIItemDelegate"); qmlRegisterType(uri, 1, 0, "UKUITextFiled"); qmlRegisterType(uri, 1, 0, "UKUIProgressBar"); qmlRegisterType(uri, 1, 0, "UKUISlider"); qmlRegisterType(uri, 1, 0, "UKUISpinBox"); qmlRegisterType(uri, 1, 0, "UKUITabBar"); qmlRegisterType(uri, 1, 0, "UKUISwitch"); qmlRegisterType(uri, 1, 0, "UKUITextArea"); qmlRegisterType(uri, 1, 0, "UKUIHeaderView"); qmlRegisterType(uri, 1, 0, "ParseColorInterface"); qmlRegisterType(uri, 1, 0, "PopupHandle"); qRegisterMetaType("TokenParameter"); } qt6-ukui-platformtheme/ukui-qml-style-helper/qqc2styleplugin.h0000664000175000017500000000241015154306200023521 0ustar fengfeng/* * 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 . * * Authors: Yan Wang * */ #ifndef QQC2STYLEPLUGIN_H #define QQC2STYLEPLUGIN_H #include #include "styleparameter/tokenparameter.h" class Qqc2StylePlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: ~Qqc2StylePlugin(); void initializeEngine(QQmlEngine *engine, const char *uri) override; void registerTypes(const char *uri) override; private: UKUIQQC2Style::TokenParameter *m_token = nullptr; }; #endif // QQC2STYLEPLUGIN_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/0000775000175000017500000000000015154306200023246 5ustar fengfengqt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuispinbox.h0000664000175000017500000004031215154306200025777 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUISPINBOX_H #define UKUISPINBOX_H #include #include #include #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUISpinBox : public QQuickItem { Q_OBJECT Q_PROPERTY(QBrush normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged) Q_PROPERTY(QBrush hoverColor READ hoverColor WRITE setHoverColor NOTIFY hoverColorChanged) Q_PROPERTY(QBrush clickColor READ clickColor WRITE setClickColor NOTIFY clickColorChanged) Q_PROPERTY(QBrush disableColor READ disableColor WRITE setDisableColor NOTIFY disableColorChanged) Q_PROPERTY(QBrush focusColor READ focusColor WRITE setFocusColor NOTIFY focusColorChanged) Q_PROPERTY(QBrush normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged) Q_PROPERTY(QBrush hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverColorBorderChanged) Q_PROPERTY(QBrush clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickColorBorderChanged) Q_PROPERTY(QBrush disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged) Q_PROPERTY(QBrush focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged) Q_PROPERTY(QBrush normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged) Q_PROPERTY(QBrush disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(QBrush btnNormalColor READ btnNormalColor WRITE setBtnNormalColor NOTIFY btnNormalColorChanged) Q_PROPERTY(QBrush btnHoverColor READ btnHoverColor WRITE setBtnHoverColor NOTIFY btnHoverColorChanged) Q_PROPERTY(QBrush btnClickColor READ btnClickColor WRITE setBtnClickColor NOTIFY btnClickColorChanged) Q_PROPERTY(QBrush btnDisableColor READ btnDisableColor WRITE setBtnDisableColor NOTIFY btnDisableColorChanged) Q_PROPERTY(QBrush btnFocusColor READ btnFocusColor WRITE setBtnFocusColor NOTIFY btnFocusColorChanged) Q_PROPERTY(QBrush btnNormalBorderColor READ btnNormalBorderColor WRITE setBtnNormalBorderColor NOTIFY btnNormalBorderColorChanged) Q_PROPERTY(QBrush btnHoverBorderColor READ btnHoverBorderColor WRITE setBtnHoverBorderColor NOTIFY btnHoverBorderColorChanged) Q_PROPERTY(QBrush btnClickBorderColor READ btnClickBorderColor WRITE setBtnClickBorderColor NOTIFY btnClickBorderColorChanged) Q_PROPERTY(QBrush btnDisableBorderColor READ btnDisableBorderColor WRITE setBtnDisableBorderColor NOTIFY btnDisableBorderColorChanged) Q_PROPERTY(QBrush btnFocusBorderColor READ btnFocusBorderColor WRITE setBtnFocusBorderColor NOTIFY btnFocusBorderColorChanged) Q_PROPERTY(QBrush normalTransparentBC READ normalTransparentBC WRITE setNormalTransparentBC NOTIFY normalTransparentBCChanged) Q_PROPERTY(QBrush clickedTransparentBC READ clickedTransparentBC WRITE setClickedTransparentBC NOTIFY clickedTransparentBCChanged) Q_PROPERTY(QBrush hoveredTransparentBC READ hoveredTransparentBC WRITE setHoveredTransparentBC NOTIFY hoveredTransparentBCChanged) Q_PROPERTY(QBrush disableTransparentBC READ disableTransparentBC WRITE setDisableTransparentBC NOTIFY disableTransparentBCChanged) Q_PROPERTY(QBrush normalTransparentBorderColor READ normalTransparentBorderColor WRITE setNormalTransparentBorderColor NOTIFY normalTransparentBorderColorChanged) Q_PROPERTY(QBrush clickedTransparentBorderColor READ clickedTransparentBorderColor WRITE setClickedTransparentBorderColor NOTIFY clickedTransparentBorderColorChanged) Q_PROPERTY(QBrush hoveredTransparentBorderColor READ hoveredTransparentBorderColor WRITE setHoveredTransparentBorderColor NOTIFY hoveredTransparentBorderColorChanged) Q_PROPERTY(QBrush disableTransparentBorderColor READ disableTransparentBorderColor WRITE setDisableTransparentBorderColor NOTIFY disableTransparentBorderColorChanged) Q_PROPERTY(QBrush btnNormalTransparentColor READ btnNormalTransparentColor WRITE setBtnNormalTransparentColor NOTIFY btnNormalTransparentColorChanged) Q_PROPERTY(QBrush btnHoverTransparentColor READ btnHoverTransparentColor WRITE setBtnHoverTransparentColor NOTIFY btnHoverTransparentColorChanged) Q_PROPERTY(QBrush btnClickTransparentColor READ btnClickTransparentColor WRITE setBtnClickTransparentColor NOTIFY btnClickTransparentColorChanged) Q_PROPERTY(QBrush btnDisableTransparentColor READ btnDisableTransparentColor WRITE setBtnDisableTransparentColor NOTIFY btnDisableTransparentColorChanged) Q_PROPERTY(QBrush btnNormalTransparentBorderColor READ btnNormalTransparentBorderColor WRITE setBtnNormalTransparentBorderColor NOTIFY btnNormalTransparentBorderColorChanged) Q_PROPERTY(QBrush btnHoverTransparentBorderColor READ btnHoverTransparentBorderColor WRITE setBtnHoverTransparentBorderColor NOTIFY btnHoverTransparentBorderColorChanged) Q_PROPERTY(QBrush btnClickTransparentBorderColor READ btnClickTransparentBorderColor WRITE setBtnClickTransparentBorderColor NOTIFY btnClickTransparentBorderColorChanged) Q_PROPERTY(QBrush btnDisableTransparentBorderColor READ btnDisableTransparentBorderColor WRITE setBtnDisableTransparentBorderColor NOTIFY btnDisableTransparentBorderColorChanged) 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 QBrush &normalColor() const; void setNormalColor(const QBrush &newNormalColor); const QBrush &disableColor() const; void setDisableColor(const QBrush &newDisableColor); const QBrush &hoverColor() const; void setHoverColor(const QBrush &newHoverColor); const QBrush &clickColor() const; void setClickColor(const QBrush &newClickColor); const QBrush &normalTextColor() const; void setNormalTextColor(const QBrush &newNormalTextColor); const QBrush &disableTextColor() const; void setDisableTextColor(const QBrush &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 QBrush &normalBorderColor() const; void setNormalBorderColor(const QBrush &newNormalBorderColor); const QBrush &hoverBorderColor() const; void setHoverBorderColor(const QBrush &newHoverBorderColor); const QBrush &clickBorderColor() const; void setClickBorderColor(const QBrush &newClickBorderColor); const QBrush &disableBorderColor() const; void setDisableBorderColor(const QBrush &newDisableBorderColor); const QBrush &focusBorderColor() const; void setFocusBorderColor(const QBrush &newFocusBorderColor); int focusBorderWidth() const; void setFocusBorderWidth(int newFocusBorderWidth); int normalBorderWidth() const; void setNormalBorderWidth(int newNormalBorderWidth); const QBrush &focusColor() const; void setFocusColor(const QBrush &newFocusColor); int padding() const; void setPadding(int newPadding); const QBrush &btnNormalColor() const; void setBtnNormalColor(const QBrush &newBtnNormalColor); const QBrush &btnHoverColor() const; void setBtnHoverColor(const QBrush &newBtnHoverColor); const QBrush &btnClickColor() const; void setBtnClickColor(const QBrush &newBtnClickColor); const QBrush &btnDisableColor() const; void setBtnDisableColor(const QBrush &newBtnDisableColor); const QBrush &btnFocusColor() const; void setBtnFocusColor(const QBrush &newBtnFocusColor); const QBrush &btnNormalBorderColor() const; void setBtnNormalBorderColor(const QBrush &newBtnNormalBorderColor); const QBrush &btnHoverBorderColor() const; void setBtnHoverBorderColor(const QBrush &newBtnHoverBorderColor); const QBrush &btnClickBorderColor() const; void setBtnClickBorderColor(const QBrush &newBtnClickBorderColor); const QBrush &btnDisableBorderColor() const; void setBtnDisableBorderColor(const QBrush &newBtnDisableBorderColor); const QBrush &btnFocusBorderColor() const; void setBtnFocusBorderColor(const QBrush &newBtnFocusBorderColor); int btnBorderWidth() const; void setBtnBorderWidth(int newBtnBorderWidth); const QBrush &normalTransparentBC() const; void setNormalTransparentBC(const QBrush &newNormalTransparentBC); const QBrush &clickedTransparentBC() const; void setClickedTransparentBC(const QBrush &newClickedTransparentBC); const QBrush &hoveredTransparentBC() const; void setHoveredTransparentBC(const QBrush &newHoveredTransparentBC); const QBrush &disableTransparentBC() const; void setDisableTransparentBC(const QBrush &newDisableTransparentBC); const QBrush &normalTransparentBorderColor() const; void setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor); const QBrush &clickedTransparentBorderColor() const; void setClickedTransparentBorderColor(const QBrush &newClickedTransparentBorderColor); const QBrush &hoveredTransparentBorderColor() const; void setHoveredTransparentBorderColor(const QBrush &newHoveredTransparentBorderColor); const QBrush &disableTransparentBorderColor() const; void setDisableTransparentBorderColor(const QBrush &newDisableTransparentBorderColor); const QBrush &btnNormalTransparentColor() const; void setBtnNormalTransparentColor(const QBrush &newBtnNormalTransparentColor); const QBrush &btnHoverTransparentColor() const; void setBtnHoverTransparentColor(const QBrush &newBtnHoverTransparentColor); const QBrush &btnClickTransparentColor() const; void setBtnClickTransparentColor(const QBrush &newBtnClickTransparentColor); const QBrush &btnDisableTransparentColor() const; void setBtnDisableTransparentColor(const QBrush &newBtnDisableTransparentColor); const QBrush &btnNormalTransparentBorderColor() const; void setBtnNormalTransparentBorderColor(const QBrush &newBtnNormalTransparentBorderColor); const QBrush &btnHoverTransparentBorderColor() const; void setBtnHoverTransparentBorderColor(const QBrush &newBtnHoverTransparentBorderColor); const QBrush &btnClickTransparentBorderColor() const; void setBtnClickTransparentBorderColor(const QBrush &newBtnClickTransparentBorderColor); const QBrush &btnDisableTransparentBorderColor() const; void setBtnDisableTransparentBorderColor(const QBrush &newBtnDisableTransparentBorderColor); 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(); void parametryChanged(); void normalTransparentBCChanged(); void clickedTransparentBCChanged(); void hoveredTransparentBCChanged(); void disableTransparentBCChanged(); void normalTransparentBorderColorChanged(); void clickedTransparentBorderColorChanged(); void hoveredTransparentBorderColorChanged(); void disableTransparentBorderColorChanged(); void btnNormalTransparentColorChanged(); void btnHoverTransparentColorChanged(); void btnClickTransparentColorChanged(); void btnDisableTransparentColorChanged(); void btnNormalTransparentBorderColorChanged(); void btnHoverTransparentBorderColorChanged(); void btnClickTransparentBorderColorChanged(); void btnDisableTransparentBorderColorChanged(); private: Q_INVOKABLE QBrush m_normalColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.85)); Q_INVOKABLE QBrush m_disableColor; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; Q_INVOKABLE QBrush m_hoverColor; Q_INVOKABLE QBrush m_clickColor; Q_INVOKABLE QBrush m_normalTextColor; Q_INVOKABLE QBrush m_disableTextColor; int m_normalWidth; int m_normalHeight; int m_radius; int m_btnNormalWidth; int m_btnNormalHeight; Q_INVOKABLE QBrush m_normalBorderColor; Q_INVOKABLE QBrush m_hoverBorderColor; Q_INVOKABLE QBrush m_clickBorderColor; Q_INVOKABLE QBrush m_disableBorderColor; Q_INVOKABLE QBrush m_focusBorderColor; int m_focusBorderWidth; int m_normalBorderWidth; Q_INVOKABLE QBrush m_focusColor; int m_padding; Q_INVOKABLE QBrush m_btnNormalColor; Q_INVOKABLE QBrush m_btnHoverColor; Q_INVOKABLE QBrush m_btnClickColor; Q_INVOKABLE QBrush m_btnDisableColor; Q_INVOKABLE QBrush m_btnFocusColor; Q_INVOKABLE QBrush m_btnNormalBorderColor; Q_INVOKABLE QBrush m_btnHoverBorderColor; Q_INVOKABLE QBrush m_btnClickBorderColor; Q_INVOKABLE QBrush m_btnDisableBorderColor; Q_INVOKABLE QBrush m_btnFocusBorderColor; int m_btnBorderWidth; QBrush m_normalTransparentBC; QBrush m_clickedTransparentBC; QBrush m_hoveredTransparentBC; QBrush m_disableTransparentBC; QBrush m_normalTransparentBorderColor; QBrush m_clickedTransparentBorderColor; QBrush m_hoveredTransparentBorderColor; QBrush m_disableTransparentBorderColor; QBrush m_btnNormalTransparentColor; QBrush m_btnHoverTransparentColor; QBrush m_btnClickTransparentColor; QBrush m_btnDisableTransparentColor; QBrush m_btnNormalTransparentBorderColor; QBrush m_btnHoverTransparentBorderColor; QBrush m_btnClickTransparentBorderColor; QBrush m_btnDisableTransparentBorderColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUISpinBox, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUISPINBOX_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuipopup.cpp0000664000175000017500000000700015154306200026010 0ustar fengfeng#include "ukuipopup.h" #include "qdebug.h" #include "settings/ukui-style-settings.h" using namespace UKUIQQC2Style; UKUIPopup::UKUIPopup(QQuickItem *parent) : QQuickItem(parent) { if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUIPopup::~UKUIPopup() { } void UKUIPopup::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setBackColor(instance->kContainSecondaryNormal()); setBackBorderColor(instance->kLineWindowActive()); setRadius(instance->kradiusMenu()); setShadowColor(instance->shadowActive()); QColor c = instance->windowActive().color(); if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { auto opacity = UKUIStyleSettings::globalInstance()->get("menuTransparency").toInt()/100.0; c.setAlphaF(opacity); } setTransparentBC(c); setTransparentBorderColor(QBrush(QColor(0,0,0,0))); emit parametryChanged(); } UKUIPopup* UKUIPopup::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUIPopup(p); } const QBrush &UKUIPopup::normalColor() const { return m_normalColor; } void UKUIPopup::setNormalColor(const QBrush &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 QBrush &UKUIPopup::backColor() const { return m_backColor; } void UKUIPopup::setBackColor(const QBrush &newBackColor) { if (m_backColor == newBackColor) return; m_backColor = newBackColor; emit backColorChanged(); } const QBrush &UKUIPopup::backBorderColor() const { return m_backBorderColor; } void UKUIPopup::setBackBorderColor(const QBrush &newBackBorderColor) { if (m_backBorderColor == newBackBorderColor) return; m_backBorderColor = newBackBorderColor; emit backBorderColorChanged(); } const QBrush &UKUIPopup::shadowColor() const { return m_shadowColor; } void UKUIPopup::setShadowColor(const QBrush &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(); } const QBrush &UKUIPopup::transparentBC() const { return m_transparentBC; } void UKUIPopup::setTransparentBC(const QBrush &newTransparentBC) { if (m_transparentBC == newTransparentBC) return; m_transparentBC = newTransparentBC; emit transparentBCChanged(); } const QBrush &UKUIPopup::transparentBorderColor() const { return m_transparentBorderColor; } void UKUIPopup::setTransparentBorderColor(const QBrush &newTransparentBorderColor) { if (m_transparentBorderColor == newTransparentBorderColor) return; m_transparentBorderColor = newTransparentBorderColor; emit transparentBorderColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuipopupwindowhandle.cpp0000664000175000017500000001545115154306200030425 0ustar fengfeng// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-3.0-or-later #define protected public #include "ukuipopupwindowhandle.h" #include #include #include #include #include #include #include #include #include #include #include // #include "ukuiwindowhelper.h" #include "../../libqt6-ukui-style/settings/ukui-style-settings.h" #define INNERRECT_WIDTH 1 extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); //// className prepend string of QT_NAMESPACE if existed. //bool inheritsTheClassType(QObject *object, QString className) { //#if defined(QT_NAMESPACE) //#define D_GET_NAMESPACE_STR_IMPL(M) #M "::" //#define D_GET_NAMESPACE_STR(M) D_GET_NAMESPACE_STR_IMPL(M) // className.prepend(D_GET_NAMESPACE_STR(QT_NAMESPACE)); //#undef D_GET_NAMESPACE_STR //#undef D_GET_NAMESPACE_STR_IMPL //#endif // return object && object->inherits(qPrintable(className)); //} using namespace UKUIQQC2Style; UKUIPopupWindowHandle::UKUIPopupWindowHandle(QQuickItem *parent) : QQuickItem (parent) { setFlag(ItemHasContents, false); // 不显示任何内容 setAcceptHoverEvents(false); // 不接受鼠标悬停事件 setAcceptTouchEvents(false); // 不接受触摸事件 setAcceptedMouseButtons(Qt::NoButton); // 不接受鼠标点击事件 QByteArray envValue = qgetenv("QT_QPA_PLATFORM"); if (!envValue.isEmpty()) { QString value = QString::fromUtf8(envValue); if(value == "xcb") { m_isXCB = true; // qDebug() << "xcbxbcxcbxcb....." << m_isXCB; } } connect(this, &QQuickItem::windowChanged, this, [this](QQuickWindow *window) { if (window) { if(m_windowStaysOnTopHint) window->setFlags(Qt::FramelessWindowHint | Qt::Window | Qt::ToolTip | Qt::WindowStaysOnTopHint); else window->setFlags(Qt::FramelessWindowHint | Qt::Window | Qt::ToolTip); // if(!m_isXCB){ // m_windowHelper = new UkuiWindowHelper(window); // if (!m_titlebarVisible) // m_windowHelper->removeTitleBar(); // m_windowHelper->setSkipSwitcher(true); // m_windowHelper->setSkipTaskBar(true); // QPainterPath path; // path.addRoundedRect(x(), y(), width(), height(), m_radius, m_radius); // QRegion effectRegion(path.toFillPolygon().toPolygon()); // m_windowHelper->setDecorationCompoents(UkuiWindowHelper::DecorationComponents(UkuiWindowHelper::DecorationComponent::Shadow) | // UkuiWindowHelper::DecorationComponents(UkuiWindowHelper::DecorationComponent::Border) | // UkuiWindowHelper::DecorationComponents(UkuiWindowHelper::DecorationComponent::RoundCorner)); // m_windowHelper->setBlurEffect(effectRegion, m_blurStrength, m_blurEnabled); // } } }, Qt::UniqueConnection); } UKUIPopupWindowHandle::~UKUIPopupWindowHandle() { // if(m_windowHelper){ // m_windowHelper->deleteLater(); // m_windowHelper = nullptr; // } } void UKUIPopupWindowHandle::setBlurStrength(int strength) { m_blurStrength = strength; } void UKUIPopupWindowHandle::setBlurEnabled(int enabled) { m_blurEnabled = enabled; } void UKUIPopupWindowHandle::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { // QQuickItem::geometryChanged(newGeometry, oldGeometry); // if (m_windowHelper && m_blurEnabled && !m_isXCB) { // QPainterPath path; // path.addRoundedRect(x(), y(), width(), height(), m_radius, m_radius); // QRegion effectRegion(path.toFillPolygon().toPolygon()); // m_windowHelper->setBlurEffect(effectRegion, m_blurStrength, m_blurEnabled); // } } void UKUIPopupWindowHandle::setTitlebarVisible(bool visible) { m_titlebarVisible = visible; } QSize UKUIPopupWindowHandle::getScreenSize() { // 获取鼠标所在屏幕,如果没有特别指定,这里通常会是主屏幕 const QScreen *screen =QGuiApplication::screenAt(QCursor::pos()); Q_ASSERT(screen); if(!screen) return QSize(); // 获取屏幕尺寸 QRect screenGeometry = screen->geometry(); int screenWidth = screenGeometry.width(); int screenHeight = screenGeometry.height(); return QSize(screenWidth, screenHeight); } QPoint UKUIPopupWindowHandle::getScreenPoint() { // 获取鼠标所在屏幕,如果没有特别指定,这里通常会是主屏幕 const QScreen *screen =QGuiApplication::screenAt(QCursor::pos()); Q_ASSERT(screen); if(!screen) return QPoint(); // 获取屏幕尺寸 QRect screenGeometry = screen->geometry(); return QPoint(screenGeometry.x(), screenGeometry.y()); } QPoint UKUIPopupWindowHandle::posByCursor(int width, int height) { QPoint p = QCursor::pos(); // qDebug() << "cursor pos:" << p; const QScreen *screen =QGuiApplication::screenAt(QCursor::pos()); if (const QPlatformScreen *platformScreen = screen ? screen->handle() : nullptr) { QPlatformCursor *cursor = platformScreen->cursor(); const QSize nativeSize = cursor ? cursor->size() : QSize(16, 16); const QSize cursorSize = QHighDpi::fromNativePixels(nativeSize, platformScreen); QPoint offset(2, cursorSize.height()); if (cursorSize.height() > 2 * height) { offset = QPoint(cursorSize.width() / 2, 0); } p += offset; QRect screenRect = screen->geometry(); if (p.x() + width > screenRect.x() + screenRect.width()) p.rx() -= 4 + width; if (p.y() + height > screenRect.y() + screenRect.height()) p.ry() -= 24 + height; if (p.y() < screenRect.y()) p.setY(screenRect.y()); if (p.x() + width > screenRect.x() + screenRect.width()) p.setX(screenRect.x() + screenRect.width() - width); if (p.x() < screenRect.x()) p.setX(screenRect.x()); if (p.y() + height > screenRect.y() + screenRect.height()) p.setY(screenRect.y() + screenRect.height() - height); } // qDebug() << "cursor pos1:" << p; return p; } bool UKUIPopupWindowHandle::posFollwMouse() const { return m_posFollwMouse; } void UKUIPopupWindowHandle::setPosFollwMouse(bool newPosFollwMouse) { m_posFollwMouse = newPosFollwMouse; } void UKUIPopupWindowHandle::setRadius(int newRadius) { m_radius = newRadius; } void UKUIPopupWindowHandle::setWindowStaysOnTopHint(bool newWindowStaysOnTopHint) { m_windowStaysOnTopHint = newWindowStaysOnTopHint; } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/tokenparameter.cpp0000664000175000017500000000163215154306200026775 0ustar fengfeng#include "tokenparameter.h" #include #include #include #include #include #include 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 &TokenParameter::button() const //{ // return m_button; //} //void TokenParameter::setButton(std::shared_ptr &newButton) //{ // if (m_button == newButton) // return; // m_button = newButton; // emit buttonChanged(); //} qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuilabel.h0000664000175000017500000000447715154306200025410 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUILABEL_H #define UKUILABEL_H #include #include #include #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUILabel : public QQuickItem { Q_OBJECT Q_PROPERTY(QBrush normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged) Q_PROPERTY(QBrush disableColor READ disableColor WRITE setDisableColor NOTIFY disableColorChanged) Q_PROPERTY(QBrush 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 QBrush &normalColor() const; void setNormalColor(const QBrush &newNormalColor); const QBrush &linkColor() const; void setLinkColor(const QBrush &newLinkColor); const QBrush &disableColor() const; void setDisableColor(const QBrush &newDisableColor); signals: void normalColorChanged(); void linkColorChanged(); void disableColorChanged(); void parametryChanged(); private: Q_INVOKABLE QBrush m_normalColor = QBrush(QColor ::fromRgbF(0, 0, 0, 0.85)); Q_INVOKABLE QBrush m_linkColor = QBrush(Qt::blue); Q_INVOKABLE QBrush m_disableColor; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUILabel, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUILABEL_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/imageprovider.h0000664000175000017500000000466215154306200026264 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef IMAGEPROVIDER_H #define IMAGEPROVIDER_H #include #include #include #include #include #include #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 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 qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuitabbar.cpp0000664000175000017500000000226715154306200026112 0ustar fengfeng#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(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUITabBar::~UKUITabBar() { } void UKUITabBar::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setNormalColor(instance->kContainSecondaryNormal()); emit parametryChanged(); } UKUITabBar* UKUITabBar::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUITabBar(p); } const QBrush &UKUITabBar::normalColor() const { return m_normalColor; } void UKUITabBar::setNormalColor(const QBrush &newNormalColor) { if (m_normalColor == newNormalColor) return; m_normalColor = newNormalColor; emit normalColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuitextarea.cpp0000664000175000017500000002435415154306200026475 0ustar fengfeng#include #include "ukuitextarea.h" #include "qdebug.h" using namespace UKUIQQC2Style; UKUITextArea::UKUITextArea(QQuickItem *parent) : QQuickItem(parent) { if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUITextArea::~UKUITextArea() { } UKUITextArea* UKUITextArea::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUITextArea(p); } void UKUITextArea::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setLeftRightPadding(16); setRadius(instance->kradiusNormal()); setBorderWidth(instance->normalline()); setFocusBorderWidth(instance->focusline()); setNormalWidth(180); setNormalHeight(36); setInputNormalBC(instance->kComponentInput()); setNormalBC(instance->kContainSecondaryNormal()); setHoveredBC(instance->kContainSecondaryNormal()); setClickedBC(instance->kContainSecondaryNormal()); setDisableBC(instance->kContainSecondaryNormal()); setNormalBorderColor(instance->kLineNormal()); setHoverBorderColor(instance->kLineNormal()); setDisableBorderColor(instance->kLineDisable()); setFocusBorderColor(instance->kBrandNormal()); setPlaceHolderNormalTextColor(instance->kFontPlaceholdertext()); setPlaceHolderDisableTextColor(instance->kFontPlaceholdertextDisable()); setNormalTextColor(instance->kFontPrimary()); setDisableTextColor(instance->kFontPlaceholdertextDisable()); setInputNormalTransparentBC(instance->kComponentInputAlpha()); setNormalTransparentBC(instance->kContainSecondaryAlphaNormal()); setHoveredTransparentBC(instance->kContainSecondaryAlphaNormal()); setClickedTransparentBC(instance->kContainSecondaryAlphaNormal()); setDisableTransparentBC(instance->kContainSecondaryAlphaNormal()); emit parametryChanged(); } double UKUITextArea::radius() const { return m_radius; } void UKUITextArea::setRadius(double newRadius) { if (qFuzzyCompare(m_radius, newRadius)) return; m_radius = newRadius; emit radiusChanged(); } double UKUITextArea::leftRightPadding() const { return m_leftRightPadding; } void UKUITextArea::setLeftRightPadding(double newLeftRightPadding) { if (qFuzzyCompare(m_leftRightPadding, newLeftRightPadding)) return; m_leftRightPadding = newLeftRightPadding; emit leftRightPaddingChanged(); } double UKUITextArea::upDownMargin() const { return m_upDownMargin; } void UKUITextArea::setUpDownMargin(double newUpDownMargin) { if (qFuzzyCompare(m_upDownMargin, newUpDownMargin)) return; m_upDownMargin = newUpDownMargin; emit upDownMarginChanged(); } double UKUITextArea::space() const { return m_space; } void UKUITextArea::setSpace(double newSpace) { if (qFuzzyCompare(m_space, newSpace)) return; m_space = newSpace; emit spaceChange(); } int UKUITextArea::normalWidth() const { return m_normalWidth; } void UKUITextArea::setNormalWidth(int newNormalWidth) { if (m_normalWidth == newNormalWidth) return; m_normalWidth = newNormalWidth; emit normalWidthChanged(); } int UKUITextArea::normalHeight() const { return m_normalHeight; } void UKUITextArea::setNormalHeight(int newNormalHeight) { if (m_normalHeight == newNormalHeight) return; m_normalHeight = newNormalHeight; emit normalHeightChanged(); } const QBrush &UKUITextArea::normalBC() const { return m_normalBC; } void UKUITextArea::setNormalBC(const QBrush &newNormalBC) { if (m_normalBC == newNormalBC) return; m_normalBC = newNormalBC; emit normalBCChanged(); } const QBrush &UKUITextArea::clickedBC() const { return m_clickedBC; } void UKUITextArea::setClickedBC(const QBrush &newClickedBC) { if (m_clickedBC == newClickedBC) return; m_clickedBC = newClickedBC; emit clickedBCChanged(); } const QBrush &UKUITextArea::hoveredBC() const { return m_hoveredBC; } void UKUITextArea::setHoveredBC(const QBrush &newHoveredBC) { if (m_hoveredBC == newHoveredBC) return; m_hoveredBC = newHoveredBC; emit hoveredBCChanged(); } const QBrush &UKUITextArea::disableBC() const { return m_disableBC; } void UKUITextArea::setDisableBC(const QBrush &newDisableBC) { if (m_disableBC == newDisableBC) return; m_disableBC = newDisableBC; emit disableBCChanged(); } const QBrush &UKUITextArea::disableTextColor() const { return m_disableTextColor; } void UKUITextArea::setDisableTextColor(const QBrush &newDisableTextColor) { if (m_disableTextColor == newDisableTextColor) return; m_disableTextColor = newDisableTextColor; emit disableTextColorChanged(); } const QBrush &UKUITextArea::normalTextColor() const { return m_normalTextColor; } void UKUITextArea::setNormalTextColor(const QBrush &newNormalTextColor) { if (m_normalTextColor == newNormalTextColor) return; m_normalTextColor = newNormalTextColor; emit normalTextColorChanged(); } int UKUITextArea::borderWidth() const { return m_borderWidth; } void UKUITextArea::setBorderWidth(int newBorderWidth) { if (m_borderWidth == newBorderWidth) return; m_borderWidth = newBorderWidth; emit borderWidthChanged(); } int UKUITextArea::focusBorderWidth() const { return m_focusBorderWidth; } void UKUITextArea::setFocusBorderWidth(int newFocusBorderWidth) { if (m_focusBorderWidth == newFocusBorderWidth) return; m_focusBorderWidth = newFocusBorderWidth; emit focusBorderWidthChanged(); } const QBrush &UKUITextArea::normalBorderColor() const { return m_normalBorderColor; } void UKUITextArea::setNormalBorderColor(const QBrush &newNormalBorderColor) { if (m_normalBorderColor == newNormalBorderColor) return; m_normalBorderColor = newNormalBorderColor; emit normalBorderColorChanged(); } const QBrush &UKUITextArea::clickBorderColor() const { return m_clickBorderColor; } void UKUITextArea::setClickBorderColor(const QBrush &newClickBorderColor) { if (m_clickBorderColor == newClickBorderColor) return; m_clickBorderColor = newClickBorderColor; emit clickBorderColorChanged(); } const QBrush &UKUITextArea::disableBorderColor() const { return m_disableBorderColor; } void UKUITextArea::setDisableBorderColor(const QBrush &newDisableBorderColor) { if (m_disableBorderColor == newDisableBorderColor) return; m_disableBorderColor = newDisableBorderColor; emit disableBorderColorChanged(); } const QBrush &UKUITextArea::focusBorderColor() const { return m_focusBorderColor; } void UKUITextArea::setFocusBorderColor(const QBrush &newFocusBorderColor) { if (m_focusBorderColor == newFocusBorderColor) return; m_focusBorderColor = newFocusBorderColor; emit focusBorderColorChanged(); } const QBrush &UKUITextArea::hoverBorderColor() const { return m_hoverBorderColor; } void UKUITextArea::setHoverBorderColor(const QBrush &newHoverBorderColor) { if (m_hoverBorderColor == newHoverBorderColor) return; m_hoverBorderColor = newHoverBorderColor; emit hoverBorderColorChanged(); } const QBrush &UKUITextArea::placeHolderNormalTextColor() const { return m_placeHolderNormalTextColor; } void UKUITextArea::setPlaceHolderNormalTextColor(const QBrush &newPlaceHolderNormalTextColor) { if (m_placeHolderNormalTextColor == newPlaceHolderNormalTextColor) return; m_placeHolderNormalTextColor = newPlaceHolderNormalTextColor; emit placeHolderNormalTextColorChanged(); } const QBrush &UKUITextArea::placeHolderDisableTextColor() const { return m_placeHolderDisableTextColor; } void UKUITextArea::setPlaceHolderDisableTextColor(const QBrush &newPlaceHolderDisableTextColor) { if (m_placeHolderDisableTextColor == newPlaceHolderDisableTextColor) return; m_placeHolderDisableTextColor = newPlaceHolderDisableTextColor; emit placeHolderDisableTextColorChanged(); } const QBrush &UKUITextArea::inputNormalBC() const { return m_inputNormalBC; } void UKUITextArea::setInputNormalBC(const QBrush &newInputNormalBC) { if (m_inputNormalBC == newInputNormalBC) return; m_inputNormalBC = newInputNormalBC; emit inputNormalBCChanged(); } const QBrush &UKUITextArea::normalTransparentBC() const { return m_normalTransparentBC; } void UKUITextArea::setNormalTransparentBC(const QBrush &newNormalTransparentBC) { if (m_normalTransparentBC == newNormalTransparentBC) return; m_normalTransparentBC = newNormalTransparentBC; emit normalTransparentBCChanged(); } const QBrush &UKUITextArea::inputNormalTransparentBC() const { return m_inputNormalTransparentBC; } void UKUITextArea::setInputNormalTransparentBC(const QBrush &newInputNormalTransparentBC) { if (m_inputNormalTransparentBC == newInputNormalTransparentBC) return; m_inputNormalTransparentBC = newInputNormalTransparentBC; emit inputNormalTransparentBCChanged(); } const QBrush &UKUITextArea::clickedTransparentBC() const { return m_clickedTransparentBC; } void UKUITextArea::setClickedTransparentBC(const QBrush &newClickedTransparentBC) { if (m_clickedTransparentBC == newClickedTransparentBC) return; m_clickedTransparentBC = newClickedTransparentBC; emit clickedTransparentBCChanged(); } const QBrush &UKUITextArea::hoveredTransparentBC() const { return m_hoveredTransparentBC; } void UKUITextArea::setHoveredTransparentBC(const QBrush &newHoveredTransparentBC) { if (m_hoveredTransparentBC == newHoveredTransparentBC) return; m_hoveredTransparentBC = newHoveredTransparentBC; emit hoveredTransparentBCChanged(); } const QBrush &UKUITextArea::disableTransparentBC() const { return m_disableTransparentBC; } void UKUITextArea::setDisableTransparentBC(const QBrush &newDisableTransparentBC) { if (m_disableTransparentBC == newDisableTransparentBC) return; m_disableTransparentBC = newDisableTransparentBC; emit disableTransparentBCChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuimenuitem.h0000664000175000017500000004437215154306200026152 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUIMENUITEM_H #define UKUIMENUITEM_H #include #include #include #include #include #include #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(QBrush normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged) Q_PROPERTY(QBrush clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged) Q_PROPERTY(QBrush hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged) Q_PROPERTY(QBrush disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged) Q_PROPERTY(QBrush disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(QBrush normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) Q_PROPERTY(QBrush normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged) Q_PROPERTY(QBrush hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged) Q_PROPERTY(QBrush clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged) Q_PROPERTY(QBrush disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged) Q_PROPERTY(QBrush normalTransparentBC READ normalTransparentBC WRITE setNormalTransparentBC NOTIFY normalTransparentBCChanged) Q_PROPERTY(QBrush clickedTransparentBC READ clickedTransparentBC WRITE setClickedTransparentBC NOTIFY clickedTransparentBCChanged) Q_PROPERTY(QBrush hoveredTransparentBC READ hoveredTransparentBC WRITE setHoveredTransparentBC NOTIFY hoveredTransparentBCChanged) Q_PROPERTY(QBrush disableTransparentBC READ disableTransparentBC WRITE setDisableTransparentBC NOTIFY disableTransparentBCChanged) Q_PROPERTY(QBrush normalTransparentBorderColor READ normalTransparentBorderColor WRITE setNormalTransparentBorderColor NOTIFY normalTransparentBorderColorChanged) Q_PROPERTY(QBrush hoverTransparentBorderColor READ hoverTransparentBorderColor WRITE setHoverTransparentBorderColor NOTIFY hoverTransparentBorderColorChanged) Q_PROPERTY(QBrush clickTransparentBorderColor READ clickTransparentBorderColor WRITE setClickTransparentBorderColor NOTIFY clickTransparentBorderColorChanged) Q_PROPERTY(QBrush disableTransparentBorderColor READ disableTransparentBorderColor WRITE setDisableTransparentBorderColor NOTIFY disableTransparentBorderColorChanged) Q_PROPERTY(QBrush normalCheckedBC READ normalCheckedBC WRITE setNormalCheckedBC NOTIFY normalCheckedBCChanged) Q_PROPERTY(QBrush clickedCheckedBC READ clickedCheckedBC WRITE setClickedCheckedBC NOTIFY clickedCheckedBCChanged) Q_PROPERTY(QBrush hoveredCheckedBC READ hoveredCheckedBC WRITE setHoveredCheckedBC NOTIFY hoveredCheckedBCChanged) Q_PROPERTY(QBrush disableCheckedBC READ disableCheckedBC WRITE setDisableCheckedBC NOTIFY disableCheckedBCChanged) Q_PROPERTY(QBrush normalBorderCheckedColor READ normalBorderCheckedColor WRITE setNormalBorderCheckedColor NOTIFY normalBorderCheckedColorChanged) Q_PROPERTY(QBrush hoverBorderCheckedColor READ hoverBorderCheckedColor WRITE setHoverBorderCheckedColor NOTIFY hoverBorderCheckedColorChanged) Q_PROPERTY(QBrush clickBorderCheckedColor READ clickBorderCheckedColor WRITE setClickBorderCheckedColor NOTIFY clickBorderCheckedColorChanged) Q_PROPERTY(QBrush disableBorderCheckedColor READ disableBorderCheckedColor WRITE setDisableBorderCheckedColor NOTIFY disableBorderCheckedColorChanged) Q_PROPERTY(QBrush normalCheckedTransparentBC READ normalCheckedTransparentBC WRITE setNormalCheckedTransparentBC NOTIFY normalCheckedTransparentBCChanged) Q_PROPERTY(QBrush clickedCheckedTransparentBC READ clickedCheckedTransparentBC WRITE setClickedCheckedTransparentBC NOTIFY clickedCheckedTransparentBCChanged) Q_PROPERTY(QBrush hoveredCheckedTransparentBC READ hoveredCheckedTransparentBC WRITE setHoveredCheckedTransparentBC NOTIFY hoveredCheckedTransparentBCChanged) Q_PROPERTY(QBrush disableCheckedTransparentBC READ disableCheckedTransparentBC WRITE setDisableCheckedTransparentBC NOTIFY disableCheckedTransparentBCChanged) Q_PROPERTY(QBrush normalBorderCheckedTransparentColor READ normalBorderCheckedTransparentColor WRITE setNormalBorderCheckedTransparentColor NOTIFY normalBorderCheckedColorTransparentChanged) Q_PROPERTY(QBrush hoverBorderCheckedTransparentColor READ hoverBorderCheckedTransparentColor WRITE setHoverBorderCheckedTransparentColor NOTIFY hoverBorderCheckedColorTransparentChanged) Q_PROPERTY(QBrush clickBorderCheckedTransparentColor READ clickBorderCheckedTransparentColor WRITE setClickBorderCheckedTransparentColor NOTIFY clickBorderCheckedColorTransparentChanged) Q_PROPERTY(QBrush disableBorderCheckedTransparentColor READ disableBorderCheckedTransparentColor WRITE setDisableBorderCheckedTransparentColor NOTIFY disableBorderCheckedColorTransparentChanged) Q_PROPERTY(QBrush normalHTextColor READ normalHTextColor WRITE setNormalHTextColor NOTIFY normalHTextColorChanged) Q_PROPERTY(QBrush disableHTextColor READ disableHTextColor WRITE setDisableHTextColor NOTIFY disableHTextColorChanged) Q_PROPERTY(QBrush normalCheckedHBC READ normalCheckedHBC WRITE setNormalCheckedHBC NOTIFY normalCheckedHBCChanged) Q_PROPERTY(QBrush clickedCheckedHBC READ clickedCheckedHBC WRITE setClickedCheckedHBC NOTIFY clickedCheckedHBCChanged) Q_PROPERTY(QBrush hoveredCheckedHBC READ hoveredCheckedHBC WRITE setHoveredCheckedHBC NOTIFY hoveredCheckedHBCChanged) Q_PROPERTY(QBrush disableCheckedHBC READ disableCheckedHBC WRITE setDisableCheckedHBC NOTIFY disableCheckedHBCChanged) Q_PROPERTY(QBrush normalCheckedHBorderColor READ normalCheckedHBorderColor WRITE setNormalCheckedHBorderColor NOTIFY normalCheckedHBorderColorChanged) Q_PROPERTY(QBrush clickedCheckedHBorderColor READ clickedCheckedHBorderColor WRITE setClickedCheckedHBorderColor NOTIFY clickedCheckedHBorderColorChanged) Q_PROPERTY(QBrush hoveredCheckedHBorderColor READ hoveredCheckedHBorderColor WRITE setHoveredCheckedHBorderColor NOTIFY hoveredCheckedHBorderColorChanged) Q_PROPERTY(QBrush disableCheckedHBorderColor READ disableCheckedHBorderColor WRITE setDisableCheckedHBorderColor NOTIFY disableCheckedHBorderColorChanged) Q_PROPERTY(QBrush menuSeparatorColor READ menuSeparatorColor WRITE setMenuSeparatorColor NOTIFY menuSeparatorColorChanged) 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 QBrush &normalBC() const; void setNormalBC(const QBrush &newNormalBC); const QBrush &clickedBC() const; void setClickedBC(const QBrush &newClickedBC); const QBrush &hoveredBC() const; void setHoveredBC(const QBrush &newHoveredBC); const QBrush &disableBC() const; void setDisableBC(const QBrush &newDisableBC); const QBrush &disableTextColor() const; void setDisableTextColor(const QBrush &newDisableTextColor); const QBrush &normalTextColor() const; void setNormalTextColor(const QBrush &newNormalTextColor); int borderWidth() const; void setBorderWidth(int newBorderWidth); const QBrush &normalBorderColor() const; void setNormalBorderColor(const QBrush &newNormalBorderColor); const QBrush &hoverBorderColor() const; void setHoverBorderColor(const QBrush &newHoverBorderColor); const QBrush &clickBorderColor() const; void setClickBorderColor(const QBrush &newClickBorderColor); const QBrush &disableBorderColor() const; void setDisableBorderColor(const QBrush &newDisableBorderColor); const QBrush &normalTransparentBC() const; void setNormalTransparentBC(const QBrush &newNormalTransparentBC); const QBrush &clickedTransparentBC() const; void setClickedTransparentBC(const QBrush &newClickedTransparentBC); const QBrush &hoveredTransparentBC() const; void setHoveredTransparentBC(const QBrush &newHoveredTransparentBC); const QBrush &disableTransparentBC() const; void setDisableTransparentBC(const QBrush &newDisableTransparentBC); const QBrush &normalTransparentBorderColor() const; void setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor); const QBrush &hoverTransparentBorderColor() const; void setHoverTransparentBorderColor(const QBrush &newHoverTransparentBorderColor); const QBrush &clickTransparentBorderColor() const; void setClickTransparentBorderColor(const QBrush &newClickTransparentBorderColor); const QBrush &disableTransparentBorderColor() const; void setDisableTransparentBorderColor(const QBrush &newDisableTransparentBorderColor); const QBrush &normalCheckedBC() const; void setNormalCheckedBC(const QBrush &newNormalCheckedBC); const QBrush &clickedCheckedBC() const; void setClickedCheckedBC(const QBrush &newClickedCheckedBC); const QBrush &hoveredCheckedBC() const; void setHoveredCheckedBC(const QBrush &newHoveredCheckedBC); const QBrush &disableCheckedBC() const; void setDisableCheckedBC(const QBrush &newDisableCheckedBC); const QBrush &normalBorderCheckedColor() const; void setNormalBorderCheckedColor(const QBrush &newNormalBorderCheckedColor); const QBrush &hoverBorderCheckedColor() const; void setHoverBorderCheckedColor(const QBrush &newHoverBorderCheckedColor); const QBrush &clickBorderCheckedColor() const; void setClickBorderCheckedColor(const QBrush &newClickBorderCheckedColor); const QBrush &disableBorderCheckedColor() const; void setDisableBorderCheckedColor(const QBrush &newDisableBorderCheckedColor); const QBrush &normalHTextColor() const; void setNormalHTextColor(const QBrush &newNormalHTextColor); const QBrush &disableHTextColor() const; void setDisableHTextColor(const QBrush &newDisableHTextColor); const QBrush &normalCheckedHBC() const; void setNormalCheckedHBC(const QBrush &newNormalCheckedHBC); const QBrush &clickedCheckedHBC() const; void setClickedCheckedHBC(const QBrush &newClickedCheckedHBC); const QBrush &hoveredCheckedHBC() const; void setHoveredCheckedHBC(const QBrush &newHoveredCheckedHBC); const QBrush &disableCheckedHBC() const; void setDisableCheckedHBC(const QBrush &newDisableCheckedHBC); const QBrush &normalCheckedHBorderColor() const; void setNormalCheckedHBorderColor(const QBrush &newNormalCheckedHBorderColor); const QBrush &clickedCheckedHBorderColor() const; void setClickedCheckedHBorderColor(const QBrush &newClickedCheckedHBorderColor); const QBrush &hoveredCheckedHBorderColor() const; void setHoveredCheckedHBorderColor(const QBrush &newHoveredCheckedHBorderColor); const QBrush &disableCheckedHBorderColor() const; void setDisableCheckedHBorderColor(const QBrush &newDisableCheckedHBorderColor); const QBrush &normalCheckedTransparentBC() const; void setNormalCheckedTransparentBC(const QBrush &newNormalCheckedTransparentBC); const QBrush &clickedCheckedTransparentBC() const; void setClickedCheckedTransparentBC(const QBrush &newClickedCheckedTransparentBC); const QBrush &hoveredCheckedTransparentBC() const; void setHoveredCheckedTransparentBC(const QBrush &newHoveredCheckedTransparentBC); const QBrush &disableCheckedTransparentBC() const; void setDisableCheckedTransparentBC(const QBrush &newDisableCheckedTransparentBC); const QBrush &normalBorderCheckedTransparentColor() const; void setNormalBorderCheckedTransparentColor(const QBrush &newNormalBorderCheckedTransparentColor); const QBrush &hoverBorderCheckedTransparentColor() const; void setHoverBorderCheckedTransparentColor(const QBrush &newHoverBorderCheckedTransparentColor); const QBrush &clickBorderCheckedTransparentColor() const; void setClickBorderCheckedTransparentColor(const QBrush &newClickBorderCheckedTransparentColor); const QBrush &disableBorderCheckedTransparentColor() const; void setDisableBorderCheckedTransparentColor(const QBrush &newDisableBorderCheckedTransparentColor); const QBrush &menuSeparatorColor() const; void setMenuSeparatorColor(const QBrush &newMenuSeparatorColor); 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(); void parametryChanged(); void normalTransparentBCChanged(); void clickedTransparentBCChanged(); void hoveredTransparentBCChanged(); void disableTransparentBCChanged(); void normalTransparentBorderColorChanged(); void hoverTransparentBorderColorChanged(); void clickTransparentBorderColorChanged(); void disableTransparentBorderColorChanged(); void normalCheckedBCChanged(); void clickedCheckedBCChanged(); void hoveredCheckedBCChanged(); void disableCheckedBCChanged(); void normalBorderCheckedColorChanged(); void hoverBorderCheckedColorChanged(); void clickBorderCheckedColorChanged(); void disableBorderCheckedColorChanged(); void normalHTextColorChanged(); void disableHTextColorChanged(); void normalCheckedHBCChanged(); void clickedCheckedHBCChanged(); void hoveredCheckedHBCChanged(); void disableCheckedHBCChanged(); void normalCheckedHBorderColorChanged(); void clickedCheckedHBorderColorChanged(); void hoveredCheckedHBorderColorChanged(); void disableCheckedHBorderColorChanged(); void normalCheckedTransparentBCChanged(); void clickedCheckedTransparentBCChanged(); void hoveredCheckedTransparentBCChanged(); void disableCheckedTransparentBCChanged(); void normalBorderCheckedColorTransparentChanged(); void hoverBorderCheckedColorTransparentChanged(); void clickBorderCheckedColorTransparentChanged(); void disableBorderCheckedColorTransparentChanged(); void menuSeparatorColorChanged(); 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; Q_INVOKABLE QBrush m_normalBC; Q_INVOKABLE QBrush m_clickedBC; Q_INVOKABLE QBrush m_hoveredBC; Q_INVOKABLE QBrush m_disableBC; Q_INVOKABLE QBrush m_disableTextColor; Q_INVOKABLE QBrush m_normalTextColor; int m_borderWidth; Q_INVOKABLE QBrush m_normalBorderColor; Q_INVOKABLE QBrush m_hoverBorderColor; Q_INVOKABLE QBrush m_clickBorderColor; Q_INVOKABLE QBrush m_disableBorderColor; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_normalTransparentBC; QBrush m_clickedTransparentBC; QBrush m_hoveredTransparentBC; QBrush m_disableTransparentBC; QBrush m_normalTransparentBorderColor; QBrush m_hoverTransparentBorderColor; QBrush m_clickTransparentBorderColor; QBrush m_disableTransparentBorderColor; QBrush m_normalCheckedBC; QBrush m_clickedCheckedBC; QBrush m_hoveredCheckedBC; QBrush m_disableCheckedBC; QBrush m_normalBorderCheckedColor; QBrush m_hoverBorderCheckedColor; QBrush m_clickBorderCheckedColor; QBrush m_disableBorderCheckedColor; QBrush m_normalHTextColor; QBrush m_disableHTextColor; QBrush m_normalCheckedHBC; QBrush m_clickedCheckedHBC; QBrush m_hoveredCheckedHBC; QBrush m_disableCheckedHBC; QBrush m_normalCheckedHBorderColor; QBrush m_clickedCheckedHBorderColor; QBrush m_hoveredCheckedHBorderColor; QBrush m_disableCheckedHBorderColor; QBrush m_normalCheckedTransparentBC; QBrush m_clickedCheckedTransparentBC; QBrush m_hoveredCheckedTransparentBC; QBrush m_disableCheckedTransparentBC; QBrush m_normalBorderCheckedTransparentColor; QBrush m_hoverBorderCheckedTransparentColor; QBrush m_clickBorderCheckedTransparentColor; QBrush m_disableBorderCheckedTransparentColor; QBrush m_menuSeparatorColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIMenuItem, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUIMENUITEM_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuipopup.h0000664000175000017500000000723615154306200025470 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUIPOPUP_H #define UKUIPOPUP_H #include #include #include #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUIPopup : public QQuickItem { Q_OBJECT Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged) Q_PROPERTY(QBrush normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged) Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged) Q_PROPERTY(QBrush backColor READ backColor WRITE setBackColor NOTIFY backColorChanged) Q_PROPERTY(QBrush backBorderColor READ backBorderColor WRITE setBackBorderColor NOTIFY backBorderColorChanged) Q_PROPERTY(QBrush shadowColor READ shadowColor WRITE setShadowColor NOTIFY shadowColorChanged) Q_PROPERTY(QBrush transparentBC READ transparentBC WRITE setTransparentBC NOTIFY transparentBCChanged) Q_PROPERTY(QBrush transparentBorderColor READ transparentBorderColor WRITE setTransparentBorderColor NOTIFY transparentBorderColorChanged) public: explicit UKUIPopup(QQuickItem *parent = nullptr); ~UKUIPopup(); void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance); static UKUIPopup* qmlAttachedProperties(QObject* parent); const QBrush &normalColor() const; void setNormalColor(const QBrush &newNormalColor); int padding() const; void setPadding(int newPadding); const QBrush &backColor() const; void setBackColor(const QBrush &newBackColor); const QBrush &backBorderColor() const; void setBackBorderColor(const QBrush &newBackBorderColor); const QBrush &shadowColor() const; void setShadowColor(const QBrush &newShadowColor); int radius() const; void setRadius(int newRadius); const QBrush &transparentBC() const; void setTransparentBC(const QBrush &newTransparentBC); const QBrush &transparentBorderColor() const; void setTransparentBorderColor(const QBrush &newTransparentBorderColor); signals: void normalColorChanged(); void paddingChanged(); void backColorChanged(); void backBorderColorChanged(); void shadowColorChanged(); void radiusChanged(); void parametryChanged(); void transparentBCChanged(); void transparentBorderColorChanged(); private: Q_INVOKABLE QBrush m_normalColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.85)); int m_padding = 8; Q_INVOKABLE QBrush m_backColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.85)); Q_INVOKABLE QBrush m_backBorderColor = QBrush(QColor::fromRgbF(1, 1, 1)); Q_INVOKABLE QBrush m_shadowColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.3)); int m_radius; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_transparentBC; QBrush m_transparentBorderColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIPopup, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUIPOPUP_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuilabel.cpp0000664000175000017500000000333715154306200025735 0ustar fengfeng#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(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUILabel::~UKUILabel() { } void UKUILabel::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setNormalColor(instance->textActive()); setDisableColor(instance->textDisable()); emit parametryChanged(); } UKUILabel* UKUILabel::qmlAttachedProperties(QObject *parent) { auto p = qobject_cast(parent); return new UKUILabel(p); } const QBrush &UKUILabel::normalColor() const { return m_normalColor; } void UKUILabel::setNormalColor(const QBrush &newNormalColor) { if (m_normalColor == newNormalColor) return; m_normalColor = newNormalColor; emit normalColorChanged(); } const QBrush &UKUILabel::linkColor() const { return m_linkColor; } void UKUILabel::setLinkColor(const QBrush &newLinkColor) { if (m_linkColor == newLinkColor) return; m_linkColor = newLinkColor; emit linkColorChanged(); } const QBrush &UKUILabel::disableColor() const { return m_disableColor; } void UKUILabel::setDisableColor(const QBrush &newDisableColor) { if (m_disableColor == newDisableColor) return; m_disableColor = newDisableColor; emit disableColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuitabbutton.cpp0000664000175000017500000001455315154306200026662 0ustar fengfeng#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(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUITabButton::~UKUITabButton() { } void UKUITabButton::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setNormalColor(QBrush(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()); setNormalTransparentColor(QBrush(QColor(0,0,0,0))); setHoverTransparentColor(instance->kContainAlphaHover()); setClickedTransparentColor(instance->kContainAlphaClick()); setCheckedTransparentColor(instance->kContainGeneralNormal()); setFocusBorderColor(instance->kBrandFocus()); emit parametryChanged(); } UKUITabButton* UKUITabButton::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUITabButton(p); } const QBrush &UKUITabButton::normalColor() const { return m_normalColor; } void UKUITabButton::setNormalColor(const QBrush &newNormalColor) { if (m_normalColor == newNormalColor) return; m_normalColor = newNormalColor; emit normalColorChanged(); } const QBrush &UKUITabButton::hoverColor() const { return m_hoverColor; } void UKUITabButton::setHoverColor(const QBrush &newHoverColor) { if (m_hoverColor == newHoverColor) return; m_hoverColor = newHoverColor; emit hoverColorChanged(); } const QBrush &UKUITabButton::checkedColor() const { return m_checkedColor; } void UKUITabButton::setCheckedColor(const QBrush &newCheckedColor) { if (m_checkedColor == newCheckedColor) return; m_checkedColor = newCheckedColor; emit checkedColorChanged(); } const QBrush &UKUITabButton::clickedColor() const { return m_clickedColor; } void UKUITabButton::setClickedColor(const QBrush &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 QBrush &UKUITabButton::normalBorderColor() const { return m_normalBorderColor; } void UKUITabButton::setNormalBorderColor(const QBrush &newNormalBorderColor) { if (m_normalBorderColor == newNormalBorderColor) return; m_normalBorderColor = newNormalBorderColor; emit normalBorderColorChanged(); } const QBrush &UKUITabButton::hoverBorderColor() const { return m_hoverBorderColor; } void UKUITabButton::setHoverBorderColor(const QBrush &newHoverBorderColor) { if (m_hoverBorderColor == newHoverBorderColor) return; m_hoverBorderColor = newHoverBorderColor; emit hoverBorderColorChanged(); } const QBrush &UKUITabButton::clickBorderColor() const { return m_clickBorderColor; } void UKUITabButton::setClickBorderColor(const QBrush &newClickBorderColor) { if (m_clickBorderColor == newClickBorderColor) return; m_clickBorderColor = newClickBorderColor; emit clickBorderColorChanged(); } const QBrush &UKUITabButton::checkedBorderColor() const { return m_checkedBorderColor; } void UKUITabButton::setCheckedBorderColor(const QBrush &newCheckedBorderColor) { if (m_checkedBorderColor == newCheckedBorderColor) return; m_checkedBorderColor = newCheckedBorderColor; emit checkedBorderColorChanged(); } const QBrush &UKUITabButton::normalTextColor() const { return m_normalTextColor; } void UKUITabButton::setNormalTextColor(const QBrush &newNormalTextColor) { if (m_normalTextColor == newNormalTextColor) return; m_normalTextColor = newNormalTextColor; emit disableTextColorChanged(); } const QBrush &UKUITabButton::normalTransparentColor() const { return m_normalTransparentColor; } void UKUITabButton::setNormalTransparentColor(const QBrush &newNormalTransparentColor) { if (m_normalTransparentColor == newNormalTransparentColor) return; m_normalTransparentColor = newNormalTransparentColor; emit normalTransparentColorChanged(); } const QBrush &UKUITabButton::hoverTransparentColor() const { return m_hoverTransparentColor; } void UKUITabButton::setHoverTransparentColor(const QBrush &newHoverTransparentColor) { if (m_hoverTransparentColor == newHoverTransparentColor) return; m_hoverTransparentColor = newHoverTransparentColor; emit hoverTransparentColorChanged(); } const QBrush &UKUITabButton::checkedTransparentColor() const { return m_checkedTransparentColor; } void UKUITabButton::setCheckedTransparentColor(const QBrush &newCheckedTransparentColor) { if (m_checkedTransparentColor == newCheckedTransparentColor) return; m_checkedTransparentColor = newCheckedTransparentColor; emit checkedTransparentColorChanged(); } const QBrush &UKUITabButton::clickedTransparentColor() const { return m_clickedTransparentColor; } void UKUITabButton::setClickedTransparentColor(const QBrush &newClickedTransparentColor) { if (m_clickedTransparentColor == newClickedTransparentColor) return; m_clickedTransparentColor = newClickedTransparentColor; emit clickedTransparentColorChanged(); } const QBrush &UKUITabButton::focusBorderColor() const { return m_focusBorderColor; } void UKUITabButton::setFocusBorderColor(const QBrush &newFocusBorderColor) { if (m_focusBorderColor == newFocusBorderColor) return; m_focusBorderColor = newFocusBorderColor; emit focusBorderColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuimenu.cpp0000664000175000017500000001172715154306200025624 0ustar fengfeng#include "ukuimenu.h" #include "qdebug.h" #include "settings/ukui-style-settings.h" using namespace UKUIQQC2Style; UKUIMenu::UKUIMenu(QQuickItem *parent) : QQuickItem(parent) { if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); if (QGSettings::isSchemaInstalled("org.ukui.style")) { auto settings = UKUIStyleSettings::globalInstance(); connect(settings, &QGSettings::changed, this, [&](const QString& key){ if(key == "menuTransparency" || key == "menu-transparency") initParam(m_instance); }, Qt::UniqueConnection); } } } UKUIMenu::~UKUIMenu() { } void UKUIMenu::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setshadowNormalColor(instance->shadowActive()); setshadowDisableColor(instance->shadowDisable()); setNormalBorderColor(instance->kLineWindowActive()); setBorder(instance->normalline()); setRadius(instance->kradiusMenu()); QColor c = instance->baseActive().color(); if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { auto opacity = UKUIStyleSettings::globalInstance()->get("menuTransparency").toInt()/100.0; c.setAlphaF(opacity); setBcColorAlpha(opacity); } setNormalBC(instance->kContainGeneralNormal()); setNormalTransparentBC(c); setNormalTransparentBorderColor(instance->kLineWindowActive()); emit parametryChanged(); } UKUIMenu* UKUIMenu::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(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 QBrush &UKUIMenu::shadowNormalColor() const { return m_shadowNormalColor; } void UKUIMenu::setshadowNormalColor(const QBrush &newshadowNormalColor) { if (m_shadowNormalColor == newshadowNormalColor) return; m_shadowNormalColor = newshadowNormalColor; emit shadowNormalColorChanged(); } const QBrush &UKUIMenu::shadowDisableColor() const { return m_shadowDisableColor; } void UKUIMenu::setshadowDisableColor(const QBrush &newShadowDisableColor) { if (m_shadowDisableColor == newShadowDisableColor) return; m_shadowDisableColor = newShadowDisableColor; emit shadowDisableColorChanged(); } const QBrush &UKUIMenu::normalBC() const { return m_normalBC; } void UKUIMenu::setNormalBC(const QBrush &newNormalBC) { if (m_normalBC == newNormalBC) return; m_normalBC = newNormalBC; emit normalBCChanged(); } const QBrush &UKUIMenu::normalBorderColor() const { return m_normalBorderColor; } void UKUIMenu::setNormalBorderColor(const QBrush &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(); } double UKUIMenu::bcColorAlpha() const { return m_bcColorAlpha; } void UKUIMenu::setBcColorAlpha(double newBcColorAlpha) { if (qFuzzyCompare(m_bcColorAlpha, newBcColorAlpha)) return; m_bcColorAlpha = newBcColorAlpha; emit bcColorAlphaChanged(); } void UKUIMenu::setNormalTransparentBC(const QBrush &newNormalTransparentBC) { if (m_normalTransparentBC == newNormalTransparentBC) return; m_normalTransparentBC = newNormalTransparentBC; emit normalTransparentBCChanged(); } const QBrush &UKUIMenu::normalTransparentBorderColor() const { return m_normalTransparentBorderColor; } void UKUIMenu::setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor) { if (m_normalTransparentBorderColor == newNormalTransparentBorderColor) return; m_normalTransparentBorderColor = newNormalTransparentBorderColor; emit normalTransparentBorderColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiradiobutton.cpp0000664000175000017500000004612015154306200027205 0ustar fengfeng#include #include "ukuiradiobutton.h" #include "qdebug.h" using namespace UKUIQQC2Style; UKUIRadioButton::UKUIRadioButton(QQuickItem *parent) : QQuickItem(parent) { if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUIRadioButton::~UKUIRadioButton() { } UKUIRadioButton* UKUIRadioButton::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUIRadioButton(p); } void UKUIRadioButton::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setNormalTextColor(instance->kFontPrimary()); setDisableTextColor(instance->kFontPrimaryDisable()); setNormalIndicatorColor(instance->kComponentNormal()); setHoverIndicatorColor(instance->kComponentHover()); setClickIndicatorColor(instance->kComponentClick()); setDisableIndicatorColor(instance->kComponentDisable()); setNormalIndicatorBorderColor(instance->kLineSelectboxNormal()); setHoverIndicatorBorderColor(instance->kLineSelectboxHover()); setClickIndicatorBorderColor(instance->kLineSelectboxClick()); setDisableIndicatorBorderColor(instance->kLineSelectboxDisable()); setChecked_NormalIndicatorColor(instance->kBrandNormal()); setChecked_HoverIndicatorColor(instance->kBrandHover()); setChecked_ClickIndicatorColor(instance->kBrandClick()); setChecked_DisableIndicatorColor(instance->kBrandDisable()); setChecked_NormalIndicatorBorderColor(instance->kLineSelectboxNormal()); setChecked_HoverIndicatorBorderColor(instance->kLineSelectboxHover()); setChecked_ClickIndicatorBorderColor(instance->kLineSelectboxClick()); setChecked_DisableIndicatorBorderColor(instance->kLineSelectboxDisable()); setChecked_NormalChildrenColor(instance->kFontWhite()); setChecked_HoverChildrenColor(instance->kFontWhite()); setChecked_ClickChildrenColor(instance->kFontWhite()); setChecked_DisableChildrenColor(instance->kFontWhiteDisable()); setNormalTransparentIndicatorColor(instance->kComponentAlphaNormal()); setHoverTransparentIndicatorColor(instance->kComponentAlphaHover()); setClickTransparentIndicatorColor(instance->kComponentAlphaClick()); setDisableTransparentIndicatorColor(instance->kComponentAlphaDisable()); setNormalTransparentIndicatorBorderColor(instance->kLineSelectboxNormal()); setHoverTransparentIndicatorBorderColor(instance->kLineSelectboxHover()); setClickTransparentIndicatorBorderColor(instance->kLineSelectboxClick()); setDisableTransparentIndicatorBorderColor(instance->kLineSelectboxDisable()); setBorderWidth(instance->normalline()); setSpace(8); setIndicatorWidth(16); setChildrenWidth(6); emit parametryChanged(); } 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 QBrush &UKUIRadioButton::disableTextColor() const { return m_disableTextColor; } void UKUIRadioButton::setDisableTextColor(const QBrush &newDisableTextColor) { if (m_disableTextColor == newDisableTextColor) return; m_disableTextColor = newDisableTextColor; emit disableTextColorChanged(); } const QBrush &UKUIRadioButton::normalTextColor() const { return m_normalTextColor; } void UKUIRadioButton::setNormalTextColor(const QBrush &newNormalTextColor) { if (m_normalTextColor == newNormalTextColor) return; m_normalTextColor = newNormalTextColor; emit normalTextColorChanged(); } const QBrush &UKUIRadioButton::normalIndicatorColor() const { return m_normalIndicatorColor; } void UKUIRadioButton::setNormalIndicatorColor(const QBrush &newNormalIndicatorColor) { if (m_normalIndicatorColor == newNormalIndicatorColor) return; m_normalIndicatorColor = newNormalIndicatorColor; emit normalIndicatorColorChanged(); } const QBrush &UKUIRadioButton::hoverIndicatorColor() const { return m_hoverIndicatorColor; } void UKUIRadioButton::setHoverIndicatorColor(const QBrush &newHoverIndicatorColor) { if (m_hoverIndicatorColor == newHoverIndicatorColor) return; m_hoverIndicatorColor = newHoverIndicatorColor; emit hoverIndicatorColorChanged(); } const QBrush &UKUIRadioButton::clickIndicatorColor() const { return m_clickIndicatorColor; } void UKUIRadioButton::setClickIndicatorColor(const QBrush &newClickIndicatorColor) { if (m_clickIndicatorColor == newClickIndicatorColor) return; m_clickIndicatorColor = newClickIndicatorColor; emit clickIndicatorColorChanged(); } const QBrush &UKUIRadioButton::disableIndicatorColor() const { return m_disableIndicatorColor; } void UKUIRadioButton::setDisableIndicatorColor(const QBrush &newDisableIndicatorColor) { if (m_disableIndicatorColor == newDisableIndicatorColor) return; m_disableIndicatorColor = newDisableIndicatorColor; emit disableIndicatorColorChanged(); } const QBrush &UKUIRadioButton::normalIndicatorBorderColor() const { return m_normalIndicatorBorderColor; } void UKUIRadioButton::setNormalIndicatorBorderColor(const QBrush &newNormalIndicatorBorderColor) { if (m_normalIndicatorBorderColor == newNormalIndicatorBorderColor) return; m_normalIndicatorBorderColor = newNormalIndicatorBorderColor; emit normalIndicatorBorderColorChanged(); } const QBrush &UKUIRadioButton::hoverIndicatorBorderColor() const { return m_hoverIndicatorBorderColor; } void UKUIRadioButton::setHoverIndicatorBorderColor(const QBrush &newHoverIndicatorBorderColor) { if (m_hoverIndicatorBorderColor == newHoverIndicatorBorderColor) return; m_hoverIndicatorBorderColor = newHoverIndicatorBorderColor; emit hoverIndicatorBorderColorChanged(); } const QBrush &UKUIRadioButton::clickIndicatorBorderColor() const { return m_clickIndicatorBorderColor; } void UKUIRadioButton::setClickIndicatorBorderColor(const QBrush &newClickIndicatorBorderColor) { if (m_clickIndicatorBorderColor == newClickIndicatorBorderColor) return; m_clickIndicatorBorderColor = newClickIndicatorBorderColor; emit clickIndicatorBorderColorChanged(); } const QBrush &UKUIRadioButton::disableIndicatorBorderColor() const { return m_disableIndicatorBorderColor; } void UKUIRadioButton::setDisableIndicatorBorderColor(const QBrush &newDisableIndicatorBorderColor) { if (m_disableIndicatorBorderColor == newDisableIndicatorBorderColor) return; m_disableIndicatorBorderColor = newDisableIndicatorBorderColor; emit disableIndicatorBorderColorChanged(); } const QBrush &UKUIRadioButton::checked_normalIndicatorColor() const { return m_checked_normalIndicatorColor; } const QBrush &UKUIRadioButton::checked_hoverIndicatorColor() const { return m_checked_hoverIndicatorColor; } const QBrush &UKUIRadioButton::checked_clickIndicatorColor() const { return m_checked_clickIndicatorColor; } const QBrush &UKUIRadioButton::checked_disableIndicatorColor() const { return m_checked_disableIndicatorColor; } const QBrush &UKUIRadioButton::checked_normalIndicatorBorderColor() const { return m_checked_normalIndicatorBorderColor; } const QBrush &UKUIRadioButton::checked_hoverIndicatorBorderColor() const { return m_checked_hoverIndicatorBorderColor; } const QBrush &UKUIRadioButton::checked_clickIndicatorBorderColor() const { return m_checked_clickIndicatorBorderColor; } const QBrush &UKUIRadioButton::checked_disableIndicatorBorderColor() const { return m_checked_disableIndicatorBorderColor; } const QBrush &UKUIRadioButton::checked_normalChildrenColor() const { return m_checked_normalChildrenColor; } const QBrush &UKUIRadioButton::checked_hoverChildrenColor() const { return m_checked_hoverChildrenColor; } const QBrush &UKUIRadioButton::checked_clickChildrenColor() const { return m_checked_clickChildrenColor; } const QBrush &UKUIRadioButton::checked_disableChildrenColor() const { return m_checked_disableChildrenColor; } const QBrush &UKUIRadioButton::checked_normalChildrenBorderColor() const { return m_checked_normalChildrenBorderColor; } const QBrush &UKUIRadioButton::checked_hoverChildrenBorderColor() const { return m_checked_hoverChildrenBorderColor; } const QBrush &UKUIRadioButton::checked_clickChildrenBorderColor() const { return m_checked_clickChildrenBorderColor; } const QBrush &UKUIRadioButton::checked_disableChildrenBorderColor() const { return m_checked_disableChildrenBorderColor; } void UKUIRadioButton::setChecked_NormalIndicatorColor(const QBrush &newChecked_normalIndicatorColor) { if (m_checked_normalIndicatorColor == newChecked_normalIndicatorColor) return; m_checked_normalIndicatorColor = newChecked_normalIndicatorColor; emit checked_normalIndicatorColorChanged(); } void UKUIRadioButton::setChecked_HoverIndicatorColor(const QBrush &newChecked_hoverIndicatorColor) { if (m_checked_hoverIndicatorColor == newChecked_hoverIndicatorColor) return; m_checked_hoverIndicatorColor = newChecked_hoverIndicatorColor; emit checked_hoverIndicatorColorChanged(); } void UKUIRadioButton::setChecked_ClickIndicatorColor(const QBrush &newChecked_clickIndicatorColor) { if (m_checked_clickIndicatorColor == newChecked_clickIndicatorColor) return; m_checked_clickIndicatorColor = newChecked_clickIndicatorColor; emit checked_clickIndicatorColorChanged(); } void UKUIRadioButton::setChecked_DisableIndicatorColor(const QBrush &newChecked_disableIndicatorColor) { if (m_checked_disableIndicatorColor == newChecked_disableIndicatorColor) return; m_checked_disableIndicatorColor = newChecked_disableIndicatorColor; emit checked_disableIndicatorColorChanged(); } void UKUIRadioButton::setChecked_NormalIndicatorBorderColor(const QBrush &newChecked_normalIndicatorBorderColor) { if (m_checked_normalIndicatorBorderColor == newChecked_normalIndicatorBorderColor) return; m_checked_normalIndicatorBorderColor = newChecked_normalIndicatorBorderColor; emit checked_normalIndicatorBorderColorChanged(); } void UKUIRadioButton::setChecked_HoverIndicatorBorderColor(const QBrush &newChecked_hoverIndicatorBorderColor) { if (m_checked_hoverIndicatorBorderColor == newChecked_hoverIndicatorBorderColor) return; m_checked_hoverIndicatorBorderColor = newChecked_hoverIndicatorBorderColor; emit checked_hoverIndicatorBorderColorChanged(); } void UKUIRadioButton::setChecked_ClickIndicatorBorderColor(const QBrush &newChecked_clickIndicatorBorderColor) { if (m_checked_clickIndicatorBorderColor == newChecked_clickIndicatorBorderColor) return; m_checked_clickIndicatorBorderColor = newChecked_clickIndicatorBorderColor; emit checked_clickIndicatorBorderColorChanged(); } void UKUIRadioButton::setChecked_DisableIndicatorBorderColor(const QBrush &newChecked_disableIndicatorBorderColor) { if (m_checked_disableIndicatorBorderColor == newChecked_disableIndicatorBorderColor) return; m_checked_disableIndicatorBorderColor = newChecked_disableIndicatorBorderColor; emit checked_disableIndicatorBorderColorChanged(); } void UKUIRadioButton::setChecked_NormalChildrenColor(const QBrush &newChecked_normalChildrenColor) { if (m_checked_normalChildrenColor == newChecked_normalChildrenColor) return; m_checked_normalChildrenColor = newChecked_normalChildrenColor; emit checked_normalChildrenColorChanged(); } void UKUIRadioButton::setChecked_HoverChildrenColor(const QBrush &newChecked_hoverChildrenColor) { if (m_checked_hoverChildrenColor == newChecked_hoverChildrenColor) return; m_checked_hoverChildrenColor = newChecked_hoverChildrenColor; emit checked_hoverChildrenColorChanged(); } void UKUIRadioButton::setChecked_ClickChildrenColor(const QBrush &newChecked_clickChildrenColor) { if (m_checked_clickChildrenColor == newChecked_clickChildrenColor) return; m_checked_clickChildrenColor = newChecked_clickChildrenColor; emit checked_clickChildrenColorChanged(); } void UKUIRadioButton::setChecked_DisableChildrenColor(const QBrush &newChecked_disableChildrenColor) { if (m_checked_disableChildrenColor == newChecked_disableChildrenColor) return; m_checked_disableChildrenColor = newChecked_disableChildrenColor; emit checked_disableChildrenColorChanged(); } void UKUIRadioButton::setChecked_NormalChildrenBorderColor(const QBrush &newChecked_normalChildrenBorderColor) { if (m_checked_normalChildrenBorderColor == newChecked_normalChildrenBorderColor) return; m_checked_normalChildrenBorderColor = newChecked_normalChildrenBorderColor; emit checked_normalChildrenBorderColorChanged(); } void UKUIRadioButton::setChecked_HoverChildrenBorderColor(const QBrush &newChecked_hoverChildrenBorderColor) { if (m_checked_hoverChildrenBorderColor == newChecked_hoverChildrenBorderColor) return; m_checked_hoverChildrenBorderColor = newChecked_hoverChildrenBorderColor; emit checked_hoverChildrenBorderColorChanged(); } void UKUIRadioButton::setChecked_ClickChildrenBorderColor(const QBrush &newChecked_clickChildrenBorderColor) { if (m_checked_clickChildrenBorderColor == newChecked_clickChildrenBorderColor) return; m_checked_clickChildrenBorderColor = newChecked_clickChildrenBorderColor; emit checked_clickChildrenBorderColorChanged(); } void UKUIRadioButton::setChecked_DisableChildrenBorderColor(const QBrush &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(); } const QBrush &UKUIRadioButton::normalTransparentIndicatorColor() const { return m_normalTransparentIndicatorColor; } void UKUIRadioButton::setNormalTransparentIndicatorColor(const QBrush &newNormalTransparentIndicatorColor) { if (m_normalTransparentIndicatorColor == newNormalTransparentIndicatorColor) return; m_normalTransparentIndicatorColor = newNormalTransparentIndicatorColor; emit normalTransparentIndicatorColorChanged(); } const QBrush &UKUIRadioButton::hoverTransparentIndicatorColor() const { return m_hoverTransparentIndicatorColor; } void UKUIRadioButton::setHoverTransparentIndicatorColor(const QBrush &newHoverTransparentIndicatorColor) { if (m_hoverTransparentIndicatorColor == newHoverTransparentIndicatorColor) return; m_hoverTransparentIndicatorColor = newHoverTransparentIndicatorColor; emit hoverTransparentIndicatorColorChanged(); } const QBrush &UKUIRadioButton::clickTransparentIndicatorColor() const { return m_clickTransparentIndicatorColor; } void UKUIRadioButton::setClickTransparentIndicatorColor(const QBrush &newClickTransparentIndicatorColor) { if (m_clickTransparentIndicatorColor == newClickTransparentIndicatorColor) return; m_clickTransparentIndicatorColor = newClickTransparentIndicatorColor; emit clickTransparentIndicatorColorChanged(); } const QBrush &UKUIRadioButton::disableTransparentIndicatorColor() const { return m_disableTransparentIndicatorColor; } void UKUIRadioButton::setDisableTransparentIndicatorColor(const QBrush &newDisableTransparentIndicatorColor) { if (m_disableTransparentIndicatorColor == newDisableTransparentIndicatorColor) return; m_disableTransparentIndicatorColor = newDisableTransparentIndicatorColor; emit disableTransparentIndicatorColorChanged(); } const QBrush &UKUIRadioButton::normalTransparentIndicatorBorderColor() const { return m_normalTransparentIndicatorBorderColor; } void UKUIRadioButton::setNormalTransparentIndicatorBorderColor(const QBrush &newNormalTransparentIndicatorBorderColor) { if (m_normalTransparentIndicatorBorderColor == newNormalTransparentIndicatorBorderColor) return; m_normalTransparentIndicatorBorderColor = newNormalTransparentIndicatorBorderColor; emit normalTransparentIndicatorBorderColorChanged(); } const QBrush &UKUIRadioButton::hoverTransparentIndicatorBorderColor() const { return m_hoverTransparentIndicatorBorderColor; } void UKUIRadioButton::setHoverTransparentIndicatorBorderColor(const QBrush &newHoverTransparentIndicatorBorderColor) { if (m_hoverTransparentIndicatorBorderColor == newHoverTransparentIndicatorBorderColor) return; m_hoverTransparentIndicatorBorderColor = newHoverTransparentIndicatorBorderColor; emit hoverTransparentIndicatorBorderColorChanged(); } const QBrush &UKUIRadioButton::clickTransparentIndicatorBorderColor() const { return m_clickTransparentIndicatorBorderColor; } void UKUIRadioButton::setClickTransparentIndicatorBorderColor(const QBrush &newClickTransparentIndicatorBorderColor) { if (m_clickTransparentIndicatorBorderColor == newClickTransparentIndicatorBorderColor) return; m_clickTransparentIndicatorBorderColor = newClickTransparentIndicatorBorderColor; emit clickTransparentIndicatorBorderColorChanged(); } const QBrush &UKUIRadioButton::disableTransparentIndicatorBorderColor() const { return m_disableTransparentIndicatorBorderColor; } void UKUIRadioButton::setDisableTransparentIndicatorBorderColor(const QBrush &newDisableTransparentIndicatorBorderColor) { if (m_disableTransparentIndicatorBorderColor == newDisableTransparentIndicatorBorderColor) return; m_disableTransparentIndicatorBorderColor = newDisableTransparentIndicatorBorderColor; emit disableTransparentIndicatorBorderColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuitextfiled.h0000664000175000017500000002217215154306200026311 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUITEXTFILED_H #define UKUITEXTFILED_H #include #include #include #include #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(QBrush normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged) Q_PROPERTY(QBrush inputNormalBC READ inputNormalBC WRITE setInputNormalBC NOTIFY inputNormalBCChanged) Q_PROPERTY(QBrush clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged) Q_PROPERTY(QBrush hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged) Q_PROPERTY(QBrush disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged) Q_PROPERTY(QBrush placeHolderNormalTextColor READ placeHolderNormalTextColor WRITE setPlaceHolderNormalTextColor NOTIFY placeHolderNormalTextColorChanged) Q_PROPERTY(QBrush placeHolderDisableTextColor READ placeHolderDisableTextColor WRITE setPlaceHolderDisableTextColor NOTIFY placeHolderDisableTextColorChanged) Q_PROPERTY(QBrush disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(QBrush 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(QBrush normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged) Q_PROPERTY(QBrush hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged) Q_PROPERTY(QBrush clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged) Q_PROPERTY(QBrush disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged) Q_PROPERTY(QBrush focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged) Q_PROPERTY(QBrush normalTransparentBC READ normalTransparentBC WRITE setNormalTransparentBC NOTIFY normalTransparentBCChanged) Q_PROPERTY(QBrush inputNormalTransparentBC READ inputNormalTransparentBC WRITE setInputNormalTransparentBC NOTIFY inputNormalTransparentBCChanged) Q_PROPERTY(QBrush clickedTransparentBC READ clickedTransparentBC WRITE setClickedTransparentBC NOTIFY clickedTransparentBCChanged) Q_PROPERTY(QBrush hoveredTransparentBC READ hoveredTransparentBC WRITE setHoveredTransparentBC NOTIFY hoveredTransparentBCChanged) Q_PROPERTY(QBrush disableTransparentBC READ disableTransparentBC WRITE setDisableTransparentBC NOTIFY disableTransparentBCChanged) 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 QBrush &normalBC() const; void setNormalBC(const QBrush &newNormalBC); const QBrush &clickedBC() const; void setClickedBC(const QBrush &newClickedBC); const QBrush &hoveredBC() const; void setHoveredBC(const QBrush &newHoveredBC); const QBrush &disableBC() const; void setDisableBC(const QBrush &newDisableBC); const QBrush &disableTextColor() const; void setDisableTextColor(const QBrush &newDisableTextColor); const QBrush &normalTextColor() const; void setNormalTextColor(const QBrush &newNormalTextColor); int borderWidth() const; void setBorderWidth(int newBorderWidth); int focusBorderWidth() const; void setFocusBorderWidth(int newFocusBorderWidth); const QBrush &normalBorderColor() const; void setNormalBorderColor(const QBrush &newNormalBorderColor); const QBrush &clickBorderColor() const; void setClickBorderColor(const QBrush &newClickBorderColor); const QBrush &disableBorderColor() const; void setDisableBorderColor(const QBrush &newDisableBorderColor); const QBrush &focusBorderColor() const; void setFocusBorderColor(const QBrush &newFocusBorderColor); const QBrush &hoverBorderColor() const; void setHoverBorderColor(const QBrush &newHoverBorderColor); const QBrush &placeHolderNormalTextColor() const; void setPlaceHolderNormalTextColor(const QBrush &newPlaceHolderNormalTextColor); const QBrush &placeHolderDisableTextColor() const; void setPlaceHolderDisableTextColor(const QBrush &newPlaceHolderDisableTextColor); const QBrush &inputNormalBC() const; void setInputNormalBC(const QBrush &newInputNormalBC); const QBrush &normalTransparentBC() const; void setNormalTransparentBC(const QBrush &newNormalTransparentBC); const QBrush &inputNormalTransparentBC() const; void setInputNormalTransparentBC(const QBrush &newInputNormalTransparentBC); const QBrush &clickedTransparentBC() const; void setClickedTransparentBC(const QBrush &newClickedTransparentBC); const QBrush &hoveredTransparentBC() const; void setHoveredTransparentBC(const QBrush &newHoveredTransparentBC); const QBrush &disableTransparentBC() const; void setDisableTransparentBC(const QBrush &newDisableTransparentBC); 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 inputNormalBCChanged(); void parametryChanged(); void normalTransparentBCChanged(); void inputNormalTransparentBCChanged(); void clickedTransparentBCChanged(); void hoveredTransparentBCChanged(); void disableTransparentBCChanged(); private: double m_radius; double m_leftRightPadding; double m_upDownMargin; double m_space; int m_normalWidth; int m_normalHeight; Q_INVOKABLE QBrush m_normalBC; Q_INVOKABLE QBrush m_clickedBC; Q_INVOKABLE QBrush m_hoveredBC; Q_INVOKABLE QBrush m_disableBC; Q_INVOKABLE QBrush m_disableTextColor; Q_INVOKABLE QBrush m_normalTextColor; int m_borderWidth; int m_focusBorderWidth; Q_INVOKABLE QBrush m_normalBorderColor; Q_INVOKABLE QBrush m_clickBorderColor; Q_INVOKABLE QBrush m_disableBorderColor; Q_INVOKABLE QBrush m_focusBorderColor; Q_INVOKABLE QBrush m_hoverBorderColor; Q_INVOKABLE QBrush m_placeHolderNormalTextColor; Q_INVOKABLE QBrush m_placeHolderDisableTextColor; Q_INVOKABLE QBrush m_inputNormalBC; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_normalTransparentBC; QBrush m_inputNormalTransparentBC; QBrush m_clickedTransparentBC; QBrush m_hoveredTransparentBC; QBrush m_disableTransparentBC; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUITextFiled, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUITEXTFILED_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/parsecolorinterface.h0000664000175000017500000000335415154306200027456 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef PARSEDTCOLOR_H #define PARSEDTCOLOR_H #include #include "../../ukui-styles/readconfig.h" #include #include using namespace UKUIGlobalDTConfig; namespace UKUIQQC2Style { struct ColorStruct{ bool isSolidPattern = true; QColor startColor; QColor endColor; }; class ParseColorInterface : public QObject { Q_OBJECT public: explicit ParseColorInterface(QObject *parent = nullptr); static ParseColorInterface* qmlAttachedProperties(QObject* parent); Q_INVOKABLE bool isSolidPattern(QVariant dtColor); Q_INVOKABLE QColor startColor(QVariant dtColor); Q_INVOKABLE QColor endColor(QVariant dtColor); Q_INVOKABLE QString endString(QString s, QString lasts); Q_INVOKABLE QColor getDtColor(QVariant dtColorkey); }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::ParseColorInterface, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPEINFO(UKUIQQC2Style::ColorStruct, QML_HAS_ATTACHED_PROPERTIES) #endif // PARSEDTCOLOR_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuitextarea.h0000664000175000017500000002216215154306200026135 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUITEXTAREA_H #define UKUITEXTAREA_H #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUITextArea : 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(QBrush normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged) Q_PROPERTY(QBrush inputNormalBC READ inputNormalBC WRITE setInputNormalBC NOTIFY inputNormalBCChanged) Q_PROPERTY(QBrush clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged) Q_PROPERTY(QBrush hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged) Q_PROPERTY(QBrush disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged) Q_PROPERTY(QBrush placeHolderNormalTextColor READ placeHolderNormalTextColor WRITE setPlaceHolderNormalTextColor NOTIFY placeHolderNormalTextColorChanged) Q_PROPERTY(QBrush placeHolderDisableTextColor READ placeHolderDisableTextColor WRITE setPlaceHolderDisableTextColor NOTIFY placeHolderDisableTextColorChanged) Q_PROPERTY(QBrush disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(QBrush 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(QBrush normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged) Q_PROPERTY(QBrush hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged) Q_PROPERTY(QBrush clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged) Q_PROPERTY(QBrush disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged) Q_PROPERTY(QBrush focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged) Q_PROPERTY(QBrush normalTransparentBC READ normalTransparentBC WRITE setNormalTransparentBC NOTIFY normalTransparentBCChanged) Q_PROPERTY(QBrush inputNormalTransparentBC READ inputNormalTransparentBC WRITE setInputNormalTransparentBC NOTIFY inputNormalTransparentBCChanged) Q_PROPERTY(QBrush clickedTransparentBC READ clickedTransparentBC WRITE setClickedTransparentBC NOTIFY clickedTransparentBCChanged) Q_PROPERTY(QBrush hoveredTransparentBC READ hoveredTransparentBC WRITE setHoveredTransparentBC NOTIFY hoveredTransparentBCChanged) Q_PROPERTY(QBrush disableTransparentBC READ disableTransparentBC WRITE setDisableTransparentBC NOTIFY disableTransparentBCChanged) public: explicit UKUITextArea(QQuickItem *parent = nullptr); ~UKUITextArea(); static UKUITextArea* 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 QBrush &normalBC() const; void setNormalBC(const QBrush &newNormalBC); const QBrush &clickedBC() const; void setClickedBC(const QBrush &newClickedBC); const QBrush &hoveredBC() const; void setHoveredBC(const QBrush &newHoveredBC); const QBrush &disableBC() const; void setDisableBC(const QBrush &newDisableBC); const QBrush &disableTextColor() const; void setDisableTextColor(const QBrush &newDisableTextColor); const QBrush &normalTextColor() const; void setNormalTextColor(const QBrush &newNormalTextColor); int borderWidth() const; void setBorderWidth(int newBorderWidth); int focusBorderWidth() const; void setFocusBorderWidth(int newFocusBorderWidth); const QBrush &normalBorderColor() const; void setNormalBorderColor(const QBrush &newNormalBorderColor); const QBrush &clickBorderColor() const; void setClickBorderColor(const QBrush &newClickBorderColor); const QBrush &disableBorderColor() const; void setDisableBorderColor(const QBrush &newDisableBorderColor); const QBrush &focusBorderColor() const; void setFocusBorderColor(const QBrush &newFocusBorderColor); const QBrush &hoverBorderColor() const; void setHoverBorderColor(const QBrush &newHoverBorderColor); const QBrush &placeHolderNormalTextColor() const; void setPlaceHolderNormalTextColor(const QBrush &newPlaceHolderNormalTextColor); const QBrush &placeHolderDisableTextColor() const; void setPlaceHolderDisableTextColor(const QBrush &newPlaceHolderDisableTextColor); const QBrush &inputNormalBC() const; void setInputNormalBC(const QBrush &newInputNormalBC); const QBrush &normalTransparentBC() const; void setNormalTransparentBC(const QBrush &newNormalTransparentBC); const QBrush &inputNormalTransparentBC() const; void setInputNormalTransparentBC(const QBrush &newInputNormalTransparentBC); const QBrush &clickedTransparentBC() const; void setClickedTransparentBC(const QBrush &newClickedTransparentBC); const QBrush &hoveredTransparentBC() const; void setHoveredTransparentBC(const QBrush &newHoveredTransparentBC); const QBrush &disableTransparentBC() const; void setDisableTransparentBC(const QBrush &newDisableTransparentBC); 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 inputNormalBCChanged(); void parametryChanged(); void normalTransparentBCChanged(); void inputNormalTransparentBCChanged(); void clickedTransparentBCChanged(); void hoveredTransparentBCChanged(); void disableTransparentBCChanged(); private: double m_radius; double m_leftRightPadding; double m_upDownMargin; double m_space; int m_normalWidth; int m_normalHeight; Q_INVOKABLE QBrush m_normalBC; Q_INVOKABLE QBrush m_clickedBC; Q_INVOKABLE QBrush m_hoveredBC; Q_INVOKABLE QBrush m_disableBC; Q_INVOKABLE QBrush m_disableTextColor; Q_INVOKABLE QBrush m_normalTextColor; int m_borderWidth; int m_focusBorderWidth; Q_INVOKABLE QBrush m_normalBorderColor; Q_INVOKABLE QBrush m_clickBorderColor; Q_INVOKABLE QBrush m_disableBorderColor; Q_INVOKABLE QBrush m_focusBorderColor; Q_INVOKABLE QBrush m_hoverBorderColor; Q_INVOKABLE QBrush m_placeHolderNormalTextColor; Q_INVOKABLE QBrush m_placeHolderDisableTextColor; Q_INVOKABLE QBrush m_inputNormalBC; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_normalTransparentBC; QBrush m_inputNormalTransparentBC; QBrush m_clickedTransparentBC; QBrush m_hoveredTransparentBC; QBrush m_disableTransparentBC; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUITextArea, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUITEXTAREA_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/imageprovider.cpp0000664000175000017500000002325215154306200026613 0ustar fengfeng#include "imageprovider.h" #include "qdebug.h" #include "qpixmap.h" #include "qimage.h" #include #include #include #include #include #include #include #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); } } //qDebug() << "isOk..." << isOk; if(!isOk) { QString idStr = id; if(idStr.startsWith("qrc:/")){ idStr = idStr.remove(0,5); } isOk = loadThemeIcon(idStr, icon); } if (!isOk) { loadDefaultIcon(icon); } //qDebug() << "load icon....." << isOk << id << 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) { icon = QIcon::fromTheme(name); if(icon.isNull()) return false; 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); } } } // 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) { QIcon icon = QIcon::fromTheme(name); if(icon.isNull()) return false; return true; } bool IconHelper::isLocalFile(const QUrl &url) { return !toLocalPath(url).isEmpty(); } QPixmap IconHelper::generatePixMap(const QString &id, Icon::Mode mode, const QSize &requestedSize, QSize defaultSize) { //qDebug() << "generatePixMap ......"; QIcon icon = IconHelper::loadIcon(id); //qDebug() << "model...." << mode << "icon...." << icon; if(icon.isNull()) return QPixmap(); QPixmap pixmap = icon.pixmap(requestedSize.isEmpty() ? defaultSize : requestedSize); if(!HighLightEffect::isPixmapPureColor(pixmap) || !HighLightEffect::isSymbolicColor(pixmap)){ ////qDebug() << "not isSymbolicColor..." << HighLightEffect::isPixmapPureColor(pixmap) << HighLightEffect::isSymbolicColor(pixmap); return pixmap; } if(mode == Icon::Highlight || mode == Icon::HighDisabled){ ////qDebug() << "hightlight mode......."; pixmap = generatedHightlightPixmap(pixmap); } if(mode == Icon::Disabled || mode == Icon::HighDisabled){ // Icon *icon = new Icon(); pixmap = generatedDisablePixmap(pixmap); } return pixmap; } QPixmap IconHelper::generatedDisablePixmap(QPixmap pixmap) { QPixmap target = pixmap; // //Fix me:QT original code QImage im = target.toImage().convertToFormat(QImage::Format_ARGB32); for (int y = 0; y < im.height(); y++) { QRgb* scanLine = reinterpret_cast(im.scanLine(y)); for (int x = 0; x < im.width(); x++) { QRgb pixel = scanLine[x];//当前像素点 (r,g,b,a) int curAlpha = qAlpha(pixel);//0-255整数值 scanLine[x] = qRgba(qRed(pixel), qGreen(pixel), qBlue(pixel), int(curAlpha * 0.45));//给当前像素点赋新值 } } return QPixmap::fromImage(im); /* // 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 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) { //qDebug() << "requestPixmap....." << id; int lastIndex = id.lastIndexOf("/"); QString model, iconID = id; if(lastIndex != -1){ iconID = id.left(lastIndex); model = id.right(id.length() - lastIndex - 1); } if(model != "normal" && model != "disenable" && model != "clicked" && model != "hover" && model != "highlight" && model != "highDisbale"){ iconID = id; model = ""; } ////qDebug() << "requestPixmap...." << model << 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; else if(model == "highlight") im = Icon::Highlight; else if(model == "highDisbale") im = Icon::HighDisabled; QPixmap pixmap = IconHelper::generatePixMap(iconID, im, requestedSize, defaultSize); if(!requestedSize.isEmpty() && pixmap.size() != requestedSize) pixmap = pixmap.scaled(requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); else if(requestedSize.isEmpty()) pixmap = pixmap.scaled(defaultSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); if (size) { QSize pixmapSize = pixmap.size(); size->setWidth(pixmapSize.width()); size->setHeight(pixmapSize.height()); } return pixmap; } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/icon.h0000664000175000017500000000223315154306200024347 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef ICON_H #define ICON_H #include #include #include #include #include #include namespace UKUIQQC2Style { class Icon : public QObject { Q_OBJECT public: explicit Icon(QObject *parent = nullptr); enum Mode { Normal, Disabled, Hovered, Selected, Highlight, HighDisabled }; }; } #endif // IMAGEPROVIDER_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuitextfiled.cpp0000664000175000017500000002441215154306200026643 0ustar fengfeng#include #include "ukuitextfiled.h" #include "qdebug.h" using namespace UKUIQQC2Style; UKUITextFiled::UKUITextFiled(QQuickItem *parent) : QQuickItem(parent) { if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUITextFiled::~UKUITextFiled() { } UKUITextFiled* UKUITextFiled::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUITextFiled(p); } void UKUITextFiled::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setLeftRightPadding(8); setRadius(instance->kradiusNormal()); setBorderWidth(instance->normalline()); setFocusBorderWidth(instance->focusline()); setNormalWidth(180); setNormalHeight(36); setInputNormalBC(instance->kComponentInput()); setNormalBC(instance->kComponentNormal()); setHoveredBC(instance->kComponentHover()); setClickedBC(instance->kComponentClick()); setDisableBC(instance->kComponentDisable()); setNormalBorderColor(instance->kLineComponentNormal()); setHoverBorderColor(instance->kLineComponentHover()); setDisableBorderColor(instance->kLineComponentDisable()); setFocusBorderColor(instance->kBrandNormal()); setPlaceHolderNormalTextColor(instance->kFontPlaceholdertext()); setPlaceHolderDisableTextColor(instance->kFontPlaceholdertextDisable()); setNormalTextColor(instance->kFontPrimary()); setDisableTextColor(instance->kFontPlaceholdertextDisable()); setInputNormalTransparentBC(instance->kComponentInputAlpha()); setNormalTransparentBC(instance->kComponentAlphaNormal()); setHoveredTransparentBC(instance->kComponentAlphaHover()); setClickedTransparentBC(instance->kComponentAlphaClick()); setDisableTransparentBC(instance->kComponentAlphaDisable()); emit parametryChanged(); } 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 QBrush &UKUITextFiled::normalBC() const { return m_normalBC; } void UKUITextFiled::setNormalBC(const QBrush &newNormalBC) { if (m_normalBC == newNormalBC) return; m_normalBC = newNormalBC; emit normalBCChanged(); } const QBrush &UKUITextFiled::clickedBC() const { return m_clickedBC; } void UKUITextFiled::setClickedBC(const QBrush &newClickedBC) { if (m_clickedBC == newClickedBC) return; m_clickedBC = newClickedBC; emit clickedBCChanged(); } const QBrush &UKUITextFiled::hoveredBC() const { return m_hoveredBC; } void UKUITextFiled::setHoveredBC(const QBrush &newHoveredBC) { if (m_hoveredBC == newHoveredBC) return; m_hoveredBC = newHoveredBC; emit hoveredBCChanged(); } const QBrush &UKUITextFiled::disableBC() const { return m_disableBC; } void UKUITextFiled::setDisableBC(const QBrush &newDisableBC) { if (m_disableBC == newDisableBC) return; m_disableBC = newDisableBC; emit disableBCChanged(); } const QBrush &UKUITextFiled::disableTextColor() const { return m_disableTextColor; } void UKUITextFiled::setDisableTextColor(const QBrush &newDisableTextColor) { if (m_disableTextColor == newDisableTextColor) return; m_disableTextColor = newDisableTextColor; emit disableTextColorChanged(); } const QBrush &UKUITextFiled::normalTextColor() const { return m_normalTextColor; } void UKUITextFiled::setNormalTextColor(const QBrush &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 QBrush &UKUITextFiled::normalBorderColor() const { return m_normalBorderColor; } void UKUITextFiled::setNormalBorderColor(const QBrush &newNormalBorderColor) { if (m_normalBorderColor == newNormalBorderColor) return; m_normalBorderColor = newNormalBorderColor; emit normalBorderColorChanged(); } const QBrush &UKUITextFiled::clickBorderColor() const { return m_clickBorderColor; } void UKUITextFiled::setClickBorderColor(const QBrush &newClickBorderColor) { if (m_clickBorderColor == newClickBorderColor) return; m_clickBorderColor = newClickBorderColor; emit clickBorderColorChanged(); } const QBrush &UKUITextFiled::disableBorderColor() const { return m_disableBorderColor; } void UKUITextFiled::setDisableBorderColor(const QBrush &newDisableBorderColor) { if (m_disableBorderColor == newDisableBorderColor) return; m_disableBorderColor = newDisableBorderColor; emit disableBorderColorChanged(); } const QBrush &UKUITextFiled::focusBorderColor() const { return m_focusBorderColor; } void UKUITextFiled::setFocusBorderColor(const QBrush &newFocusBorderColor) { if (m_focusBorderColor == newFocusBorderColor) return; m_focusBorderColor = newFocusBorderColor; emit focusBorderColorChanged(); } const QBrush &UKUITextFiled::hoverBorderColor() const { return m_hoverBorderColor; } void UKUITextFiled::setHoverBorderColor(const QBrush &newHoverBorderColor) { if (m_hoverBorderColor == newHoverBorderColor) return; m_hoverBorderColor = newHoverBorderColor; emit hoverBorderColorChanged(); } const QBrush &UKUITextFiled::placeHolderNormalTextColor() const { return m_placeHolderNormalTextColor; } void UKUITextFiled::setPlaceHolderNormalTextColor(const QBrush &newPlaceHolderNormalTextColor) { if (m_placeHolderNormalTextColor == newPlaceHolderNormalTextColor) return; m_placeHolderNormalTextColor = newPlaceHolderNormalTextColor; emit placeHolderNormalTextColorChanged(); } const QBrush &UKUITextFiled::placeHolderDisableTextColor() const { return m_placeHolderDisableTextColor; } void UKUITextFiled::setPlaceHolderDisableTextColor(const QBrush &newPlaceHolderDisableTextColor) { if (m_placeHolderDisableTextColor == newPlaceHolderDisableTextColor) return; m_placeHolderDisableTextColor = newPlaceHolderDisableTextColor; emit placeHolderDisableTextColorChanged(); } const QBrush &UKUITextFiled::inputNormalBC() const { return m_inputNormalBC; } void UKUITextFiled::setInputNormalBC(const QBrush &newInputNormalBC) { if (m_inputNormalBC == newInputNormalBC) return; m_inputNormalBC = newInputNormalBC; emit inputNormalBCChanged(); } const QBrush &UKUITextFiled::normalTransparentBC() const { return m_normalTransparentBC; } void UKUITextFiled::setNormalTransparentBC(const QBrush &newNormalTransparentBC) { if (m_normalTransparentBC == newNormalTransparentBC) return; m_normalTransparentBC = newNormalTransparentBC; emit normalTransparentBCChanged(); } const QBrush &UKUITextFiled::inputNormalTransparentBC() const { return m_inputNormalTransparentBC; } void UKUITextFiled::setInputNormalTransparentBC(const QBrush &newInputNormalTransparentBC) { if (m_inputNormalTransparentBC == newInputNormalTransparentBC) return; m_inputNormalTransparentBC = newInputNormalTransparentBC; emit inputNormalTransparentBCChanged(); } const QBrush &UKUITextFiled::clickedTransparentBC() const { return m_clickedTransparentBC; } void UKUITextFiled::setClickedTransparentBC(const QBrush &newClickedTransparentBC) { if (m_clickedTransparentBC == newClickedTransparentBC) return; m_clickedTransparentBC = newClickedTransparentBC; emit clickedTransparentBCChanged(); } const QBrush &UKUITextFiled::hoveredTransparentBC() const { return m_hoveredTransparentBC; } void UKUITextFiled::setHoveredTransparentBC(const QBrush &newHoveredTransparentBC) { if (m_hoveredTransparentBC == newHoveredTransparentBC) return; m_hoveredTransparentBC = newHoveredTransparentBC; emit hoveredTransparentBCChanged(); } const QBrush &UKUITextFiled::disableTransparentBC() const { return m_disableTransparentBC; } void UKUITextFiled::setDisableTransparentBC(const QBrush &newDisableTransparentBC) { if (m_disableTransparentBC == newDisableTransparentBC) return; m_disableTransparentBC = newDisableTransparentBC; emit disableTransparentBCChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/tokenparameter.h0000664000175000017500000000310315154306200026435 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef TOKENPARAMETER_H #define TOKENPARAMETER_H #include #include #include "../../ukui-styles/readconfig.h" #include "ukuibutton.h" namespace UKUIQQC2Style { class TokenParameter { //Q_PROPERTY(std::shared_ptr button READ button WRITE setButton NOTIFY buttonChanged) public: explicit TokenParameter(); ~TokenParameter(); UKUIGlobalDTConfig::GlobalDTConfig* getInstance(); void deleteInstance(); // const std::shared_ptr &button() const; // void setButton(std::shared_ptr &newButton); public slots: private: UKUIGlobalDTConfig::GlobalDTConfig* dt = nullptr; // UKUIButton m_button; }; } Q_DECLARE_METATYPE(UKUIQQC2Style::TokenParameter*) #endif // TOKENPARAMETER_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuicombobox.cpp0000664000175000017500000002452415154306200026467 0ustar fengfeng#include #include "ukuicombobox.h" #include "qdebug.h" using namespace UKUIQQC2Style; UKUIComboBox::UKUIComboBox(QQuickItem *parent) : QQuickItem(parent) { if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUIComboBox::~UKUIComboBox() { } UKUIComboBox* UKUIComboBox::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUIComboBox(p); } void UKUIComboBox::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setLeftRightPadding(8); setRadius(instance->kradiusNormal()); setBorderWidth(instance->normalline()); setFocusBorderWidth(instance->focusline()); setNormalWidth(240); setNormalHeight(36); setUpDownMargin(6); setLeftRightPadding(6); setNormalBC(instance->kComponentNormal()); setHoveredBC(instance->kComponentHover()); setClickedBC(instance->kComponentClick()); setDisableBC(instance->kComponentDisable()); setNormalBorderColor(instance->kLineComponentNormal()); setHoveredBorderColor(instance->kLineComponentHover()); setClickBorderColor(instance->kLineComponentClick()); setDisableBorderColor(instance->kLineComponentDisable()); setFocusBorderColor(instance->kBrandFocus()); setNormalTextColor(instance->buttonTextActive()); setDisableTextColor(instance->buttonTextDisable()); setNormalTransparentBC(instance->kComponentAlphaNormal()); setClickedTransparentBC(instance->kComponentAlphaClick()); setHoveredTransparentBC(instance->kComponentAlphaHover()); setDisableTransparentBC(instance->kComponentAlphaDisable()); setNormalTransparentBorderColor(instance->kLineComponentNormal()); setClickedTransparentBorderColor(instance->kLineComponentNormal()); setHoveredTransparentBorderColor(instance->kLineComponentNormal()); setDisableTransparentBorderColor(instance->kLineComponentDisable()); emit parametryChanged(); } 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(); } QBrush UKUIComboBox::normalBC() const { return m_normalBC; } void UKUIComboBox::setNormalBC(QBrush newNormalBC) { if (m_normalBC !=newNormalBC){ m_normalBC = newNormalBC; emit normalBCChanged(); } } QBrush UKUIComboBox::clickedBC() const { return m_clickedBC; } void UKUIComboBox::setClickedBC(QBrush newClickedBC) { if (m_clickedBC != newClickedBC){ m_clickedBC = newClickedBC; emit clickedBCChanged(); } } QBrush UKUIComboBox::hoveredBC() const { return m_hoveredBC; } void UKUIComboBox::setHoveredBC(QBrush newHoveredBC) { if (m_hoveredBC != newHoveredBC){ m_hoveredBC = newHoveredBC; emit hoveredBCChanged(); } } QBrush UKUIComboBox::disableBC() const { return m_disableBC; } void UKUIComboBox::setDisableBC(QBrush newDisableBC) { if (m_disableBC != newDisableBC){ m_disableBC = newDisableBC; emit disableBCChanged(); } } QBrush UKUIComboBox::disableTextColor() const { return m_disableTextColor; } void UKUIComboBox::setDisableTextColor(QBrush newDisableTextColor) { if (m_disableTextColor != newDisableTextColor){ m_disableTextColor = newDisableTextColor; emit disableTextColorChanged(); } } QBrush UKUIComboBox::normalTextColor() const { return m_normalTextColor; } void UKUIComboBox::setNormalTextColor(QBrush 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(); } QBrush UKUIComboBox::normalBorderColor() const { return m_normalBorderColor; } void UKUIComboBox::setNormalBorderColor(QBrush newNormalBorderColor) { if (m_normalBorderColor != newNormalBorderColor){ m_normalBorderColor = newNormalBorderColor; emit normalBorderColorChanged(); } } QBrush UKUIComboBox::clickBorderColor() const { return m_clickBorderColor; } void UKUIComboBox::setClickBorderColor(QBrush newClickBorderColor) { if (m_clickBorderColor != newClickBorderColor){ m_clickBorderColor = newClickBorderColor; emit clickBorderColorChanged(); } } QBrush UKUIComboBox::disableBorderColor() const { return m_disableBorderColor; } void UKUIComboBox::setDisableBorderColor(QBrush newDisableBorderColor) { if (m_disableBorderColor != newDisableBorderColor){ m_disableBorderColor = newDisableBorderColor; emit disableBorderColorChanged(); } } QBrush UKUIComboBox::focusBorderColor() const { return m_focusBorderColor; } void UKUIComboBox::setFocusBorderColor(QBrush newFocusBorderColor) { if (m_focusBorderColor != newFocusBorderColor){ m_focusBorderColor = newFocusBorderColor; emit focusBorderColorChanged(); } } const QBrush &UKUIComboBox::normalTransparentBC() const { return m_normalTransparentBC; } void UKUIComboBox::setNormalTransparentBC(const QBrush &newNormalTransparentBC) { if (m_normalTransparentBC == newNormalTransparentBC) return; m_normalTransparentBC = newNormalTransparentBC; emit normalTransparentBCChanged(); } const QBrush &UKUIComboBox::clickedTransparentBC() const { return m_clickedTransparentBC; } void UKUIComboBox::setClickedTransparentBC(const QBrush &newClickedTransparentBC) { if (m_clickedTransparentBC == newClickedTransparentBC) return; m_clickedTransparentBC = newClickedTransparentBC; emit clickedTransparentBCChanged(); } const QBrush &UKUIComboBox::hoveredTransparentBC() const { return m_hoveredTransparentBC; } void UKUIComboBox::setHoveredTransparentBC(const QBrush &newHoveredTransparentBC) { if (m_hoveredTransparentBC == newHoveredTransparentBC) return; m_hoveredTransparentBC = newHoveredTransparentBC; emit hoveredTransparentBCChanged(); } const QBrush &UKUIComboBox::disableTransparentBC() const { return m_disableTransparentBC; } void UKUIComboBox::setDisableTransparentBC(const QBrush &newDisableTransparentBC) { if (m_disableTransparentBC == newDisableTransparentBC) return; m_disableTransparentBC = newDisableTransparentBC; emit disableTransparentBCChanged(); } const QBrush &UKUIComboBox::hoveredBorderColor() const { return m_hoveredBorderColor; } void UKUIComboBox::setHoveredBorderColor(const QBrush &newHoveredBorderColor) { if (m_hoveredBorderColor == newHoveredBorderColor) return; m_hoveredBorderColor = newHoveredBorderColor; emit hoveredBorderColorChanged(); } const QBrush &UKUIComboBox::normalTransparentBorderColor() const { return m_normalTransparentBorderColor; } void UKUIComboBox::setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor) { if (m_normalTransparentBorderColor == newNormalTransparentBorderColor) return; m_normalTransparentBorderColor = newNormalTransparentBorderColor; emit normalTransparentBorderColorChanged(); } const QBrush &UKUIComboBox::clickedTransparentBorderColor() const { return m_clickedTransparentBorderColor; } void UKUIComboBox::setClickedTransparentBorderColor(const QBrush &newClickedTransparentBorderColor) { if (m_clickedTransparentBorderColor == newClickedTransparentBorderColor) return; m_clickedTransparentBorderColor = newClickedTransparentBorderColor; emit clickedTransparentBorderColorChanged(); } const QBrush &UKUIComboBox::hoveredTransparentBorderColor() const { return m_hoveredTransparentBorderColor; } void UKUIComboBox::setHoveredTransparentBorderColor(const QBrush &newHoveredTransparentBorderColor) { if (m_hoveredTransparentBorderColor == newHoveredTransparentBorderColor) return; m_hoveredTransparentBorderColor = newHoveredTransparentBorderColor; emit hoveredTransparentBorderColorChanged(); } const QBrush &UKUIComboBox::disableTransparentBorderColor() const { return m_disableTransparentBorderColor; } void UKUIComboBox::setDisableTransparentBorderColor(const QBrush &newDisableTransparentBorderColor) { if (m_disableTransparentBorderColor == newDisableTransparentBorderColor) return; m_disableTransparentBorderColor = newDisableTransparentBorderColor; emit disableTransparentBorderColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiradiobutton.h0000664000175000017500000004223415154306200026654 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUIRADIOBUTTON_H #define UKUIRADIOBUTTON_H #include #include #include #include #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(QBrush disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(QBrush normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged) Q_PROPERTY(QBrush normalIndicatorColor READ normalIndicatorColor WRITE setNormalIndicatorColor NOTIFY normalIndicatorColorChanged) Q_PROPERTY(QBrush hoverIndicatorColor READ hoverIndicatorColor WRITE setHoverIndicatorColor NOTIFY hoverIndicatorColorChanged) Q_PROPERTY(QBrush clickIndicatorColor READ clickIndicatorColor WRITE setClickIndicatorColor NOTIFY clickIndicatorColorChanged) Q_PROPERTY(QBrush disableIndicatorColor READ disableIndicatorColor WRITE setDisableIndicatorColor NOTIFY disableIndicatorColorChanged) Q_PROPERTY(QBrush normalIndicatorBorderColor READ normalIndicatorBorderColor WRITE setNormalIndicatorBorderColor NOTIFY normalIndicatorBorderColorChanged) Q_PROPERTY(QBrush hoverIndicatorBorderColor READ hoverIndicatorBorderColor WRITE setHoverIndicatorBorderColor NOTIFY hoverIndicatorBorderColorChanged) Q_PROPERTY(QBrush clickIndicatorBorderColor READ clickIndicatorBorderColor WRITE setClickIndicatorBorderColor NOTIFY clickIndicatorBorderColorChanged) Q_PROPERTY(QBrush disableIndicatorBorderColor READ disableIndicatorBorderColor WRITE setDisableIndicatorBorderColor NOTIFY disableIndicatorBorderColorChanged) Q_PROPERTY(QBrush checked_normalIndicatorColor READ checked_normalIndicatorColor WRITE setChecked_NormalIndicatorColor NOTIFY checked_normalIndicatorColorChanged) Q_PROPERTY(QBrush checked_hoverIndicatorColor READ checked_hoverIndicatorColor WRITE setChecked_HoverIndicatorColor NOTIFY checked_hoverIndicatorColorChanged) Q_PROPERTY(QBrush checked_clickIndicatorColor READ checked_clickIndicatorColor WRITE setChecked_ClickIndicatorColor NOTIFY checked_clickIndicatorColorChanged) Q_PROPERTY(QBrush checked_disableIndicatorColor READ checked_disableIndicatorColor WRITE setChecked_DisableIndicatorColor NOTIFY checked_disableIndicatorColorChanged) Q_PROPERTY(QBrush checked_normalIndicatorBorderColor READ checked_normalIndicatorBorderColor WRITE setChecked_NormalIndicatorBorderColor NOTIFY checked_normalIndicatorBorderColorChanged) Q_PROPERTY(QBrush checked_hoverIndicatorBorderColor READ checked_hoverIndicatorBorderColor WRITE setChecked_HoverIndicatorBorderColor NOTIFY checked_hoverIndicatorBorderColorChanged) Q_PROPERTY(QBrush checked_clickIndicatorBorderColor READ checked_clickIndicatorBorderColor WRITE setChecked_ClickIndicatorBorderColor NOTIFY checked_clickIndicatorBorderColorChanged) Q_PROPERTY(QBrush checked_disableIndicatorBorderColor READ checked_disableIndicatorBorderColor WRITE setChecked_DisableIndicatorBorderColor NOTIFY checked_disableIndicatorBorderColorChanged) Q_PROPERTY(QBrush checked_normalChildrenColor READ checked_normalChildrenColor WRITE setChecked_NormalChildrenColor NOTIFY checked_normalChildrenColorChanged) Q_PROPERTY(QBrush checked_hoverChildrenColor READ checked_hoverChildrenColor WRITE setChecked_HoverChildrenColor NOTIFY checked_hoverChildrenColorChanged) Q_PROPERTY(QBrush checked_clickChildrenColor READ checked_clickChildrenColor WRITE setChecked_ClickChildrenColor NOTIFY checked_clickChildrenColorChanged) Q_PROPERTY(QBrush checked_disableChildrenColor READ checked_disableChildrenColor WRITE setChecked_DisableChildrenColor NOTIFY checked_disableChildrenColorChanged) Q_PROPERTY(QBrush checked_normalChildrenBorderColor READ checked_normalChildrenBorderColor WRITE setChecked_NormalChildrenBorderColor NOTIFY checked_normalChildrenBorderColorChanged) Q_PROPERTY(QBrush checked_hoverChildrenBorderColor READ checked_hoverChildrenBorderColor WRITE setChecked_HoverChildrenBorderColor NOTIFY checked_hoverChildrenBorderColorChanged) Q_PROPERTY(QBrush checked_clickChildrenBorderColor READ checked_clickChildrenBorderColor WRITE setChecked_ClickChildrenBorderColor NOTIFY checked_clickChildrenBorderColorChanged) Q_PROPERTY(QBrush checked_disableChildrenBorderColor READ checked_disableChildrenBorderColor WRITE setChecked_DisableChildrenBorderColor NOTIFY checked_disableChildrenBorderColorChanged) Q_PROPERTY(QBrush normalTransparentIndicatorColor READ normalTransparentIndicatorColor WRITE setNormalTransparentIndicatorColor NOTIFY normalTransparentIndicatorColorChanged) Q_PROPERTY(QBrush hoverTransparentIndicatorColor READ hoverTransparentIndicatorColor WRITE setHoverTransparentIndicatorColor NOTIFY hoverTransparentIndicatorColorChanged) Q_PROPERTY(QBrush clickTransparentIndicatorColor READ clickTransparentIndicatorColor WRITE setClickTransparentIndicatorColor NOTIFY clickTransparentIndicatorColorChanged) Q_PROPERTY(QBrush disableTransparentIndicatorColor READ disableTransparentIndicatorColor WRITE setDisableTransparentIndicatorColor NOTIFY disableTransparentIndicatorColorChanged) Q_PROPERTY(QBrush normalTransparentIndicatorBorderColor READ normalTransparentIndicatorBorderColor WRITE setNormalTransparentIndicatorBorderColor NOTIFY normalTransparentIndicatorBorderColorChanged) Q_PROPERTY(QBrush hoverTransparentIndicatorBorderColor READ hoverTransparentIndicatorBorderColor WRITE setHoverTransparentIndicatorBorderColor NOTIFY hoverTransparentIndicatorBorderColorChanged) Q_PROPERTY(QBrush clickTransparentIndicatorBorderColor READ clickTransparentIndicatorBorderColor WRITE setClickTransparentIndicatorBorderColor NOTIFY clickTransparentIndicatorBorderColorChanged) Q_PROPERTY(QBrush disableTransparentIndicatorBorderColor READ disableTransparentIndicatorBorderColor WRITE setDisableTransparentIndicatorBorderColor NOTIFY disableTransparentIndicatorBorderColorChanged) 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 QBrush &disableTextColor() const; void setDisableTextColor(const QBrush &newDisableTextColor); const QBrush &normalTextColor() const; void setNormalTextColor(const QBrush &newNormalTextColor); const QBrush &normalIndicatorColor() const; void setNormalIndicatorColor(const QBrush &newNormalIndicatorColor); const QBrush &hoverIndicatorColor() const; void setHoverIndicatorColor(const QBrush &newHoverIndicatorColor); const QBrush &clickIndicatorColor() const; void setClickIndicatorColor(const QBrush &newClickIndicatorColor); const QBrush &disableIndicatorColor() const; void setDisableIndicatorColor(const QBrush &newDisableIndicatorColor); const QBrush &normalIndicatorBorderColor() const; void setNormalIndicatorBorderColor(const QBrush &newNormalIndicatorBorderColor); const QBrush &hoverIndicatorBorderColor() const; void setHoverIndicatorBorderColor(const QBrush &newHoverIndicatorBorderColor); const QBrush &clickIndicatorBorderColor() const; void setClickIndicatorBorderColor(const QBrush &newClickIndicatorBorderColor); const QBrush &disableIndicatorBorderColor() const; void setDisableIndicatorBorderColor(const QBrush &newDisableIndicatorBorderColor); const QBrush &checked_normalIndicatorColor() const; void setChecked_NormalIndicatorColor(const QBrush &newChecked_normalIndicatorColor); const QBrush &checked_hoverIndicatorColor() const; void setChecked_HoverIndicatorColor(const QBrush &newChecked_hoverIndicatorColor); const QBrush &checked_clickIndicatorColor() const; void setChecked_ClickIndicatorColor(const QBrush &newChecked_clickIndicatorColor); const QBrush &checked_disableIndicatorColor() const; void setChecked_DisableIndicatorColor(const QBrush &newChecked_disableIndicatorColor); const QBrush &checked_normalIndicatorBorderColor() const; void setChecked_NormalIndicatorBorderColor(const QBrush &newChecked_normalIndicatorBorderColor); const QBrush &checked_hoverIndicatorBorderColor() const; void setChecked_HoverIndicatorBorderColor(const QBrush &newChecked_hoverIndicatorBorderColor); const QBrush &checked_clickIndicatorBorderColor() const; void setChecked_ClickIndicatorBorderColor(const QBrush &newChecked_clickIndicatorBorderColor); const QBrush &checked_disableIndicatorBorderColor() const; void setChecked_DisableIndicatorBorderColor(const QBrush &newChecked_disableIndicatorBorderColor); const QBrush &checked_normalChildrenColor() const; void setChecked_NormalChildrenColor(const QBrush &newChecked_normalChildrenColor); const QBrush &checked_hoverChildrenColor() const; void setChecked_HoverChildrenColor(const QBrush &newChecked_hoverChildrenColor); const QBrush &checked_clickChildrenColor() const; void setChecked_ClickChildrenColor(const QBrush &newChecked_clickChildrenColor); const QBrush &checked_disableChildrenColor() const; void setChecked_DisableChildrenColor(const QBrush &newChecked_disableChildrenColor); const QBrush &checked_normalChildrenBorderColor() const; void setChecked_NormalChildrenBorderColor(const QBrush &newChecked_normalChildrenBorderColor); const QBrush &checked_hoverChildrenBorderColor() const; void setChecked_HoverChildrenBorderColor(const QBrush &newChecked_hoverChildrenBorderColor); const QBrush &checked_clickChildrenBorderColor() const; void setChecked_ClickChildrenBorderColor(const QBrush &newChecked_clickChildrenBorderColor); const QBrush &checked_disableChildrenBorderColor() const; void setChecked_DisableChildrenBorderColor(const QBrush &newChecked_disableChildrenBorderColor); int borderWidth() const; void setBorderWidth(int newBorderWidth); int indicatorWidth() const; void setIndicatorWidth(int newIndicatorWidth); int childrenWidth() const; void setChildrenWidth(int newChildrenWidth); const QBrush &normalTransparentIndicatorColor() const; void setNormalTransparentIndicatorColor(const QBrush &newNormalTransparentIndicatorColor); const QBrush &hoverTransparentIndicatorColor() const; void setHoverTransparentIndicatorColor(const QBrush &newHoverTransparentIndicatorColor); const QBrush &clickTransparentIndicatorColor() const; void setClickTransparentIndicatorColor(const QBrush &newClickTransparentIndicatorColor); const QBrush &disableTransparentIndicatorColor() const; void setDisableTransparentIndicatorColor(const QBrush &newDisableTransparentIndicatorColor); const QBrush &normalTransparentIndicatorBorderColor() const; void setNormalTransparentIndicatorBorderColor(const QBrush &newNormalTransparentIndicatorBorderColor); const QBrush &hoverTransparentIndicatorBorderColor() const; void setHoverTransparentIndicatorBorderColor(const QBrush &newHoverTransparentIndicatorBorderColor); const QBrush &clickTransparentIndicatorBorderColor() const; void setClickTransparentIndicatorBorderColor(const QBrush &newClickTransparentIndicatorBorderColor); const QBrush &disableTransparentIndicatorBorderColor() const; void setDisableTransparentIndicatorBorderColor(const QBrush &newDisableTransparentIndicatorBorderColor); 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 parametryChanged(); void normalTransparentIndicatorColorChanged(); void hoverTransparentIndicatorColorChanged(); void clickTransparentIndicatorColorChanged(); void disableTransparentIndicatorColorChanged(); void normalTransparentIndicatorBorderColorChanged(); void hoverTransparentIndicatorBorderColorChanged(); void clickTransparentIndicatorBorderColorChanged(); void disableTransparentIndicatorBorderColorChanged(); private: double m_leftRightMargin; double m_upDownMargin; double m_space; Q_INVOKABLE QBrush m_disableTextColor; Q_INVOKABLE QBrush m_normalTextColor; Q_INVOKABLE QBrush m_normalIndicatorColor; Q_INVOKABLE QBrush m_hoverIndicatorColor; Q_INVOKABLE QBrush m_clickIndicatorColor; Q_INVOKABLE QBrush m_disableIndicatorColor; Q_INVOKABLE QBrush m_normalIndicatorBorderColor; Q_INVOKABLE QBrush m_hoverIndicatorBorderColor; Q_INVOKABLE QBrush m_clickIndicatorBorderColor; Q_INVOKABLE QBrush m_disableIndicatorBorderColor; Q_INVOKABLE QBrush m_checked_normalIndicatorColor; Q_INVOKABLE QBrush m_checked_hoverIndicatorColor; Q_INVOKABLE QBrush m_checked_clickIndicatorColor; Q_INVOKABLE QBrush m_checked_disableIndicatorColor; Q_INVOKABLE QBrush m_checked_normalIndicatorBorderColor; Q_INVOKABLE QBrush m_checked_hoverIndicatorBorderColor; Q_INVOKABLE QBrush m_checked_clickIndicatorBorderColor; Q_INVOKABLE QBrush m_checked_disableIndicatorBorderColor; Q_INVOKABLE QBrush m_checked_normalChildrenColor; Q_INVOKABLE QBrush m_checked_hoverChildrenColor; Q_INVOKABLE QBrush m_checked_clickChildrenColor; Q_INVOKABLE QBrush m_checked_disableChildrenColor; Q_INVOKABLE QBrush m_checked_normalChildrenBorderColor; Q_INVOKABLE QBrush m_checked_hoverChildrenBorderColor; Q_INVOKABLE QBrush m_checked_clickChildrenBorderColor; Q_INVOKABLE QBrush m_checked_disableChildrenBorderColor; int m_borderWidth; int m_indicatorWidth; int m_childrenWidth; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_normalTransparentIndicatorColor; QBrush m_hoverTransparentIndicatorColor; QBrush m_clickTransparentIndicatorColor; QBrush m_disableTransparentIndicatorColor; QBrush m_normalTransparentIndicatorBorderColor; QBrush m_hoverTransparentIndicatorBorderColor; QBrush m_clickTransparentIndicatorBorderColor; QBrush m_disableTransparentIndicatorBorderColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIRadioButton, QML_HAS_ATTACHED_PROPERTIES) //Q_DECLARE_METATYPE(UKUIQQC2Style::UKUIButton); //Q_DECLARE_METATYPE(std::shared_ptr) #endif // UKUIRADIOBUTTON_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/appparameter.cpp0000664000175000017500000002222515154306200026436 0ustar fengfeng#include "appparameter.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "settings/ukui-style-settings.h" #include "../../qt6-ukui-platformtheme/platform-theme-fontdata.h" using namespace UKUIQQC2Style; APPParameter::APPParameter(QQuickItem *parent) : QQuickItem(parent) { if(!qApp) return; m_font =qApp->font(); m_palette = qApp->palette(); if (QGSettings::isSchemaInstalled("org.ukui.style")) { auto settings = UKUIStyleSettings::globalInstance(); auto opacity = settings->get("menuTransparency").toInt()/100.0; setMenuTransparency(opacity); //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); auto styleName = settings->get("styleName").toString(); if (styleName == "ukui-default" || styleName == "ukui-light" || styleName == "ukui-white" || styleName == "ukui" || styleName == "ukui-config") setIsDark(false); else if(styleName == "ukui-black" || styleName == "ukui-dark" ) { setIsDark(true); } /*! * \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, [&](const QString& key){ slotChangeStyle(key); setPalette(qApp->palette()); emit parametryChanged(); }, Qt::UniqueConnection); connect(settings, &QGSettings::changed, this, [&](const QString& key){ if(key == "iconThemeName" || key == "icon-theme-name"){ emit iconThemeChanged(); } }, Qt::UniqueConnection); } connect(qApp, &QGuiApplication::paletteChanged, this, [&](const QPalette &pal){ setPalette(pal); emit parametryChanged(); }, Qt::UniqueConnection); if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token){ setWindowColor(token->getInstance()->windowActive()); connect(token->getInstance(), &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ setPalette(token->getInstance()->appPalette()); setWindowColor(token->getInstance()->windowActive()); emit parametryChanged(); }, Qt::UniqueConnection); } } APPParameter::~APPParameter() { } APPParameter* APPParameter::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(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 == "menuTransparency"){ auto opacity = settings->get("menuTransparency").toInt()/100.0; setMenuTransparency(opacity); } // 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 == "styleName" || key == "style-name"){ auto styleName = settings->get("styleName").toString(); if (styleName == "ukui-default" || styleName == "ukui-light" || styleName == "ukui-white" || styleName == "ukui" || styleName == "ukui-config") setIsDark(false); else if(styleName == "ukui-black" || styleName == "ukui-dark" ) { setIsDark(true); } } if (key == "systemFont" || key == "system-font") { //Skip QGuiApplication avoid it crash when we setfont if(!qApp) return; QString font = settings->get("system-font").toString(); QFontDatabase db; int id = 0; if (!db.families().contains(font)) { PlatformThemeFontData fontData; QMap 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(qApp); if(!qApp) 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 = qApp->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(); } double APPParameter::menuTransparency() const { return m_menuTransparency; } void APPParameter::setMenuTransparency(double newMenuTransparency) { if (qFuzzyCompare(m_menuTransparency, newMenuTransparency)) return; m_menuTransparency = newMenuTransparency; emit menuTransparencyChanged(); } const QBrush &APPParameter::windowColor() const { return m_windowColor; } void APPParameter::setWindowColor(const QBrush &newWindowColor) { if (m_windowColor == newWindowColor) return; m_windowColor = newWindowColor; emit windowColorChanged(); } bool APPParameter::themeHasIcon(QString iconName) { return QIcon::hasThemeIcon(iconName); } bool APPParameter::focusEnable() const { return m_focusEnable; } void APPParameter::setFocusEnable(bool newFocusEnable) { if (m_focusEnable == newFocusEnable) return; m_focusEnable = newFocusEnable; emit focusEnableChanged(); } bool APPParameter::showToolTipWindow() { if(qAppName() == "kylin-aiassistant") return false; return true; } QPoint APPParameter::posByCursor(int width, int height) { QPoint p = QCursor::pos(); qDebug() << "cursor pos:" << p; const QScreen *screen =QGuiApplication::screenAt(QCursor::pos()); if (const QPlatformScreen *platformScreen = screen ? screen->handle() : nullptr) { QPlatformCursor *cursor = platformScreen->cursor(); const QSize nativeSize = cursor ? cursor->size() : QSize(16, 16); const QSize cursorSize = QHighDpi::fromNativePixels(nativeSize, platformScreen); QPoint offset(2, cursorSize.height()); if (cursorSize.height() > 2 * height) { offset = QPoint(cursorSize.width() / 2, 0); } p += offset; QRect screenRect = screen->geometry(); if (p.x() + width > screenRect.x() + screenRect.width()) p.rx() -= 4 + width; if (p.y() + height > screenRect.y() + screenRect.height()) p.ry() -= 24 + height; if (p.y() < screenRect.y()) p.setY(screenRect.y()); if (p.x() + width > screenRect.x() + screenRect.width()) p.setX(screenRect.x() + screenRect.width() - width); if (p.x() < screenRect.x()) p.setX(screenRect.x()); if (p.y() + height > screenRect.y() + screenRect.height()) p.setY(screenRect.y() + screenRect.height() - height); } qDebug() << "cursor pos1:" << p; return p; } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuispinbox.cpp0000664000175000017500000004507015154306200026340 0ustar fengfeng#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(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUISpinBox::~UKUISpinBox() { } void UKUISpinBox::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setNormalColor(instance->kComponentNormal()); setHoverColor(instance->kComponentHover()); setClickColor(instance->kComponentInput()); setDisableColor(instance->kComponentDisable()); setNormalTextColor(instance->buttonTextActive()); setDisableTextColor(instance->buttonTextDisable()); setNormalBorderColor(instance->kLineComponentNormal()); setHoverBorderColor(instance->kLineComponentHover()); setClickBorderColor(instance->kBrandNormal()); setDisableBorderColor(instance->kLineComponentDisable()); setFocusBorderColor(instance->kBrandFocus()); setFocusColor(instance->kContainGeneralNormal()); setBtnNormalColor(QBrush(QColor(0,0,0,0))); setBtnHoverColor(instance->kComponentHover()); setBtnClickColor(instance->kComponentClick()); setBtnDisableColor(QBrush(QColor(0,0,0,0))); // setBtnNormalBorderColor(instance->kLineComponentNormal()); // setBtnHoverBorderColor(instance->kLineComponentHover()); // setBtnClickBorderColor(instance->kLineComponentClick()); // setBtnDisableBorderColor(instance->kLineComponentDisable()); setNormalTransparentBC(instance->kComponentAlphaNormal()); setClickedTransparentBC(instance->kComponentInputAlpha()); setHoveredTransparentBC(instance->kComponentAlphaHover()); setDisableTransparentBC(instance->kComponentAlphaDisable()); setNormalTransparentBorderColor(instance->kLineComponentNormal()); setClickedTransparentBorderColor(instance->kBrandNormal()); setHoveredTransparentBorderColor(instance->kLineComponentHover()); setDisableTransparentBorderColor(instance->kLineComponentDisable()); setBtnNormalTransparentColor(QBrush(QColor(0,0,0,0))); setBtnHoverTransparentColor(instance->kComponentAlphaHover()); setBtnClickTransparentColor(instance->kComponentAlphaClick()); setBtnDisableTransparentColor(QBrush(QColor(0,0,0,0))); // setBtnNormalTransparentBorderColor(instance->kLineComponentNormal()); // setBtnHoverTransparentBorderColor(instance->kLineComponentHover()); // setBtnClickTransparentBorderColor(instance->kLineComponentClick()); // setBtnDisableTransparentBorderColor(instance->kLineComponentDisable()); setNormalWidth(160); setNormalHeight(36); setBtnNormalWidth(36); setBtnNormalHeight(18); setRadius(instance->kradiusNormal()); setNormalBorderWidth(instance->normalline()); setFocusBorderWidth(instance->focusline()); setPadding(8); setBtnBorderWidth(instance->normalline()); emit parametryChanged(); } UKUISpinBox* UKUISpinBox::qmlAttachedProperties(QObject *parent) { auto p = qobject_cast(parent); return new UKUISpinBox(p); } const QBrush &UKUISpinBox::normalColor() const { return m_normalColor; } void UKUISpinBox::setNormalColor(const QBrush &newNormalColor) { if (m_normalColor == newNormalColor) return; m_normalColor = newNormalColor; emit normalColorChanged(); } const QBrush &UKUISpinBox::disableColor() const { return m_disableColor; } void UKUISpinBox::setDisableColor(const QBrush &newDisableColor) { if (m_disableColor == newDisableColor) return; m_disableColor = newDisableColor; emit disableColorChanged(); } const QBrush &UKUISpinBox::hoverColor() const { return m_hoverColor; } void UKUISpinBox::setHoverColor(const QBrush &newHoverColor) { if (m_hoverColor == newHoverColor) return; m_hoverColor = newHoverColor; emit hoverColorChanged(); } const QBrush &UKUISpinBox::clickColor() const { return m_clickColor; } void UKUISpinBox::setClickColor(const QBrush &newClickColor) { if (m_clickColor == newClickColor) return; m_clickColor = newClickColor; emit clickColorChanged(); } const QBrush &UKUISpinBox::normalTextColor() const { return m_normalTextColor; } void UKUISpinBox::setNormalTextColor(const QBrush &newNormalTextColor) { if (m_normalTextColor == newNormalTextColor) return; m_normalTextColor = newNormalTextColor; emit normalTextColorChanged(); } const QBrush &UKUISpinBox::disableTextColor() const { return m_disableTextColor; } void UKUISpinBox::setDisableTextColor(const QBrush &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 QBrush &UKUISpinBox::normalBorderColor() const { return m_normalBorderColor; } void UKUISpinBox::setNormalBorderColor(const QBrush &newNormalBorderColor) { if (m_normalBorderColor == newNormalBorderColor) return; m_normalBorderColor = newNormalBorderColor; emit normalBorderColorChanged(); } const QBrush &UKUISpinBox::hoverBorderColor() const { return m_hoverBorderColor; } void UKUISpinBox::setHoverBorderColor(const QBrush &newHoverBorderColor) { if (m_hoverBorderColor == newHoverBorderColor) return; m_hoverBorderColor = newHoverBorderColor; emit hoverColorBorderChanged(); } const QBrush &UKUISpinBox::clickBorderColor() const { return m_clickBorderColor; } void UKUISpinBox::setClickBorderColor(const QBrush &newClickBorderColor) { if (m_clickBorderColor == newClickBorderColor) return; m_clickBorderColor = newClickBorderColor; emit clickColorBorderChanged(); } const QBrush &UKUISpinBox::disableBorderColor() const { return m_disableBorderColor; } void UKUISpinBox::setDisableBorderColor(const QBrush &newDisableBorderColor) { if (m_disableBorderColor == newDisableBorderColor) return; m_disableBorderColor = newDisableBorderColor; emit disableBorderColorChanged(); } const QBrush &UKUISpinBox::focusBorderColor() const { return m_focusBorderColor; } void UKUISpinBox::setFocusBorderColor(const QBrush &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 QBrush &UKUISpinBox::focusColor() const { return m_focusColor; } void UKUISpinBox::setFocusColor(const QBrush &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 QBrush &UKUISpinBox::btnNormalColor() const { return m_btnNormalColor; } void UKUISpinBox::setBtnNormalColor(const QBrush &newBtnNormalColor) { if (m_btnNormalColor == newBtnNormalColor) return; m_btnNormalColor = newBtnNormalColor; emit btnNormalColorChanged(); } const QBrush &UKUISpinBox::btnHoverColor() const { return m_btnHoverColor; } void UKUISpinBox::setBtnHoverColor(const QBrush &newBtnHoverColor) { if (m_btnHoverColor == newBtnHoverColor) return; m_btnHoverColor = newBtnHoverColor; emit btnHoverColorChanged(); } const QBrush &UKUISpinBox::btnClickColor() const { return m_btnClickColor; } void UKUISpinBox::setBtnClickColor(const QBrush &newBtnClickColor) { if (m_btnClickColor == newBtnClickColor) return; m_btnClickColor = newBtnClickColor; emit btnClickColorChanged(); } const QBrush &UKUISpinBox::btnDisableColor() const { return m_btnDisableColor; } void UKUISpinBox::setBtnDisableColor(const QBrush &newBtnDisableColor) { if (m_btnDisableColor == newBtnDisableColor) return; m_btnDisableColor = newBtnDisableColor; emit btnDisableColorChanged(); } const QBrush &UKUISpinBox::btnFocusColor() const { return m_btnFocusColor; } void UKUISpinBox::setBtnFocusColor(const QBrush &newBtnFocusColor) { if (m_btnFocusColor == newBtnFocusColor) return; m_btnFocusColor = newBtnFocusColor; emit btnFocusColorChanged(); } const QBrush &UKUISpinBox::btnNormalBorderColor() const { return m_btnNormalBorderColor; } void UKUISpinBox::setBtnNormalBorderColor(const QBrush &newBtnNormalBorderColor) { if (m_btnNormalBorderColor == newBtnNormalBorderColor) return; m_btnNormalBorderColor = newBtnNormalBorderColor; emit btnNormalBorderColorChanged(); } const QBrush &UKUISpinBox::btnHoverBorderColor() const { return m_btnHoverBorderColor; } void UKUISpinBox::setBtnHoverBorderColor(const QBrush &newBtnHoverBorderColor) { if (m_btnHoverBorderColor == newBtnHoverBorderColor) return; m_btnHoverBorderColor = newBtnHoverBorderColor; emit btnHoverBorderColorChanged(); } const QBrush &UKUISpinBox::btnClickBorderColor() const { return m_btnClickBorderColor; } void UKUISpinBox::setBtnClickBorderColor(const QBrush &newBtnClickBorderColor) { if (m_btnClickBorderColor == newBtnClickBorderColor) return; m_btnClickBorderColor = newBtnClickBorderColor; emit btnClickBorderColorChanged(); } const QBrush &UKUISpinBox::btnDisableBorderColor() const { return m_btnDisableBorderColor; } void UKUISpinBox::setBtnDisableBorderColor(const QBrush &newBtnDisableBorderColor) { if (m_btnDisableBorderColor == newBtnDisableBorderColor) return; m_btnDisableBorderColor = newBtnDisableBorderColor; emit btnDisableBorderColorChanged(); } const QBrush &UKUISpinBox::btnFocusBorderColor() const { return m_btnFocusBorderColor; } void UKUISpinBox::setBtnFocusBorderColor(const QBrush &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(); } const QBrush &UKUISpinBox::normalTransparentBC() const { return m_normalTransparentBC; } void UKUISpinBox::setNormalTransparentBC(const QBrush &newNormalTransparentBC) { if (m_normalTransparentBC == newNormalTransparentBC) return; m_normalTransparentBC = newNormalTransparentBC; emit normalTransparentBCChanged(); } const QBrush &UKUISpinBox::clickedTransparentBC() const { return m_clickedTransparentBC; } void UKUISpinBox::setClickedTransparentBC(const QBrush &newClickedTransparentBC) { if (m_clickedTransparentBC == newClickedTransparentBC) return; m_clickedTransparentBC = newClickedTransparentBC; emit clickedTransparentBCChanged(); } const QBrush &UKUISpinBox::hoveredTransparentBC() const { return m_hoveredTransparentBC; } void UKUISpinBox::setHoveredTransparentBC(const QBrush &newHoveredTransparentBC) { if (m_hoveredTransparentBC == newHoveredTransparentBC) return; m_hoveredTransparentBC = newHoveredTransparentBC; emit hoveredTransparentBCChanged(); } const QBrush &UKUISpinBox::disableTransparentBC() const { return m_disableTransparentBC; } void UKUISpinBox::setDisableTransparentBC(const QBrush &newDisableTransparentBC) { if (m_disableTransparentBC == newDisableTransparentBC) return; m_disableTransparentBC = newDisableTransparentBC; emit disableTransparentBCChanged(); } const QBrush &UKUISpinBox::normalTransparentBorderColor() const { return m_normalTransparentBorderColor; } void UKUISpinBox::setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor) { if (m_normalTransparentBorderColor == newNormalTransparentBorderColor) return; m_normalTransparentBorderColor = newNormalTransparentBorderColor; emit normalTransparentBorderColorChanged(); } const QBrush &UKUISpinBox::clickedTransparentBorderColor() const { return m_clickedTransparentBorderColor; } void UKUISpinBox::setClickedTransparentBorderColor(const QBrush &newClickedTransparentBorderColor) { if (m_clickedTransparentBorderColor == newClickedTransparentBorderColor) return; m_clickedTransparentBorderColor = newClickedTransparentBorderColor; emit clickedTransparentBorderColorChanged(); } const QBrush &UKUISpinBox::hoveredTransparentBorderColor() const { return m_hoveredTransparentBorderColor; } void UKUISpinBox::setHoveredTransparentBorderColor(const QBrush &newHoveredTransparentBorderColor) { if (m_hoveredTransparentBorderColor == newHoveredTransparentBorderColor) return; m_hoveredTransparentBorderColor = newHoveredTransparentBorderColor; emit hoveredTransparentBorderColorChanged(); } const QBrush &UKUISpinBox::disableTransparentBorderColor() const { return m_disableTransparentBorderColor; } void UKUISpinBox::setDisableTransparentBorderColor(const QBrush &newDisableTransparentBorderColor) { if (m_disableTransparentBorderColor == newDisableTransparentBorderColor) return; m_disableTransparentBorderColor = newDisableTransparentBorderColor; emit disableTransparentBorderColorChanged(); } const QBrush &UKUISpinBox::btnNormalTransparentColor() const { return m_btnNormalTransparentColor; } void UKUISpinBox::setBtnNormalTransparentColor(const QBrush &newBtnNormalTransparentColor) { if (m_btnNormalTransparentColor == newBtnNormalTransparentColor) return; m_btnNormalTransparentColor = newBtnNormalTransparentColor; emit btnNormalTransparentColorChanged(); } const QBrush &UKUISpinBox::btnHoverTransparentColor() const { return m_btnHoverTransparentColor; } void UKUISpinBox::setBtnHoverTransparentColor(const QBrush &newBtnHoverTransparentColor) { if (m_btnHoverTransparentColor == newBtnHoverTransparentColor) return; m_btnHoverTransparentColor = newBtnHoverTransparentColor; emit btnHoverTransparentColorChanged(); } const QBrush &UKUISpinBox::btnClickTransparentColor() const { return m_btnClickTransparentColor; } void UKUISpinBox::setBtnClickTransparentColor(const QBrush &newBtnClickTransparentColor) { if (m_btnClickTransparentColor == newBtnClickTransparentColor) return; m_btnClickTransparentColor = newBtnClickTransparentColor; emit btnClickTransparentColorChanged(); } const QBrush &UKUISpinBox::btnDisableTransparentColor() const { return m_btnDisableTransparentColor; } void UKUISpinBox::setBtnDisableTransparentColor(const QBrush &newBtnDisableTransparentColor) { if (m_btnDisableTransparentColor == newBtnDisableTransparentColor) return; m_btnDisableTransparentColor = newBtnDisableTransparentColor; emit btnDisableTransparentColorChanged(); } const QBrush &UKUISpinBox::btnNormalTransparentBorderColor() const { return m_btnNormalTransparentBorderColor; } void UKUISpinBox::setBtnNormalTransparentBorderColor(const QBrush &newBtnNormalTransparentBorderColor) { if (m_btnNormalTransparentBorderColor == newBtnNormalTransparentBorderColor) return; m_btnNormalTransparentBorderColor = newBtnNormalTransparentBorderColor; emit btnNormalTransparentBorderColorChanged(); } const QBrush &UKUISpinBox::btnHoverTransparentBorderColor() const { return m_btnHoverTransparentBorderColor; } void UKUISpinBox::setBtnHoverTransparentBorderColor(const QBrush &newBtnHoverTransparentBorderColor) { if (m_btnHoverTransparentBorderColor == newBtnHoverTransparentBorderColor) return; m_btnHoverTransparentBorderColor = newBtnHoverTransparentBorderColor; emit btnHoverTransparentBorderColorChanged(); } const QBrush &UKUISpinBox::btnClickTransparentBorderColor() const { return m_btnClickTransparentBorderColor; } void UKUISpinBox::setBtnClickTransparentBorderColor(const QBrush &newBtnClickTransparentBorderColor) { if (m_btnClickTransparentBorderColor == newBtnClickTransparentBorderColor) return; m_btnClickTransparentBorderColor = newBtnClickTransparentBorderColor; emit btnClickTransparentBorderColorChanged(); } const QBrush &UKUISpinBox::btnDisableTransparentBorderColor() const { return m_btnDisableTransparentBorderColor; } void UKUISpinBox::setBtnDisableTransparentBorderColor(const QBrush &newBtnDisableTransparentBorderColor) { if (m_btnDisableTransparentBorderColor == newBtnDisableTransparentBorderColor) return; m_btnDisableTransparentBorderColor = newBtnDisableTransparentBorderColor; emit btnDisableTransparentBorderColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuitooltip.h0000664000175000017500000000763215154306200026017 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUITOOLTIP_H #define UKUITOOLTIP_H #include #include #include #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUIToolTip : public QQuickItem { Q_OBJECT Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged) Q_PROPERTY(QBrush backColor READ backColor WRITE setBackColor NOTIFY backColorChanged) Q_PROPERTY(QBrush backBorderColor READ backBorderColor WRITE setBackBorderColor NOTIFY backBorderColorChanged) Q_PROPERTY(QBrush shadowColor READ shadowColor WRITE setShadowColor NOTIFY shadowColorChanged) Q_PROPERTY(QBrush 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) Q_PROPERTY(QBrush backTransparentColor READ backTransparentColor WRITE setBackTransparentColor NOTIFY backTransparentColorChanged) Q_PROPERTY(QBrush backBorderTransparentColor READ backTransparentBorderColor WRITE setBackTransparentBorderColor NOTIFY backTransparentBorderColorChanged) 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 QBrush &backColor() const; void setBackColor(const QBrush &newBackColor); const QBrush &backBorderColor() const; void setBackBorderColor(const QBrush &newBackBorderColor); const QBrush &shadowColor() const; void setShadowColor(const QBrush &newShadowColor); const QBrush &textColor() const; void setTextColor(const QBrush &newTextColor); int radius() const; void setRadius(int newRadius); int margins() const; void setMargins(int newMargins); const QBrush &backTransparentColor() const; void setBackTransparentColor(const QBrush &newBackTransparentColor); const QBrush &backTransparentBorderColor() const; void setBackTransparentBorderColor(const QBrush &newBackBorderTransparentColor); signals: void paddingChanged(); void backColorChanged(); void backBorderColorChanged(); void shadowColorChanged(); void textColorChanged(); void radiusChanged(); void marginsChanged(); void parametryChanged(); void backTransparentColorChanged(); void backTransparentBorderColorChanged(); private: int m_padding = 12; Q_INVOKABLE QBrush m_backColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.85)); Q_INVOKABLE QBrush m_backBorderColor = QBrush(QColor::fromRgbF(1, 1, 1)); Q_INVOKABLE QBrush m_shadowColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.3)); Q_INVOKABLE QBrush m_textColor; int m_radius = 6; int m_margins = 6; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_backTransparentColor; QBrush m_backBorderTransparentColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIToolTip, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUITOOLTIP_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiprogressbar.cpp0000664000175000017500000001475615154306200027216 0ustar fengfeng#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(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUIProgressBar::~UKUIProgressBar() { } void UKUIProgressBar::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setRadius(instance->kradiusNormal()); setNormalColor(instance->kComponentNormal()); setChildrenColor(instance->kBrandNormal()); setNormalWidth(243); setNormalHeight(24); setIndeterminateChildrenWidth(48); setBorderWidth(1); setBorderColor(instance->kLineComponentNormal()); setHightlightTextColor(instance->kFontWhite()); setNormalTransparentColor(instance->kComponentAlphaNormal()); setTransparentBorderColor(instance->kLineComponentNormal()); QColor baseColor = instance->kBrandNormal().color(); // 获取颜色分量 int r = baseColor.red(); int g = baseColor.green(); int b = baseColor.blue(); r = calculateHighColor(r); g = calculateHighColor(g); b = calculateHighColor(b); QColor color; color.setRed(r); color.setGreen(g); color.setBlue(b); QLinearGradient linearGradient; linearGradient.setColorAt(1, baseColor); linearGradient.setColorAt(0, color); setIndeterminateColor(QBrush(linearGradient)); emit parametryChanged(); } UKUIProgressBar* UKUIProgressBar::qmlAttachedProperties(QObject *parent) { auto p = qobject_cast(parent); return new UKUIProgressBar(p); } const QBrush &UKUIProgressBar::normalColor() const { return m_normalColor; } void UKUIProgressBar::setNormalColor(const QBrush &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 QBrush &UKUIProgressBar::childrenColor() const { return m_childrenColor; } void UKUIProgressBar::setChildrenColor(const QBrush &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 QBrush &UKUIProgressBar::indeterminateChildrenStartColor() const { return m_indeterminateChildrenStartColor; } void UKUIProgressBar::setIndeterminateChildrenStartColor(const QBrush &newIndeterminateChildrenStartColor) { if (m_indeterminateChildrenStartColor == newIndeterminateChildrenStartColor) return; m_indeterminateChildrenStartColor = newIndeterminateChildrenStartColor; emit indeterminateChildrenStartColorChanged(); } const QBrush &UKUIProgressBar::indeterminateChildrenEndColor() const { return m_indeterminateChildrenEndColor; } void UKUIProgressBar::setIndeterminateChildrenEndColor(const QBrush &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 QBrush &UKUIProgressBar::borderColor() const { return m_borderColor; } void UKUIProgressBar::setBorderColor(const QBrush &newBorderColor) { if (m_borderColor == newBorderColor) return; m_borderColor = newBorderColor; emit borderColorChanged(); } const QBrush &UKUIProgressBar::hightlightTextColor() const { return m_hightlightTextColor; } void UKUIProgressBar::setHightlightTextColor(const QBrush &newHightlightTextColor) { if (m_hightlightTextColor == newHightlightTextColor) return; m_hightlightTextColor = newHightlightTextColor; emit hightlightTextColorChanged(); } const QBrush &UKUIProgressBar::normalTransparentColor() const { return m_normalTransparentColor; } void UKUIProgressBar::setNormalTransparentColor(const QBrush &newNormalTransparentColor) { if (m_normalTransparentColor == newNormalTransparentColor) return; m_normalTransparentColor = newNormalTransparentColor; emit normalTransparentColorChanged(); } const QBrush &UKUIProgressBar::transparentborderColor() const { return m_transparentborderColor; } void UKUIProgressBar::setTransparentBorderColor(const QBrush &newTransparentborderColor) { if (m_transparentborderColor == newTransparentborderColor) return; m_transparentborderColor = newTransparentborderColor; emit transparentBorderColorChanged(); } const QBrush &UKUIProgressBar::indeterminateColor() const { return m_indeterminateColor; } void UKUIProgressBar::setIndeterminateColor(const QBrush &newIndeterminateColor) { m_indeterminateColor = newIndeterminateColor; emit indeterminateColorChanged(); } int UKUIProgressBar::calculateHighColor(int c) { if(c > 128) return 255 - (255 - c) * (255 - 255) * 1.0 / 128.0; else return c * 255 * 1.0 / 128 * 1.0; } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuimenu.h0000664000175000017500000001073215154306200025264 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUIMENU_H #define UKUIMENU_H #include #include #include #include #include #include #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(QBrush shadowNormalColor READ shadowNormalColor WRITE setshadowNormalColor NOTIFY shadowNormalColorChanged) Q_PROPERTY(QBrush shadowDisableColor READ shadowDisableColor WRITE setshadowDisableColor NOTIFY shadowDisableColorChanged) Q_PROPERTY(QBrush normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged) Q_PROPERTY(QBrush normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged) Q_PROPERTY(double bcColorAlpha READ bcColorAlpha WRITE setBcColorAlpha NOTIFY bcColorAlphaChanged) Q_PROPERTY(QBrush normalTransparentBC READ normalBC WRITE setNormalTransparentBC NOTIFY normalTransparentBCChanged) Q_PROPERTY(QBrush normalTransparentBorderColor READ normalTransparentBorderColor WRITE setNormalTransparentBorderColor NOTIFY normalTransparentBorderColorChanged) 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 QBrush &shadowNormalColor() const; void setshadowNormalColor(const QBrush &newshadowNormalColor); const QBrush &shadowDisableColor() const; void setshadowDisableColor(const QBrush &newShadowDisableColor); const QBrush &normalBC() const; void setNormalBC(const QBrush &newNormalBC); const QBrush &normalBorderColor() const; void setNormalBorderColor(const QBrush &newNormalBorderColor); int border() const; void setBorder(int newBorder); double bcColorAlpha() const; void setBcColorAlpha(double newBcColorAlpha); void setNormalTransparentBC(const QBrush &newNormalTransparentBC); const QBrush &normalTransparentBorderColor() const; void setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor); signals: void leftRightPaddingChanged(); void topBottomPaddingChanged(); void radiusChanged(); void shadowNormalColorChanged(); void shadowDisableColorChanged(); void normalBCChanged(); void normalBorderColorChanged(); void borderChanged(); void parametryChanged(); void bcColorAlphaChanged(); void normalTransparentBCChanged(); void normalTransparentBorderColorChanged(); private: int m_leftRightPadding = 8; int m_topBottomPadding = 8; int m_radius = 8; Q_INVOKABLE QBrush m_shadowNormalColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.3)); Q_INVOKABLE QBrush m_shadowDisableColor; Q_INVOKABLE QBrush m_normalBC; Q_INVOKABLE QBrush m_normalBorderColor; int m_border; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; double m_bcColorAlpha; QBrush m_normalTransparentBC; QBrush m_normalTransparentBorderColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIMenu, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUIMENU_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuicheckbox.cpp0000664000175000017500000004500615154306200026443 0ustar fengfeng#include #include "ukuicheckbox.h" #include "qdebug.h" using namespace UKUIQQC2Style; UKUICheckBox::UKUICheckBox(QQuickItem *parent) : QQuickItem(parent) { if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUICheckBox::~UKUICheckBox() { } UKUICheckBox* UKUICheckBox::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUICheckBox(p); } void UKUICheckBox::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setNormalTextColor(instance->kFontPrimary()); setDisableTextColor(instance->kFontPrimaryDisable()); setNormalIndicatorColor(instance->kComponentNormal()); setHoverIndicatorColor(instance->kComponentHover()); setClickIndicatorColor(instance->kComponentClick()); setDisableIndicatorColor(instance->kComponentDisable()); setNormalIndicatorBorderColor(instance->kLineSelectboxNormal()); setHoverIndicatorBorderColor(instance->kLineSelectboxHover()); setClickIndicatorBorderColor(instance->kLineSelectboxClick()); setDisableIndicatorBorderColor(instance->kLineSelectboxDisable()); setChecked_NormalIndicatorColor(instance->kBrandNormal()); setChecked_HoverIndicatorColor(instance->kBrandHover()); setChecked_ClickIndicatorColor(instance->kBrandClick()); setChecked_DisableIndicatorColor(instance->kBrandDisable()); setChecked_NormalIndicatorBorderColor(instance->kLineSelectboxNormal()); setChecked_HoverIndicatorBorderColor(instance->kLineSelectboxHover()); setChecked_ClickIndicatorBorderColor(instance->kLineSelectboxClick()); setChecked_DisableIndicatorBorderColor(instance->kLineSelectboxDisable()); setChecked_NormalChildrenColor(instance->kFontWhite()); setChecked_HoverChildrenColor(instance->kFontWhite()); setChecked_ClickChildrenColor(instance->kFontWhite()); setChecked_DisableChildrenColor(instance->kFontWhiteDisable()); setNormalTransparentIndicatorColor(instance->kComponentAlphaNormal()); setHoverTransparentIndicatorColor(instance->kComponentAlphaHover()); setClickTransparentIndicatorColor(instance->kComponentAlphaClick()); setDisableTransparentIndicatorColor(instance->kComponentAlphaDisable()); setNormalTransparentIndicatorBorderColor(instance->kLineSelectboxNormal()); setHoverTransparentIndicatorBorderColor(instance->kLineSelectboxNormal()); setClickTransparentIndicatorBorderColor(instance->kLineSelectboxNormal()); setDisableTransparentIndicatorBorderColor(instance->kLineSelectboxDisable()); setBorderWidth(instance->normalline()); setSpace(8); setIndicatorWidth(16); setChildrenWidth(8); setRadius(instance->kradiusMin()); setLeftRightMargin(0); emit parametryChanged(); } 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(); } QBrush UKUICheckBox::disableTextColor() const { return m_disableTextColor; } void UKUICheckBox::setDisableTextColor(QBrush newDisableTextColor) { if (m_disableTextColor != newDisableTextColor){ m_disableTextColor = newDisableTextColor; emit disableTextColorChanged(); } } QBrush UKUICheckBox::normalTextColor() const { return m_normalTextColor; } void UKUICheckBox::setNormalTextColor(QBrush newNormalTextColor) { if (m_normalTextColor != newNormalTextColor){ m_normalTextColor = newNormalTextColor; emit normalTextColorChanged(); } } QBrush UKUICheckBox::normalIndicatorColor() const { return m_normalIndicatorColor; } void UKUICheckBox::setNormalIndicatorColor(QBrush newNormalIndicatorColor) { if (m_normalIndicatorColor != newNormalIndicatorColor){ m_normalIndicatorColor = newNormalIndicatorColor; emit normalIndicatorColorChanged(); } } QBrush UKUICheckBox::hoverIndicatorColor() const { return m_hoverIndicatorColor; } void UKUICheckBox::setHoverIndicatorColor(QBrush newHoverIndicatorColor) { if (m_hoverIndicatorColor != newHoverIndicatorColor){ m_hoverIndicatorColor = newHoverIndicatorColor; emit hoverIndicatorColorChanged(); } } QBrush UKUICheckBox::clickIndicatorColor() const { return m_clickIndicatorColor; } void UKUICheckBox::setClickIndicatorColor(QBrush newClickIndicatorColor) { if (m_clickIndicatorColor != newClickIndicatorColor){ m_clickIndicatorColor = newClickIndicatorColor; emit clickIndicatorColorChanged(); } } QBrush UKUICheckBox::disableIndicatorColor() const { return m_disableIndicatorColor; } void UKUICheckBox::setDisableIndicatorColor(QBrush newDisableIndicatorColor) { if (m_disableIndicatorColor != newDisableIndicatorColor){ m_disableIndicatorColor = newDisableIndicatorColor; emit disableIndicatorColorChanged(); } } QBrush UKUICheckBox::normalIndicatorBorderColor() const { return m_normalIndicatorBorderColor; } void UKUICheckBox::setNormalIndicatorBorderColor(QBrush newNormalIndicatorBorderColor) { if (m_normalIndicatorBorderColor != newNormalIndicatorBorderColor){ m_normalIndicatorBorderColor = newNormalIndicatorBorderColor; emit normalIndicatorBorderColorChanged(); } } QBrush UKUICheckBox::hoverIndicatorBorderColor() const { return m_hoverIndicatorBorderColor; } void UKUICheckBox::setHoverIndicatorBorderColor(QBrush newHoverIndicatorBorderColor) { if (m_hoverIndicatorBorderColor != newHoverIndicatorBorderColor){ m_hoverIndicatorBorderColor = newHoverIndicatorBorderColor; emit hoverIndicatorBorderColorChanged(); } } QBrush UKUICheckBox::clickIndicatorBorderColor() const { return m_clickIndicatorBorderColor; } void UKUICheckBox::setClickIndicatorBorderColor(QBrush newClickIndicatorBorderColor) { if (m_clickIndicatorBorderColor != newClickIndicatorBorderColor){ m_clickIndicatorBorderColor = newClickIndicatorBorderColor; emit clickIndicatorBorderColorChanged(); } } QBrush UKUICheckBox::disableIndicatorBorderColor() const { return m_disableIndicatorBorderColor; } void UKUICheckBox::setDisableIndicatorBorderColor(QBrush newDisableIndicatorBorderColor) { if (m_disableIndicatorBorderColor != newDisableIndicatorBorderColor){ m_disableIndicatorBorderColor = newDisableIndicatorBorderColor; emit disableIndicatorBorderColorChanged(); } } QBrush UKUICheckBox::checked_normalIndicatorColor() const { return m_checked_normalIndicatorColor; } QBrush UKUICheckBox::checked_hoverIndicatorColor() const { return m_checked_hoverIndicatorColor; } QBrush UKUICheckBox::checked_clickIndicatorColor() const { return m_checked_clickIndicatorColor; } QBrush UKUICheckBox::checked_disableIndicatorColor() const { return m_checked_disableIndicatorColor; } QBrush UKUICheckBox::checked_normalIndicatorBorderColor() const { return m_checked_normalIndicatorBorderColor; } QBrush UKUICheckBox::checked_hoverIndicatorBorderColor() const { return m_checked_hoverIndicatorBorderColor; } QBrush UKUICheckBox::checked_clickIndicatorBorderColor() const { return m_checked_clickIndicatorBorderColor; } QBrush UKUICheckBox::checked_disableIndicatorBorderColor() const { return m_checked_disableIndicatorBorderColor; } QBrush UKUICheckBox::checked_normalChildrenColor() const { return m_checked_normalChildrenColor; } QBrush UKUICheckBox::checked_hoverChildrenColor() const { return m_checked_hoverChildrenColor; } QBrush UKUICheckBox::checked_clickChildrenColor() const { return m_checked_clickChildrenColor; } QBrush UKUICheckBox::checked_disableChildrenColor() const { return m_checked_disableChildrenColor; } QBrush UKUICheckBox::checked_normalChildrenBorderColor() const { return m_checked_normalChildrenBorderColor; } QBrush UKUICheckBox::checked_hoverChildrenBorderColor() const { return m_checked_hoverChildrenBorderColor; } QBrush UKUICheckBox::checked_clickChildrenBorderColor() const { return m_checked_clickChildrenBorderColor; } QBrush UKUICheckBox::checked_disableChildrenBorderColor() const { return m_checked_disableChildrenBorderColor; } void UKUICheckBox::setChecked_NormalIndicatorColor(QBrush newChecked_normalIndicatorColor) { if (m_checked_normalIndicatorColor != newChecked_normalIndicatorColor){ m_checked_normalIndicatorColor = newChecked_normalIndicatorColor; emit checked_normalIndicatorColorChanged(); } } void UKUICheckBox::setChecked_HoverIndicatorColor(QBrush newChecked_hoverIndicatorColor) { if (m_checked_hoverIndicatorColor != newChecked_hoverIndicatorColor){ m_checked_hoverIndicatorColor = newChecked_hoverIndicatorColor; emit checked_hoverIndicatorColorChanged(); } } void UKUICheckBox::setChecked_ClickIndicatorColor(QBrush newChecked_clickIndicatorColor) { if (m_checked_clickIndicatorColor != newChecked_clickIndicatorColor){ m_checked_clickIndicatorColor = newChecked_clickIndicatorColor; emit checked_clickIndicatorColorChanged(); } } void UKUICheckBox::setChecked_DisableIndicatorColor(QBrush newChecked_disableIndicatorColor) { if (m_checked_disableIndicatorColor != newChecked_disableIndicatorColor){ m_checked_disableIndicatorColor = newChecked_disableIndicatorColor; emit checked_disableIndicatorColorChanged(); } } void UKUICheckBox::setChecked_NormalIndicatorBorderColor(QBrush newChecked_normalIndicatorBorderColor) { if (m_checked_normalIndicatorBorderColor != newChecked_normalIndicatorBorderColor){ m_checked_normalIndicatorBorderColor = newChecked_normalIndicatorBorderColor; emit checked_normalIndicatorBorderColorChanged(); } } void UKUICheckBox::setChecked_HoverIndicatorBorderColor(QBrush newChecked_hoverIndicatorBorderColor) { if (m_checked_hoverIndicatorBorderColor != newChecked_hoverIndicatorBorderColor){ m_checked_hoverIndicatorBorderColor = newChecked_hoverIndicatorBorderColor; emit checked_hoverIndicatorBorderColorChanged(); } } void UKUICheckBox::setChecked_ClickIndicatorBorderColor(QBrush newChecked_clickIndicatorBorderColor) { if (m_checked_clickIndicatorBorderColor != newChecked_clickIndicatorBorderColor){ m_checked_clickIndicatorBorderColor = newChecked_clickIndicatorBorderColor; emit checked_clickIndicatorBorderColorChanged(); } } void UKUICheckBox::setChecked_DisableIndicatorBorderColor(QBrush newChecked_disableIndicatorBorderColor) { if (m_checked_disableIndicatorBorderColor != newChecked_disableIndicatorBorderColor){ m_checked_disableIndicatorBorderColor = newChecked_disableIndicatorBorderColor; emit checked_disableIndicatorBorderColorChanged(); } } void UKUICheckBox::setChecked_NormalChildrenColor(QBrush newChecked_normalChildrenColor) { if (m_checked_normalChildrenColor != newChecked_normalChildrenColor){ m_checked_normalChildrenColor = newChecked_normalChildrenColor; emit checked_normalChildrenColorChanged(); } } void UKUICheckBox::setChecked_HoverChildrenColor(QBrush newChecked_hoverChildrenColor) { if (m_checked_hoverChildrenColor != newChecked_hoverChildrenColor){ m_checked_hoverChildrenColor = newChecked_hoverChildrenColor; emit checked_hoverChildrenColorChanged(); } } void UKUICheckBox::setChecked_ClickChildrenColor(QBrush newChecked_clickChildrenColor) { if (m_checked_clickChildrenColor != newChecked_clickChildrenColor){ m_checked_clickChildrenColor = newChecked_clickChildrenColor; emit checked_clickChildrenColorChanged(); } } void UKUICheckBox::setChecked_DisableChildrenColor(QBrush newChecked_disableChildrenColor) { if (m_checked_disableChildrenColor != newChecked_disableChildrenColor){ m_checked_disableChildrenColor = newChecked_disableChildrenColor; emit checked_disableChildrenColorChanged(); } } void UKUICheckBox::setChecked_NormalChildrenBorderColor(QBrush newChecked_normalChildrenBorderColor) { if (m_checked_normalChildrenBorderColor != newChecked_normalChildrenBorderColor){ m_checked_normalChildrenBorderColor = newChecked_normalChildrenBorderColor; emit checked_normalChildrenBorderColorChanged(); } } void UKUICheckBox::setChecked_HoverChildrenBorderColor(QBrush newChecked_hoverChildrenBorderColor) { if (m_checked_hoverChildrenBorderColor != newChecked_hoverChildrenBorderColor){ m_checked_hoverChildrenBorderColor = newChecked_hoverChildrenBorderColor; emit checked_hoverChildrenBorderColorChanged(); } } void UKUICheckBox::setChecked_ClickChildrenBorderColor(QBrush newChecked_clickChildrenBorderColor) { if (m_checked_clickChildrenBorderColor != newChecked_clickChildrenBorderColor){ m_checked_clickChildrenBorderColor = newChecked_clickChildrenBorderColor; emit checked_clickChildrenBorderColorChanged(); } } void UKUICheckBox::setChecked_DisableChildrenBorderColor(QBrush 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(); } const QBrush &UKUICheckBox::normalTransparentIndicatorColor() const { return m_normalTransparentIndicatorColor; } void UKUICheckBox::setNormalTransparentIndicatorColor(const QBrush &newNormalTransparentIndicatorColor) { if (m_normalTransparentIndicatorColor == newNormalTransparentIndicatorColor) return; m_normalTransparentIndicatorColor = newNormalTransparentIndicatorColor; emit normalTransparentIndicatorColorChanged(); } const QBrush &UKUICheckBox::hoverTransparentIndicatorColor() const { return m_hoverTransparentIndicatorColor; } void UKUICheckBox::setHoverTransparentIndicatorColor(const QBrush &newHoverTransparentIndicatorColor) { if (m_hoverTransparentIndicatorColor == newHoverTransparentIndicatorColor) return; m_hoverTransparentIndicatorColor = newHoverTransparentIndicatorColor; emit hoverTransparentIndicatorColorChanged(); } const QBrush &UKUICheckBox::clickTransparentIndicatorColor() const { return m_clickTransparentIndicatorColor; } void UKUICheckBox::setClickTransparentIndicatorColor(const QBrush &newClickTransparentIndicatorColor) { if (m_clickTransparentIndicatorColor == newClickTransparentIndicatorColor) return; m_clickTransparentIndicatorColor = newClickTransparentIndicatorColor; emit clickTransparentIndicatorColorChanged(); } const QBrush &UKUICheckBox::disableTransparentIndicatorColor() const { return m_disableTransparentIndicatorColor; } void UKUICheckBox::setDisableTransparentIndicatorColor(const QBrush &newDisableTransparentIndicatorColor) { if (m_disableTransparentIndicatorColor == newDisableTransparentIndicatorColor) return; m_disableTransparentIndicatorColor = newDisableTransparentIndicatorColor; emit disableTransparentIndicatorColorChanged(); } const QBrush &UKUICheckBox::normalTransparentIndicatorBorderColor() const { return m_normalTransparentIndicatorBorderColor; } void UKUICheckBox::setNormalTransparentIndicatorBorderColor(const QBrush &newNormalTransparentIndicatorBorderColor) { if (m_normalTransparentIndicatorBorderColor == newNormalTransparentIndicatorBorderColor) return; m_normalTransparentIndicatorBorderColor = newNormalTransparentIndicatorBorderColor; emit normalTransparentIndicatorBorderColorChanged(); } const QBrush &UKUICheckBox::hoverTransparentIndicatorBorderColor() const { return m_hoverTransparentIndicatorBorderColor; } void UKUICheckBox::setHoverTransparentIndicatorBorderColor(const QBrush &newHoverTransparentIndicatorBorderColor) { if (m_hoverTransparentIndicatorBorderColor == newHoverTransparentIndicatorBorderColor) return; m_hoverTransparentIndicatorBorderColor = newHoverTransparentIndicatorBorderColor; emit hoverTransparentIndicatorBorderColorChanged(); } const QBrush &UKUICheckBox::clickTransparentIndicatorBorderColor() const { return m_clickTransparentIndicatorBorderColor; } void UKUICheckBox::setClickTransparentIndicatorBorderColor(const QBrush &newClickTransparentIndicatorBorderColor) { if (m_clickTransparentIndicatorBorderColor == newClickTransparentIndicatorBorderColor) return; m_clickTransparentIndicatorBorderColor = newClickTransparentIndicatorBorderColor; emit clickTransparentIndicatorBorderColorChanged(); } const QBrush &UKUICheckBox::disableTransparentIndicatorBorderColor() const { return m_disableTransparentIndicatorBorderColor; } void UKUICheckBox::setDisableTransparentIndicatorBorderColor(const QBrush &newDisableTransparentIndicatorBorderColor) { if (m_disableTransparentIndicatorBorderColor == newDisableTransparentIndicatorBorderColor) return; m_disableTransparentIndicatorBorderColor = newDisableTransparentIndicatorBorderColor; emit disableTransparentIndicatorBorderColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuipopupwindowhandle.h0000664000175000017500000000535315154306200030072 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #pragma once #include #include #include #include #include #include //#include //#include // #include "ukuiwindowhelper.h" #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUIPopupWindowHandle : public QQuickItem { Q_OBJECT Q_PROPERTY(bool posFollwMouse READ posFollwMouse WRITE setPosFollwMouse) /** * The enabled state of the window blur effect */ Q_PROPERTY(bool blur WRITE setBlurEnabled) /** * The strength of the window blur effect */ Q_PROPERTY(int blurStrength WRITE setBlurStrength) /** * The visible of server-side titlebar */ Q_PROPERTY(bool titlebarVisible WRITE setTitlebarVisible) Q_PROPERTY(int radius WRITE setRadius) Q_PROPERTY(bool windowStaysOnTopHint WRITE setWindowStaysOnTopHint) // QML_NAMED_ELEMENT(PopupHandle) // QML_ATTACHED(UKUIPopupWindowHandle) public: explicit UKUIPopupWindowHandle(QQuickItem *parent = nullptr); ~UKUIPopupWindowHandle() override; Q_INVOKABLE QPoint posByCursor(int width, int height); Q_INVOKABLE QSize getScreenSize(); Q_INVOKABLE QPoint getScreenPoint(); bool posFollwMouse() const; void setPosFollwMouse(bool newPosFollwMouse); void setBlurStrength(int strength); void setBlurEnabled(int enabled); void setTitlebarVisible(bool visible); void setRadius(int newRadius); void setWindowStaysOnTopHint(bool newWindowStaysOnTopHint); protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); private: bool m_posFollwMouse = false; int m_blurStrength = 0; bool m_blurEnabled = false; bool m_titlebarVisible = true; bool m_isXCB = false; // UkuiWindowHelper *m_windowHelper = nullptr; int m_radius = 0; bool m_windowStaysOnTopHint = false; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIPopupWindowHandle, QML_HAS_ATTACHED_PROPERTIES) qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuislider.h0000664000175000017500000003230315154306200025600 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUISLIDER_H #define UKUISLIDER_H #include #include #include #include #include #include #include #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 handleHoverHeight READ handleHoverHeight WRITE setHandleHoverHeight NOTIFY handleHoverHeightChanged) Q_PROPERTY(int focusBorderWidth READ focusBorderWidth WRITE setFocusBorderWidth NOTIFY focusBorderWidthChanged) Q_PROPERTY(QBrush focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged) Q_PROPERTY(QBrush normalGrooveColor READ normalGrooveColor WRITE setNormalGrooveColor NOTIFY normalGrooveColorChanged) Q_PROPERTY(QBrush disableGrooveColor READ disableGrooveColor WRITE setDisableGrooveColor NOTIFY disableGrooveColorChanged) Q_PROPERTY(QBrush normalGrooveBorderColor READ normalGrooveBorderColor WRITE setNormalGrooveBorderColor NOTIFY normalGrooveBorderColorChanged) Q_PROPERTY(QBrush disableGrooveBorderColor READ disableGrooveBorderColor WRITE setDisableGrooveBorderColor NOTIFY disableGrooveBorderColorChanged) Q_PROPERTY(int grooveBorderWidth READ grooveBorderWidth WRITE setGrooveBorderWidth NOTIFY grooveBorderWidthChanged) Q_PROPERTY(QBrush normalUnGrooveColor READ normalUnGrooveColor WRITE setNormalUnGrooveColor NOTIFY normalUnGrooveColorChanged) Q_PROPERTY(QBrush disableUnGrooveColor READ disableUnGrooveColor WRITE setDisableUnGrooveColor NOTIFY disableUnGrooveColorChanged) Q_PROPERTY(QBrush normalUnGrooveBorderColor READ normalUnGrooveBorderColor WRITE setNormalUnGrooveBorderColor NOTIFY normalUnGrooveBorderColorChanged) Q_PROPERTY(QBrush disableUnGrooveBorderColor READ disableUnGrooveBorderColor WRITE setDisableUnGrooveBorderColor NOTIFY disableUnGrooveBorderColorChanged) Q_PROPERTY(QBrush normalHandleColor READ normalHandleColor WRITE setNormalHandleColor NOTIFY normalHandleColorChanged) Q_PROPERTY(QBrush hoverHandleColor READ hoverHandleColor WRITE setHoverHandleColor NOTIFY hoverHandleColorChanged) Q_PROPERTY(QBrush clickHandleColor READ clickHandleColor WRITE setClickHandleColor NOTIFY clickHandleColorChanged) Q_PROPERTY(QBrush disableHandleColor READ disableHandleColor WRITE setDisableHandleColor NOTIFY DisableHandleColorChanged) Q_PROPERTY(QBrush normalHandleBorderColor READ normalHandleBorderColor WRITE setNormalHandleBorderColor NOTIFY normalHandleBorderColorChanged) Q_PROPERTY(QBrush hoverHandleBorderColor READ hoverHandleBorderColor WRITE setHoverHandleBorderColor NOTIFY hoverHandleBorderColorChanged) Q_PROPERTY(QBrush clickHandleBorderColor READ clickHandleBorderColor WRITE setClickHandleBorderColor NOTIFY clickHandleBorderColorChanged) Q_PROPERTY(QBrush disableHandleBorderColor READ disableHandleBorderColor WRITE setDisableHandleBorderColor NOTIFY disableHandleBorderColorChanged) Q_PROPERTY(int handleBorderWidth READ handleBorderWidth WRITE setHandleBorderWidth NOTIFY handleBorderWidthChanged) Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged) Q_PROPERTY(int touchNormalWidth READ touchNormalWidth WRITE setTouchNormalWidth NOTIFY touchNormalWidthChanged) Q_PROPERTY(int touchNormalHeight READ touchNormalHeight WRITE setTouchNormalHeight NOTIFY touchNormalHeightChanged) Q_PROPERTY(int touchGrooveHeight READ touchGrooveHeight WRITE setTouchGrooveHeight NOTIFY touchGrooveHeightChanged) Q_PROPERTY(int touchHandleHeight READ touchHandleHeight WRITE settouchHandleHeight NOTIFY touchHandleHeightChanged) Q_PROPERTY(int touchHandleWidth READ touchHandleWidth WRITE setTouchHandleWidth NOTIFY touchHandleWidthChanged) Q_PROPERTY(QBrush touchHandleColor READ touchHandleColor WRITE setTouchHandleColor NOTIFY touchHandleColorChanged) Q_PROPERTY(QBrush normalTransparentUnGrooveColor READ normalTransparentUnGrooveColor WRITE setNormalTransparentUnGrooveColor NOTIFY normalTransparentUnGrooveColorChanged) Q_PROPERTY(QBrush disableTransparentUnGrooveColor READ disableTransparentUnGrooveColor WRITE setDisableTransparentUnGrooveColor NOTIFY disableTransparentUnGrooveColorChanged) Q_PROPERTY(QBrush normalTransparentUnGrooveBorderColor READ normalTransparentUnGrooveBorderColor WRITE setNormalTransparentUnGrooveBorderColor NOTIFY normalTransparentUnGrooveBorderColorChanged) Q_PROPERTY(QBrush disableTransparentUnGrooveBorderColor READ disableTransparentUnGrooveBorderColor WRITE setDisableTransparentUnGrooveBorderColor NOTIFY disableTransparentUnGrooveBorderColorChanged) Q_PROPERTY(QBrush touchHandleBaseColor READ touchHandleBaseColor WRITE setTouchHandleBaseColor NOTIFY touchHandleBaseColorChanged) 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 QBrush &focusBorderColor() const; void setFocusBorderColor(const QBrush &newFocusBorderColor); const QBrush &normalGrooveColor() const; void setNormalGrooveColor(const QBrush &newNormalGrooveColor); const QBrush &disableGrooveColor() const; void setDisableGrooveColor(const QBrush &newDisableGrooveColor); const QBrush &normalHandleColor() const; void setNormalHandleColor(const QBrush &newNormalHandleColor); const QBrush &disableHandleColor() const; void setDisableHandleColor(const QBrush &newDisableHandleColor); const QBrush &normalGrooveBorderColor() const; void setNormalGrooveBorderColor(const QBrush &newNormalGrooveBorderColor); const QBrush &disableGrooveBorderColor() const; void setDisableGrooveBorderColor(const QBrush &newDisableGrooveBorderColor); int grooveBorderWidth() const; void setGrooveBorderWidth(int newGrooveBorderWidth); const QBrush &normalHandleBorderColor() const; void setNormalHandleBorderColor(const QBrush &newNormalHandleBorderColor); const QBrush &disableHandleBorderColor() const; void setDisableHandleBorderColor(const QBrush &newDisableHandleBorderColor); int handleBorderWidth() const; void setHandleBorderWidth(int newHandleBorderWidth); const QBrush &normalUnGrooveColor() const; void setNormalUnGrooveColor(const QBrush &newNormalUnGrooveColor); const QBrush &disableUnGrooveColor() const; void setDisableUnGrooveColor(const QBrush &newDisableUnGrooveColor); const QBrush &normalUnGrooveBorderColor() const; void setNormalUnGrooveBorderColor(const QBrush &newNormalUnGrooveBorderColor); const QBrush &disableUnGrooveBorderColor() const; void setDisableUnGrooveBorderColor(const QBrush &newDisableUnGrooveBorderColor); const QBrush &hoverHandleColor() const; void setHoverHandleColor(const QBrush &newHoverHandleColor); const QBrush &clickHandleColor() const; void setClickHandleColor(const QBrush &newClickHandleColor); const QBrush &hoverHandleBorderColor() const; void setHoverHandleBorderColor(const QBrush &newHoverHandleBorderColor); const QBrush &clickHandleBorderColor() const; void setClickHandleBorderColor(const QBrush &newClickHandleBorderColor); int padding() const; void setPadding(int newPadding); int touchNormalWidth() const; void setTouchNormalWidth(int newTouchNormalWidth); int touchNormalHeight() const; void setTouchNormalHeight(int newTouchNormalHeight); int touchGrooveHeight() const; void setTouchGrooveHeight(int newTouchGrooveHeight); int touchHandleHeight() const; void settouchHandleHeight(int newTouchHandleHeight); int touchHandleWidth() const; void setTouchHandleWidth(int newTouchHandleWidth); const QBrush &touchHandleColor() const; void setTouchHandleColor(const QBrush &newTouchHandleColor); const QBrush &normalTransparentUnGrooveColor() const; void setNormalTransparentUnGrooveColor(const QBrush &newNormalTransparentUnGrooveColor); const QBrush &disableTransparentUnGrooveColor() const; void setDisableTransparentUnGrooveColor(const QBrush &newDisableTransparentUnGrooveColor); const QBrush &normalTransparentUnGrooveBorderColor() const; void setNormalTransparentUnGrooveBorderColor(const QBrush &newNormalTransparentUnGrooveBorderColor); const QBrush &disableTransparentUnGrooveBorderColor() const; void setDisableTransparentUnGrooveBorderColor(const QBrush &newDisableTransparentUnGrooveBorderColor); int handleHoverHeight() const; void setHandleHoverHeight(int newHandleHoverHeight); const QBrush &touchHandleBaseColor() const; void setTouchHandleBaseColor(const QBrush &newTouchHandleBaseColor); 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(); void parametryChanged(); void paddingChanged(); void touchNormalWidthChanged(); void touchNormalHeightChanged(); void touchGrooveHeightChanged(); void touchHandleHeightChanged(); void touchHandleWidthChanged(); void touchHandleColorChanged(); void normalTransparentUnGrooveColorChanged(); void disableTransparentUnGrooveColorChanged(); void normalTransparentUnGrooveBorderColorChanged(); void disableTransparentUnGrooveBorderColorChanged(); void handleHoverHeightChanged(); void touchHandleBaseColorChanged(); private: int m_normalWidth; int m_normalHeight; int m_grooveHeight; int m_handleHeight; int m_focusBorderWidth; Q_INVOKABLE QBrush m_focusBorderColor; Q_INVOKABLE QBrush m_normalGrooveColor; Q_INVOKABLE QBrush m_disableGrooveColor; Q_INVOKABLE QBrush m_normalHandleColor; Q_INVOKABLE QBrush m_disableHandleColor; Q_INVOKABLE QBrush m_normalGrooveBorderColor; Q_INVOKABLE QBrush m_disableGrooveBorderColor; int m_grooveBorderWidth; Q_INVOKABLE QBrush m_normalHandleBorderColor; Q_INVOKABLE QBrush m_disableHandleBorderColor; int m_handleBorderWidth; Q_INVOKABLE QBrush m_normalUnGrooveColor; Q_INVOKABLE QBrush m_disableUnGrooveColor; Q_INVOKABLE QBrush m_normalUnGrooveBorderColor; Q_INVOKABLE QBrush m_disableUnGrooveBorderColor; Q_INVOKABLE QBrush m_hoverHandleColor; Q_INVOKABLE QBrush m_clickHandleColor; Q_INVOKABLE QBrush m_hoverHandleBorderColor; Q_INVOKABLE QBrush m_clickHandleBorderColor; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; int m_padding; int m_touchNormalWidth; int m_touchNormalHeight; int m_touchGrooveHeight; int m_touchHandleHeight; int m_touchHandleWidth; QBrush m_touchHandleColor; QBrush m_normalTransparentUnGrooveColor; QBrush m_disableTransparentUnGrooveColor; QBrush m_normalTransparentUnGrooveBorderColor; QBrush m_disableTransparentUnGrooveBorderColor; int m_handleHoverHeight; QBrush m_touchHandleBaseColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUISlider, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUISLIDER_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuislider.cpp0000664000175000017500000003572615154306200026147 0ustar fengfeng#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(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUISlider::~UKUISlider() { } void UKUISlider::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { if(!instance && qApp->property("qqc2-globaltoken").isValid()){ TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token){ instance = token->getInstance(); } } setNormalWidth(240); setNormalHeight(24); setGrooveHeight(4); setHandleHeight(16); setHandleHoverHeight(20); setTouchNormalWidth(240); setTouchNormalHeight(16); settouchHandleHeight(16); setTouchGrooveHeight(16); setTouchHandleWidth(32); setTouchHandleColor(instance->kFontWhite()); setFocusBorderWidth(instance->focusline()); setFocusBorderColor(instance->kBrandFocus()); setNormalGrooveColor(instance->kBrandNormal()); setDisableGrooveColor(instance->kBrandNormal()); setNormalGrooveBorderColor(QBrush(QColor(0,0,0,0))); setDisableGrooveBorderColor(QBrush(QColor(0,0,0,0))); setGrooveBorderWidth(0); setNormalUnGrooveColor(instance->kComponentNormal()); setDisableUnGrooveColor(instance->kComponentNormal()); setNormalUnGrooveBorderColor(QBrush(QColor(0,0,0,0))); setDisableUnGrooveBorderColor(QBrush(QColor(0,0,0,0))); setNormalTransparentUnGrooveColor(instance->kComponentAlphaNormal()); setDisableTransparentUnGrooveColor(instance->kComponentAlphaNormal()); setNormalTransparentUnGrooveBorderColor(QBrush(QColor(0,0,0,0))); setDisableTransparentUnGrooveBorderColor(QBrush(QColor(0,0,0,0))); setNormalHandleColor(instance->kFontWhite()); setHoverHandleColor(instance->kFontWhite()); setClickHandleColor(instance->kFontWhite()); setDisableHandleColor(instance->kFontWhite()); setNormalHandleBorderColor(instance->kBrandNormal()); setHoverHandleBorderColor(instance->kBrandNormal()); setClickHandleBorderColor(instance->kBrandNormal()); setDisableHandleBorderColor(instance->kBrandNormal()); setTouchHandleBaseColor(instance->baseActive()); setHandleBorderWidth(3); setPadding(0); emit parametryChanged(); } UKUISlider* UKUISlider::qmlAttachedProperties(QObject *parent) { auto p = qobject_cast(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 QBrush &UKUISlider::focusBorderColor() const { return m_focusBorderColor; } void UKUISlider::setFocusBorderColor(const QBrush &newFocusBorderColor) { if (m_focusBorderColor == newFocusBorderColor) return; m_focusBorderColor = newFocusBorderColor; emit focusBorderColorChanged(); } const QBrush &UKUISlider::normalGrooveColor() const { return m_normalGrooveColor; } void UKUISlider::setNormalGrooveColor(const QBrush &newNormalGrooveColor) { if (m_normalGrooveColor == newNormalGrooveColor) return; m_normalGrooveColor = newNormalGrooveColor; emit normalGrooveColorChanged(); } const QBrush &UKUISlider::disableGrooveColor() const { return m_disableGrooveColor; } void UKUISlider::setDisableGrooveColor(const QBrush &newDisableGrooveColor) { if (m_disableGrooveColor == newDisableGrooveColor) return; m_disableGrooveColor = newDisableGrooveColor; emit disableGrooveColorChanged(); } const QBrush &UKUISlider::normalHandleColor() const { return m_normalHandleColor; } void UKUISlider::setNormalHandleColor(const QBrush &newNormalHandleColor) { if (m_normalHandleColor == newNormalHandleColor) return; m_normalHandleColor = newNormalHandleColor; emit normalHandleColorChanged(); } const QBrush &UKUISlider::disableHandleColor() const { return m_disableHandleColor; } void UKUISlider::setDisableHandleColor(const QBrush &newDisableHandleColor) { if (m_disableHandleColor == newDisableHandleColor) return; m_disableHandleColor = newDisableHandleColor; emit DisableHandleColorChanged(); } const QBrush &UKUISlider::normalGrooveBorderColor() const { return m_normalGrooveBorderColor; } void UKUISlider::setNormalGrooveBorderColor(const QBrush &newNormalGrooveBorderColor) { if (m_normalGrooveBorderColor == newNormalGrooveBorderColor) return; m_normalGrooveBorderColor = newNormalGrooveBorderColor; emit normalGrooveBorderColorChanged(); } const QBrush &UKUISlider::disableGrooveBorderColor() const { return m_disableGrooveBorderColor; } void UKUISlider::setDisableGrooveBorderColor(const QBrush &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 QBrush &UKUISlider::normalHandleBorderColor() const { return m_normalHandleBorderColor; } void UKUISlider::setNormalHandleBorderColor(const QBrush &newNormalHandleBorderColor) { if (m_normalHandleBorderColor == newNormalHandleBorderColor) return; m_normalHandleBorderColor = newNormalHandleBorderColor; emit normalHandleBorderColorChanged(); } const QBrush &UKUISlider::disableHandleBorderColor() const { return m_disableHandleBorderColor; } void UKUISlider::setDisableHandleBorderColor(const QBrush &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 QBrush &UKUISlider::normalUnGrooveColor() const { return m_normalUnGrooveColor; } void UKUISlider::setNormalUnGrooveColor(const QBrush &newNormalUnGrooveColor) { if (m_normalUnGrooveColor == newNormalUnGrooveColor) return; m_normalUnGrooveColor = newNormalUnGrooveColor; emit normalUnGrooveColorChanged(); } const QBrush &UKUISlider::disableUnGrooveColor() const { return m_disableUnGrooveColor; } void UKUISlider::setDisableUnGrooveColor(const QBrush &newDisableUnGrooveColor) { if (m_disableUnGrooveColor == newDisableUnGrooveColor) return; m_disableUnGrooveColor = newDisableUnGrooveColor; emit disableUnGrooveColorChanged(); } const QBrush &UKUISlider::normalUnGrooveBorderColor() const { return m_normalUnGrooveBorderColor; } void UKUISlider::setNormalUnGrooveBorderColor(const QBrush &newNormalUnGrooveBorderColor) { if (m_normalUnGrooveBorderColor == newNormalUnGrooveBorderColor) return; m_normalUnGrooveBorderColor = newNormalUnGrooveBorderColor; emit normalUnGrooveBorderColorChanged(); } const QBrush &UKUISlider::disableUnGrooveBorderColor() const { return m_disableUnGrooveBorderColor; } void UKUISlider::setDisableUnGrooveBorderColor(const QBrush &newDisableUnGrooveBorderColor) { if (m_disableUnGrooveBorderColor == newDisableUnGrooveBorderColor) return; m_disableUnGrooveBorderColor = newDisableUnGrooveBorderColor; emit disableUnGrooveBorderColorChanged(); } const QBrush &UKUISlider::hoverHandleColor() const { return m_hoverHandleColor; } void UKUISlider::setHoverHandleColor(const QBrush &newHoverHandleColor) { if (m_hoverHandleColor == newHoverHandleColor) return; m_hoverHandleColor = newHoverHandleColor; emit hoverHandleColorChanged(); } const QBrush &UKUISlider::clickHandleColor() const { return m_clickHandleColor; } void UKUISlider::setClickHandleColor(const QBrush &newClickHandleColor) { if (m_clickHandleColor == newClickHandleColor) return; m_clickHandleColor = newClickHandleColor; emit clickHandleColorChanged(); } const QBrush &UKUISlider::hoverHandleBorderColor() const { return m_hoverHandleBorderColor; } void UKUISlider::setHoverHandleBorderColor(const QBrush &newHoverHandleBorderColor) { if (m_hoverHandleBorderColor == newHoverHandleBorderColor) return; m_hoverHandleBorderColor = newHoverHandleBorderColor; emit hoverHandleBorderColorChanged(); } const QBrush &UKUISlider::clickHandleBorderColor() const { return m_clickHandleBorderColor; } void UKUISlider::setClickHandleBorderColor(const QBrush &newClickHandleBorderColor) { if (m_clickHandleBorderColor == newClickHandleBorderColor) return; m_clickHandleBorderColor = newClickHandleBorderColor; emit clickHandleBorderColorChanged(); } int UKUISlider::padding() const { return m_padding; } void UKUISlider::setPadding(int newPadding) { if (m_padding == newPadding) return; m_padding = newPadding; emit paddingChanged(); } int UKUISlider::touchNormalWidth() const { return m_touchNormalWidth; } void UKUISlider::setTouchNormalWidth(int newTouchNormalWidth) { if (m_touchNormalWidth == newTouchNormalWidth) return; m_touchNormalWidth = newTouchNormalWidth; emit touchNormalWidthChanged(); } int UKUISlider::touchNormalHeight() const { return m_touchNormalHeight; } void UKUISlider::setTouchNormalHeight(int newTouchNormalHeight) { if (m_touchNormalHeight == newTouchNormalHeight) return; m_touchNormalHeight = newTouchNormalHeight; emit touchNormalHeightChanged(); } int UKUISlider::touchGrooveHeight() const { return m_touchGrooveHeight; } void UKUISlider::setTouchGrooveHeight(int newTouchGrooveHeight) { if (m_touchGrooveHeight == newTouchGrooveHeight) return; m_touchGrooveHeight = newTouchGrooveHeight; emit touchGrooveHeightChanged(); } int UKUISlider::touchHandleHeight() const { return m_touchHandleHeight; } void UKUISlider::settouchHandleHeight(int newTouchHandleHeight) { if (m_touchHandleHeight == newTouchHandleHeight) return; m_touchHandleHeight = newTouchHandleHeight; emit touchHandleHeightChanged(); } int UKUISlider::touchHandleWidth() const { return m_touchHandleWidth; } void UKUISlider::setTouchHandleWidth(int newTouchHandleWidth) { if (m_touchHandleWidth == newTouchHandleWidth) return; m_touchHandleWidth = newTouchHandleWidth; emit touchHandleWidthChanged(); } const QBrush &UKUISlider::touchHandleColor() const { return m_touchHandleColor; } void UKUISlider::setTouchHandleColor(const QBrush &newTouchHandleColor) { if (m_touchHandleColor == newTouchHandleColor) return; m_touchHandleColor = newTouchHandleColor; emit touchHandleColorChanged(); } const QBrush &UKUISlider::normalTransparentUnGrooveColor() const { return m_normalTransparentUnGrooveColor; } void UKUISlider::setNormalTransparentUnGrooveColor(const QBrush &newNormalTransparentUnGrooveColor) { if (m_normalTransparentUnGrooveColor == newNormalTransparentUnGrooveColor) return; m_normalTransparentUnGrooveColor = newNormalTransparentUnGrooveColor; emit normalTransparentUnGrooveColorChanged(); } const QBrush &UKUISlider::disableTransparentUnGrooveColor() const { return m_disableTransparentUnGrooveColor; } void UKUISlider::setDisableTransparentUnGrooveColor(const QBrush &newDisableTransparentUnGrooveColor) { if (m_disableTransparentUnGrooveColor == newDisableTransparentUnGrooveColor) return; m_disableTransparentUnGrooveColor = newDisableTransparentUnGrooveColor; emit disableTransparentUnGrooveColorChanged(); } const QBrush &UKUISlider::normalTransparentUnGrooveBorderColor() const { return m_normalTransparentUnGrooveBorderColor; } void UKUISlider::setNormalTransparentUnGrooveBorderColor(const QBrush &newNormalTransparentUnGrooveBorderColor) { if (m_normalTransparentUnGrooveBorderColor == newNormalTransparentUnGrooveBorderColor) return; m_normalTransparentUnGrooveBorderColor = newNormalTransparentUnGrooveBorderColor; emit normalTransparentUnGrooveBorderColorChanged(); } const QBrush &UKUISlider::disableTransparentUnGrooveBorderColor() const { return m_disableTransparentUnGrooveBorderColor; } void UKUISlider::setDisableTransparentUnGrooveBorderColor(const QBrush &newDisableTransparentUnGrooveBorderColor) { if (m_disableTransparentUnGrooveBorderColor == newDisableTransparentUnGrooveBorderColor) return; m_disableTransparentUnGrooveBorderColor = newDisableTransparentUnGrooveBorderColor; emit disableTransparentUnGrooveBorderColorChanged(); } int UKUISlider::handleHoverHeight() const { return m_handleHoverHeight; } void UKUISlider::setHandleHoverHeight(int newHandleHoverHeight) { if (m_handleHoverHeight == newHandleHoverHeight) return; m_handleHoverHeight = newHandleHoverHeight; emit handleHoverHeightChanged(); } const QBrush &UKUISlider::touchHandleBaseColor() const { return m_touchHandleBaseColor; } void UKUISlider::setTouchHandleBaseColor(const QBrush &newTouchHandleBaseColor) { if (m_touchHandleBaseColor == newTouchHandleBaseColor) return; m_touchHandleBaseColor = newTouchHandleBaseColor; emit touchHandleBaseColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiitemdelegate.cpp0000664000175000017500000005653415154306200027316 0ustar fengfeng#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(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUIItemDelegate::~UKUIItemDelegate() { } void UKUIItemDelegate::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setPadding(12); setRadius(instance->kradiusNormal()); setNormalTextColor(instance->kFontPrimary()); setDisableTextColor(instance->kFontPrimaryDisable()); setNormalHTextColor(instance->kFontWhite()); setDisableHTextColor(instance->kFontWhiteDisable()); setNormalBC(QBrush(QColor(0,0,0,0))); setClickedBC(instance->kContainClick()); setHoveredBC(instance->kContainHover()); setDisableBC(QBrush(QColor(0,0,0,0))); setBorderWidth(1); setNormalBorderColor(QBrush(QColor(0,0,0,0))); setClickBorderColor(QBrush(QColor(0,0,0,0))); setHoverBorderColor(QBrush(QColor(0,0,0,0))); setDisableBorderColor(QBrush(QColor(0,0,0,0))); setNormalHBC(instance->kBrandNormal()); setNormalBorderHColor(instance->kLineBrandNormal()); setHoveredHBC(instance->kBrandHover()); setHoverBorderHColor(instance->kLineBrandHover()); setClickedHBC(instance->kBrandClick()); setClickBorderHColor(instance->kLineBrandClick()); setDisableHBC(instance->kBrandDisable()); setDisableBorderHColor(QBrush(QColor(0,0,0,0))); setNormalCheckedBC(instance->kComponentSelectedNormal()); setNormalBorderCheckedColor(QBrush(QColor(0,0,0,0))); setHoveredCheckedBC(instance->kComponentSelectedHover()); setHoverBorderCheckedColor(QBrush(QColor(0,0,0,0))); setClickedCheckedBC(instance->kComponentSelectedClick()); setClickBorderCheckedColor(QBrush(QColor(0,0,0,0))); setDisableCheckedBC(instance->kComponentSelectedDisable()); setDisableBorderCheckedColor(QBrush(QColor(0,0,0,0))); setNormalTransparentBC(QBrush(QColor(0,0,0,0))); setHoveredTransparentBC(instance->kContainAlphaHover()); setClickedTransparentBC(instance->kContainAlphaClick()); setDisableTransparentBC(QBrush(QColor(0,0,0,0))); setNormalTransparentBorderColor(QBrush(QColor(0,0,0,0))); setHoveredTransparentBorderColor(QBrush(QColor(0,0,0,0))); setClickedTransparentBorderColor(QBrush(QColor(0,0,0,0))); setDisableTransparentBorderColor(QBrush(QColor(0,0,0,0))); setNormalCheckedTransparentBC(instance->kComponentSelectedAlphaNormal()); setHoveredCheckedTransparentBC(instance->kComponentSelectedAlphaHover()); setClickedCheckedTransparentBC(instance->kComponentSelectedAlphaClick()); setDisableCheckedTransparentBC(instance->kComponentSelectedAlphaDisable()); setNormalCheckedTransparentBorderColor(QBrush(QColor(0,0,0,0))); setHoveredCheckedTransparentBorderColor(QBrush(QColor(0,0,0,0))); setClickedCheckedTransparentBorderColor(QBrush(QColor(0,0,0,0))); setDisableCheckedTransparentBorderColor(QBrush(QColor(0,0,0,0))); setNormalAlternateBC(instance->kContainSecondaryNormal()); setClickedAlternateBC(instance->kContainHover()); setHoveredAlternateBC(instance->kContainHover()); setDisableAlternateBC(instance->kContainSecondaryNormal()); setNormalAlternateTransparentBC(instance->kContainSecondaryAlphaNormal()); setClickedAlternateTransparentBC(instance->kContainAlphaHover()); setHoveredAlternateTransparentBC(instance->kContainAlphaHover()); setDisableAlternateTransparentBC(instance->kContainSecondaryAlphaNormal()); emit parametryChanged(); } UKUIItemDelegate* UKUIItemDelegate::qmlAttachedProperties(QObject *parent) { auto p = qobject_cast(parent); return new UKUIItemDelegate(p); } QBrush UKUIItemDelegate::normalTextColor() const { return m_normalTextColor; } void UKUIItemDelegate::setNormalTextColor(QBrush newNormalTextColor) { if (m_normalTextColor == newNormalTextColor) return; m_normalTextColor = newNormalTextColor; emit normalTextColorChanged(); } QBrush UKUIItemDelegate::disableTextColor() const { return m_disableTextColor; } void UKUIItemDelegate::setDisableTextColor(QBrush newDisableTextColor) { if (m_disableTextColor == newDisableTextColor) return; m_disableTextColor = newDisableTextColor; emit disableTextColorChanged(); } QBrush UKUIItemDelegate::normalBC() const { return m_normalBC; } void UKUIItemDelegate::setNormalBC(QBrush newNormalBC) { if (m_normalBC == newNormalBC) return; m_normalBC = newNormalBC; emit normalBCChanged(); } QBrush UKUIItemDelegate::clickedBC() const { return m_clickedBC; } void UKUIItemDelegate::setClickedBC(QBrush newClickedBC) { if (m_clickedBC == newClickedBC) return; m_clickedBC = newClickedBC; emit clickedBCChanged(); } QBrush UKUIItemDelegate::hoveredBC() const { return m_hoveredBC; } void UKUIItemDelegate::setHoveredBC(QBrush newHoveredBC) { if (m_hoveredBC == newHoveredBC) return; m_hoveredBC = newHoveredBC; emit hoveredBCChanged(); } QBrush UKUIItemDelegate::disableBC() const { return m_disableBC; } void UKUIItemDelegate::setDisableBC(QBrush 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(); } QBrush UKUIItemDelegate::normalBorderColor() const { return m_normalBorderColor; } void UKUIItemDelegate::setNormalBorderColor(QBrush newNormalBorderColor) { if (m_normalBorderColor == newNormalBorderColor) return; m_normalBorderColor = newNormalBorderColor; emit normalBorderColorChanged(); } QBrush UKUIItemDelegate::hoverBorderColor() const { return m_hoverBorderColor; } void UKUIItemDelegate::setHoverBorderColor(QBrush newHoverBorderColor) { if (m_hoverBorderColor == newHoverBorderColor) return; m_hoverBorderColor = newHoverBorderColor; emit hoverBorderColorChanged(); } QBrush UKUIItemDelegate::clickBorderColor() const { return m_clickBorderColor; } void UKUIItemDelegate::setClickBorderColor(QBrush newClickBorderColor) { if (m_clickBorderColor == newClickBorderColor) return; m_clickBorderColor = newClickBorderColor; emit clickBorderColorChanged(); } QBrush UKUIItemDelegate::disableBorderColor() const { return m_disableBorderColor; } void UKUIItemDelegate::setDisableBorderColor(QBrush newDisableBorderColor) { if (m_disableBorderColor == newDisableBorderColor) return; m_disableBorderColor = newDisableBorderColor; emit disableBorderColorChanged(); } const QBrush &UKUIItemDelegate::clickedHBC() const { return m_clickedHBC; } void UKUIItemDelegate::setClickedHBC(const QBrush &newClickedHBC) { if (m_clickedHBC == newClickedHBC) return; m_clickedHBC = newClickedHBC; emit clickedHBCChanged(); } const QBrush &UKUIItemDelegate::hoveredHBC() const { return m_hoveredHBC; } void UKUIItemDelegate::setHoveredHBC(const QBrush &newHoveredHBC) { if (m_hoveredHBC == newHoveredHBC) return; m_hoveredHBC = newHoveredHBC; emit hoveredHBCChanged(); } const QBrush &UKUIItemDelegate::hoverBorderHColor() const { return m_hoverBorderHColor; } void UKUIItemDelegate::setHoverBorderHColor(const QBrush &newHoverBorderHColor) { if (m_hoverBorderHColor == newHoverBorderHColor) return; m_hoverBorderHColor = newHoverBorderHColor; emit hoverBorderHColorChanged(); } const QBrush &UKUIItemDelegate::clickBorderHColor() const { return m_clickBorderHColor; } void UKUIItemDelegate::setClickBorderHColor(const QBrush &newClickBorderHColor) { if (m_clickBorderHColor == newClickBorderHColor) return; m_clickBorderHColor = newClickBorderHColor; emit clickBorderHColorChanged(); } const QBrush &UKUIItemDelegate::normalHBC() const { return m_normalHBC; } void UKUIItemDelegate::setNormalHBC(const QBrush &newNormalHBC) { if (m_normalHBC == newNormalHBC) return; m_normalHBC = newNormalHBC; emit normalHBCChanged(); } const QBrush &UKUIItemDelegate::normalBorderHColor() const { return m_normalBorderHColor; } void UKUIItemDelegate::setNormalBorderHColor(const QBrush &newNormalBorderHColor) { if (m_normalBorderHColor == newNormalBorderHColor) return; m_normalBorderHColor = newNormalBorderHColor; emit normalBorderHColorChanged(); } const QBrush &UKUIItemDelegate::normalCheckedBC() const { return m_normalCheckedBC; } void UKUIItemDelegate::setNormalCheckedBC(const QBrush &newNormalCheckedBC) { if (m_normalCheckedBC == newNormalCheckedBC) return; m_normalCheckedBC = newNormalCheckedBC; emit normalCheckedBCChanged(); } const QBrush &UKUIItemDelegate::clickedCheckedBC() const { return m_clickedCheckedBC; } void UKUIItemDelegate::setClickedCheckedBC(const QBrush &newClickedCheckedBC) { if (m_clickedCheckedBC == newClickedCheckedBC) return; m_clickedCheckedBC = newClickedCheckedBC; emit clickedCheckedBCChanged(); } const QBrush &UKUIItemDelegate::hoveredCheckedBC() const { return m_hoveredCheckedBC; } void UKUIItemDelegate::setHoveredCheckedBC(const QBrush &newHoveredCheckedBC) { if (m_hoveredCheckedBC == newHoveredCheckedBC) return; m_hoveredCheckedBC = newHoveredCheckedBC; emit hoveredCheckedBCChanged(); } const QBrush &UKUIItemDelegate::normalBorderCheckedColor() const { return m_normalBorderCheckedColor; } void UKUIItemDelegate::setNormalBorderCheckedColor(const QBrush &newNormalBorderCheckedColor) { if (m_normalBorderCheckedColor == newNormalBorderCheckedColor) return; m_normalBorderCheckedColor = newNormalBorderCheckedColor; emit normalBorderCheckedColorChanged(); } const QBrush &UKUIItemDelegate::hoverBorderCheckedColor() const { return m_hoverBorderCheckedColor; } void UKUIItemDelegate::setHoverBorderCheckedColor(const QBrush &newHoverBorderCheckedColor) { if (m_hoverBorderCheckedColor == newHoverBorderCheckedColor) return; m_hoverBorderCheckedColor = newHoverBorderCheckedColor; emit hoverBorderCheckedColorChanged(); } const QBrush &UKUIItemDelegate::clickBorderCheckedColor() const { return m_clickBorderCheckedColor; } void UKUIItemDelegate::setClickBorderCheckedColor(const QBrush &newClickBorderCheckedColor) { if (m_clickBorderCheckedColor == newClickBorderCheckedColor) return; m_clickBorderCheckedColor = newClickBorderCheckedColor; emit clickBorderCheckedColorChanged(); } int UKUIItemDelegate::implicitHeight() const { return m_implicitHeight; } void UKUIItemDelegate::setImplicitHeight(int newImplicitHeight) { if (m_implicitHeight == newImplicitHeight) return; m_implicitHeight = newImplicitHeight; emit implicitHeightChanged(); } int UKUIItemDelegate::padding() const { return m_padding; } void UKUIItemDelegate::setPadding(int newPadding) { if (m_padding == newPadding) return; m_padding = newPadding; emit paddingChanged(); } const QBrush &UKUIItemDelegate::normalHTextColor() const { return m_normalHTextColor; } void UKUIItemDelegate::setNormalHTextColor(const QBrush &newNormalHTextColor) { if (m_normalHTextColor == newNormalHTextColor) return; m_normalHTextColor = newNormalHTextColor; emit normalHTextColorChanged(); } const QBrush &UKUIItemDelegate::disableHTextColor() const { return m_disableHTextColor; } void UKUIItemDelegate::setDisableHTextColor(const QBrush &newDisableHTextColor) { if (m_disableHTextColor == newDisableHTextColor) return; m_disableHTextColor = newDisableHTextColor; emit disableHTextColorChanged(); } const QBrush &UKUIItemDelegate::normalTransparentBC() const { return m_normalTransparentBC; } void UKUIItemDelegate::setNormalTransparentBC(const QBrush &newNormalTransparentBC) { if (m_normalTransparentBC == newNormalTransparentBC) return; m_normalTransparentBC = newNormalTransparentBC; emit normalTransparentBCChanged(); } const QBrush &UKUIItemDelegate::clickedTransparentBC() const { return m_clickedTransparentBC; } void UKUIItemDelegate::setClickedTransparentBC(const QBrush &newClickedTransparentBC) { if (m_clickedTransparentBC == newClickedTransparentBC) return; m_clickedTransparentBC = newClickedTransparentBC; emit clickedTransparentBCChanged(); } const QBrush &UKUIItemDelegate::hoveredTransparentBC() const { return m_hoveredTransparentBC; } void UKUIItemDelegate::setHoveredTransparentBC(const QBrush &newHoveredTransparentBC) { if (m_hoveredTransparentBC == newHoveredTransparentBC) return; m_hoveredTransparentBC = newHoveredTransparentBC; emit hoveredTransparentBCChanged(); } const QBrush &UKUIItemDelegate::disableTransparentBC() const { return m_disableTransparentBC; } void UKUIItemDelegate::setDisableTransparentBC(const QBrush &newDisableTransparentBC) { if (m_disableTransparentBC == newDisableTransparentBC) return; m_disableTransparentBC = newDisableTransparentBC; emit disableTransparentBCChanged(); } const QBrush &UKUIItemDelegate::normalTransparentBorderColor() const { return m_normalTransparentBorderColor; } void UKUIItemDelegate::setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor) { if (m_normalTransparentBorderColor == newNormalTransparentBorderColor) return; m_normalTransparentBorderColor = newNormalTransparentBorderColor; emit normalTransparentBorderColorChanged(); } const QBrush &UKUIItemDelegate::clickedTransparentBorderColor() const { return m_clickedTransparentBorderColor; } void UKUIItemDelegate::setClickedTransparentBorderColor(const QBrush &newClickedTransparentBorderColor) { if (m_clickedTransparentBorderColor == newClickedTransparentBorderColor) return; m_clickedTransparentBorderColor = newClickedTransparentBorderColor; emit clickedTransparentBorderColorChanged(); } const QBrush &UKUIItemDelegate::hoveredTransparentBorderColor() const { return m_hoveredTransparentBorderColor; } void UKUIItemDelegate::setHoveredTransparentBorderColor(const QBrush &newHoveredTransparentBorderColor) { if (m_hoveredTransparentBorderColor == newHoveredTransparentBorderColor) return; m_hoveredTransparentBorderColor = newHoveredTransparentBorderColor; emit hoveredTransparentBorderColorChanged(); } const QBrush &UKUIItemDelegate::disableTransparentBorderColor() const { return m_disableTransparentBorderColor; } void UKUIItemDelegate::setDisableTransparentBorderColor(const QBrush &newDisableTransparentBorderColor) { if (m_disableTransparentBorderColor == newDisableTransparentBorderColor) return; m_disableTransparentBorderColor = newDisableTransparentBorderColor; emit disableTransparentBorderColorChanged(); } const QBrush &UKUIItemDelegate::disableHBC() const { return m_disableHBC; } void UKUIItemDelegate::setDisableHBC(const QBrush &newDisableHBC) { if (m_disableHBC == newDisableHBC) return; m_disableHBC = newDisableHBC; emit disabledHBCChanged(); } const QBrush &UKUIItemDelegate::disableBorderHColor() const { return m_disableBorderHColor; } void UKUIItemDelegate::setDisableBorderHColor(const QBrush &newDisableBorderHColor) { if (m_disableBorderHColor == newDisableBorderHColor) return; m_disableBorderHColor = newDisableBorderHColor; emit disabledBorderHColorChanged(); } const QBrush &UKUIItemDelegate::disableCheckedBC() const { return m_disableCheckedBC; } void UKUIItemDelegate::setDisableCheckedBC(const QBrush &newDisableCheckedBC) { if (m_disableCheckedBC == newDisableCheckedBC) return; m_disableCheckedBC = newDisableCheckedBC; emit disableCheckedBCChanged(); } const QBrush &UKUIItemDelegate::disableBorderCheckedColor() const { return m_disableBorderCheckedColor; } void UKUIItemDelegate::setDisableBorderCheckedColor(const QBrush &newDisableBorderCheckedColor) { if (m_disableBorderCheckedColor == newDisableBorderCheckedColor) return; m_disableBorderCheckedColor = newDisableBorderCheckedColor; emit disableBorderCheckedColorChanged(); } const QBrush &UKUIItemDelegate::normalCheckedTransparentBC() const { return m_normalCheckedTransparentBC; } void UKUIItemDelegate::setNormalCheckedTransparentBC(const QBrush &newNormalCheckedTransparentBC) { if (m_normalCheckedTransparentBC == newNormalCheckedTransparentBC) return; m_normalCheckedTransparentBC = newNormalCheckedTransparentBC; emit normalCheckedTransparentBCChanged(); } const QBrush &UKUIItemDelegate::clickedCheckedTransparentBC() const { return m_clickedCheckedTransparentBC; } void UKUIItemDelegate::setClickedCheckedTransparentBC(const QBrush &newClickedCheckedTransparentBC) { if (m_clickedCheckedTransparentBC == newClickedCheckedTransparentBC) return; m_clickedCheckedTransparentBC = newClickedCheckedTransparentBC; emit clickedCheckedTransparentBCChanged(); } const QBrush &UKUIItemDelegate::hoveredCheckedTransparentBC() const { return m_hoveredCheckedTransparentBC; } void UKUIItemDelegate::setHoveredCheckedTransparentBC(const QBrush &newHoveredCheckedTransparentBC) { if (m_hoveredCheckedTransparentBC == newHoveredCheckedTransparentBC) return; m_hoveredCheckedTransparentBC = newHoveredCheckedTransparentBC; emit hoveredCheckedTransparentBCChanged(); } const QBrush &UKUIItemDelegate::disableCheckedTransparentBC() const { return m_disableCheckedTransparentBC; } void UKUIItemDelegate::setDisableCheckedTransparentBC(const QBrush &newDisableCheckedTransparentBC) { if (m_disableCheckedTransparentBC == newDisableCheckedTransparentBC) return; m_disableCheckedTransparentBC = newDisableCheckedTransparentBC; emit disableCheckedTransparentBCChanged(); } const QBrush &UKUIItemDelegate::normalCheckedTransparentBorderColor() const { return m_normalCheckedTransparentBorderColor; } void UKUIItemDelegate::setNormalCheckedTransparentBorderColor(const QBrush &newNormalCheckedTransparentBorderColor) { if (m_normalCheckedTransparentBorderColor == newNormalCheckedTransparentBorderColor) return; m_normalCheckedTransparentBorderColor = newNormalCheckedTransparentBorderColor; emit normalCheckedTransparentBorderColorChanged(); } const QBrush &UKUIItemDelegate::clickedCheckedTransparentBorderColor() const { return m_clickedCheckedTransparentBorderColor; } void UKUIItemDelegate::setClickedCheckedTransparentBorderColor(const QBrush &newClickedCheckedTransparentBorderColor) { if (m_clickedCheckedTransparentBorderColor == newClickedCheckedTransparentBorderColor) return; m_clickedCheckedTransparentBorderColor = newClickedCheckedTransparentBorderColor; emit clickedCheckedTransparentBorderColorChanged(); } const QBrush &UKUIItemDelegate::hoveredCheckedTransparentBorderColor() const { return m_hoveredCheckedTransparentBorderColor; } void UKUIItemDelegate::setHoveredCheckedTransparentBorderColor(const QBrush &newHoveredCheckedTransparentBorderColor) { if (m_hoveredCheckedTransparentBorderColor == newHoveredCheckedTransparentBorderColor) return; m_hoveredCheckedTransparentBorderColor = newHoveredCheckedTransparentBorderColor; emit hoveredCheckedTransparentBorderColorChanged(); } const QBrush &UKUIItemDelegate::disableCheckedTransparentBorderColor() const { return m_disableCheckedTransparentBorderColor; } void UKUIItemDelegate::setDisableCheckedTransparentBorderColor(const QBrush &newDisableCheckedTransparentBorderColor) { if (m_disableCheckedTransparentBorderColor == newDisableCheckedTransparentBorderColor) return; m_disableCheckedTransparentBorderColor = newDisableCheckedTransparentBorderColor; emit disableCheckedTransparentBorderColorChanged(); } QBrush UKUIItemDelegate::normalAlternateBC() const { return m_normalAlternateBC; } void UKUIItemDelegate::setNormalAlternateBC(const QBrush &newNormalAlternateBC) { if (m_normalAlternateBC == newNormalAlternateBC) return; m_normalAlternateBC = newNormalAlternateBC; emit normalAlternateBCChanged(); } QBrush UKUIItemDelegate::clickedAlternateBC() const { return m_clickedAlternatedBC; } void UKUIItemDelegate::setClickedAlternateBC(const QBrush &newClickedAlternatedBC) { if (m_clickedAlternatedBC == newClickedAlternatedBC) return; m_clickedAlternatedBC = newClickedAlternatedBC; emit clickedAlternateBCChanged(); } QBrush UKUIItemDelegate::hoveredAlternateBC() const { return m_hoveredAlternatedBC; } void UKUIItemDelegate::setHoveredAlternateBC(const QBrush &newHoveredAlternatedBC) { if (m_hoveredAlternatedBC == newHoveredAlternatedBC) return; m_hoveredAlternatedBC = newHoveredAlternatedBC; emit hoveredAlternateBCChanged(); } QBrush UKUIItemDelegate::disableAlternateBC() const { return m_disableAlternateBC; } void UKUIItemDelegate::setDisableAlternateBC(const QBrush &newDisableAlternateBC) { if (m_disableAlternateBC == newDisableAlternateBC) return; m_disableAlternateBC = newDisableAlternateBC; emit disableAlternateBCChanged(); } QBrush UKUIItemDelegate::normalAlternateTransparentBC() const { return m_normalAlternateTransparentBC; } void UKUIItemDelegate::setNormalAlternateTransparentBC(const QBrush &newNormalAlternateTransparentBC) { if (m_normalAlternateTransparentBC == newNormalAlternateTransparentBC) return; m_normalAlternateTransparentBC = newNormalAlternateTransparentBC; emit normalAlternateTransparentBCChanged(); } QBrush UKUIItemDelegate::clickedAlternateTransparentBC() const { return m_clickedAlternateTransparentBC; } void UKUIItemDelegate::setClickedAlternateTransparentBC(const QBrush &newClickedAlternateTransparentBC) { if (m_clickedAlternateTransparentBC == newClickedAlternateTransparentBC) return; m_clickedAlternateTransparentBC = newClickedAlternateTransparentBC; emit clickedAlternateTransparentBCChanged(); } QBrush UKUIItemDelegate::hoveredAlternateTransparentBC() const { return m_hoveredAlternateTransparentBC; } void UKUIItemDelegate::setHoveredAlternateTransparentBC(const QBrush &newHoveredAlternateTransparentBC) { if (m_hoveredAlternateTransparentBC == newHoveredAlternateTransparentBC) return; m_hoveredAlternateTransparentBC = newHoveredAlternateTransparentBC; emit hoveredAlternateTransparentBCChanged(); } QBrush UKUIItemDelegate::disableAlternateTransparentBC() const { return m_disableAlternateTransparentBC; } void UKUIItemDelegate::setDisableAlternateTransparentBC(const QBrush &newDisableAlternateTransparentBC) { if (m_disableAlternateTransparentBC == newDisableAlternateTransparentBC) return; m_disableAlternateTransparentBC = newDisableAlternateTransparentBC; emit disableAlternateTransparentBCChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/icon.cpp0000664000175000017500000000043015154306200024677 0ustar fengfeng#include "icon.h" #include "qdebug.h" #include "qpixmap.h" #include "qimage.h" #include #include #include #include #include #include using namespace UKUIQQC2Style; Icon::Icon(QObject *parent) : QObject(parent) { } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuicheckbox.h0000664000175000017500000004245715154306200026117 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUICHECKBOX_H #define UKUICHECKBOX_H #include #include #include #include #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(QBrush disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(QBrush normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged) Q_PROPERTY(QBrush normalIndicatorColor READ normalIndicatorColor WRITE setNormalIndicatorColor NOTIFY normalIndicatorColorChanged) Q_PROPERTY(QBrush hoverIndicatorColor READ hoverIndicatorColor WRITE setHoverIndicatorColor NOTIFY hoverIndicatorColorChanged) Q_PROPERTY(QBrush clickIndicatorColor READ clickIndicatorColor WRITE setClickIndicatorColor NOTIFY clickIndicatorColorChanged) Q_PROPERTY(QBrush disableIndicatorColor READ disableIndicatorColor WRITE setDisableIndicatorColor NOTIFY disableIndicatorColorChanged) Q_PROPERTY(QBrush normalIndicatorBorderColor READ normalIndicatorBorderColor WRITE setNormalIndicatorBorderColor NOTIFY normalIndicatorBorderColorChanged) Q_PROPERTY(QBrush hoverIndicatorBorderColor READ hoverIndicatorBorderColor WRITE setHoverIndicatorBorderColor NOTIFY hoverIndicatorBorderColorChanged) Q_PROPERTY(QBrush clickIndicatorBorderColor READ clickIndicatorBorderColor WRITE setClickIndicatorBorderColor NOTIFY clickIndicatorBorderColorChanged) Q_PROPERTY(QBrush disableIndicatorBorderColor READ disableIndicatorBorderColor WRITE setDisableIndicatorBorderColor NOTIFY disableIndicatorBorderColorChanged) Q_PROPERTY(QBrush checked_normalIndicatorColor READ checked_normalIndicatorColor WRITE setChecked_NormalIndicatorColor NOTIFY checked_normalIndicatorColorChanged) Q_PROPERTY(QBrush checked_hoverIndicatorColor READ checked_hoverIndicatorColor WRITE setChecked_HoverIndicatorColor NOTIFY checked_hoverIndicatorColorChanged) Q_PROPERTY(QBrush checked_clickIndicatorColor READ checked_clickIndicatorColor WRITE setChecked_ClickIndicatorColor NOTIFY checked_clickIndicatorColorChanged) Q_PROPERTY(QBrush checked_disableIndicatorColor READ checked_disableIndicatorColor WRITE setChecked_DisableIndicatorColor NOTIFY checked_disableIndicatorColorChanged) Q_PROPERTY(QBrush checked_normalIndicatorBorderColor READ checked_normalIndicatorBorderColor WRITE setChecked_NormalIndicatorBorderColor NOTIFY checked_normalIndicatorBorderColorChanged) Q_PROPERTY(QBrush checked_hoverIndicatorBorderColor READ checked_hoverIndicatorBorderColor WRITE setChecked_HoverIndicatorBorderColor NOTIFY checked_hoverIndicatorBorderColorChanged) Q_PROPERTY(QBrush checked_clickIndicatorBorderColor READ checked_clickIndicatorBorderColor WRITE setChecked_ClickIndicatorBorderColor NOTIFY checked_clickIndicatorBorderColorChanged) Q_PROPERTY(QBrush checked_disableIndicatorBorderColor READ checked_disableIndicatorBorderColor WRITE setChecked_DisableIndicatorBorderColor NOTIFY checked_disableIndicatorBorderColorChanged) Q_PROPERTY(QBrush checked_normalChildrenColor READ checked_normalChildrenColor WRITE setChecked_NormalChildrenColor NOTIFY checked_normalChildrenColorChanged) Q_PROPERTY(QBrush checked_hoverChildrenColor READ checked_hoverChildrenColor WRITE setChecked_HoverChildrenColor NOTIFY checked_hoverChildrenColorChanged) Q_PROPERTY(QBrush checked_clickChildrenColor READ checked_clickChildrenColor WRITE setChecked_ClickChildrenColor NOTIFY checked_clickChildrenColorChanged) Q_PROPERTY(QBrush checked_disableChildrenColor READ checked_disableChildrenColor WRITE setChecked_DisableChildrenColor NOTIFY checked_disableChildrenColorChanged) Q_PROPERTY(QBrush checked_normalChildrenBorderColor READ checked_normalChildrenBorderColor WRITE setChecked_NormalChildrenBorderColor NOTIFY checked_normalChildrenBorderColorChanged) Q_PROPERTY(QBrush checked_hoverChildrenBorderColor READ checked_hoverChildrenBorderColor WRITE setChecked_HoverChildrenBorderColor NOTIFY checked_hoverChildrenBorderColorChanged) Q_PROPERTY(QBrush checked_clickChildrenBorderColor READ checked_clickChildrenBorderColor WRITE setChecked_ClickChildrenBorderColor NOTIFY checked_clickChildrenBorderColorChanged) Q_PROPERTY(QBrush checked_disableChildrenBorderColor READ checked_disableChildrenBorderColor WRITE setChecked_DisableChildrenBorderColor NOTIFY checked_disableChildrenBorderColorChanged) Q_PROPERTY(QBrush normalTransparentIndicatorColor READ normalTransparentIndicatorColor WRITE setNormalTransparentIndicatorColor NOTIFY normalTransparentIndicatorColorChanged) Q_PROPERTY(QBrush hoverTransparentIndicatorColor READ hoverTransparentIndicatorColor WRITE setHoverTransparentIndicatorColor NOTIFY hoverTransparentIndicatorColorChanged) Q_PROPERTY(QBrush clickTransparentIndicatorColor READ clickTransparentIndicatorColor WRITE setClickTransparentIndicatorColor NOTIFY clickTransparentIndicatorColorChanged) Q_PROPERTY(QBrush disableTransparentIndicatorColor READ disableTransparentIndicatorColor WRITE setDisableTransparentIndicatorColor NOTIFY disableTransparentIndicatorColorChanged) Q_PROPERTY(QBrush normalTransparentIndicatorBorderColor READ normalTransparentIndicatorBorderColor WRITE setNormalTransparentIndicatorBorderColor NOTIFY normalTransparentIndicatorBorderColorChanged) Q_PROPERTY(QBrush hoverTransparentIndicatorBorderColor READ hoverTransparentIndicatorBorderColor WRITE setHoverTransparentIndicatorBorderColor NOTIFY hoverTransparentIndicatorBorderColorChanged) Q_PROPERTY(QBrush clickTransparentIndicatorBorderColor READ clickTransparentIndicatorBorderColor WRITE setClickTransparentIndicatorBorderColor NOTIFY clickTransparentIndicatorBorderColorChanged) Q_PROPERTY(QBrush disableTransparentIndicatorBorderColor READ disableTransparentIndicatorBorderColor WRITE setDisableTransparentIndicatorBorderColor NOTIFY disableTransparentIndicatorBorderColorChanged) 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); Q_INVOKABLE QBrush disableTextColor() const; void setDisableTextColor(QBrush newDisableTextColor); Q_INVOKABLE QBrush normalTextColor() const; void setNormalTextColor(QBrush newNormalTextColor); Q_INVOKABLE QBrush normalIndicatorColor() const; void setNormalIndicatorColor(QBrush newNormalIndicatorColor); Q_INVOKABLE QBrush hoverIndicatorColor() const; void setHoverIndicatorColor(QBrush newHoverIndicatorColor); Q_INVOKABLE QBrush clickIndicatorColor() const; void setClickIndicatorColor(QBrush newClickIndicatorColor); Q_INVOKABLE QBrush disableIndicatorColor() const; void setDisableIndicatorColor(QBrush newDisableIndicatorColor); Q_INVOKABLE QBrush normalIndicatorBorderColor() const; void setNormalIndicatorBorderColor(QBrush newNormalIndicatorBorderColor); Q_INVOKABLE QBrush hoverIndicatorBorderColor() const; void setHoverIndicatorBorderColor(QBrush newHoverIndicatorBorderColor); Q_INVOKABLE QBrush clickIndicatorBorderColor() const; void setClickIndicatorBorderColor(QBrush newClickIndicatorBorderColor); Q_INVOKABLE QBrush disableIndicatorBorderColor() const; void setDisableIndicatorBorderColor(QBrush newDisableIndicatorBorderColor); Q_INVOKABLE QBrush checked_normalIndicatorColor() const; void setChecked_NormalIndicatorColor(QBrush newChecked_normalIndicatorColor); Q_INVOKABLE QBrush checked_hoverIndicatorColor() const; void setChecked_HoverIndicatorColor(QBrush newChecked_hoverIndicatorColor); Q_INVOKABLE QBrush checked_clickIndicatorColor() const; void setChecked_ClickIndicatorColor(QBrush newChecked_clickIndicatorColor); Q_INVOKABLE QBrush checked_disableIndicatorColor() const; void setChecked_DisableIndicatorColor(QBrush newChecked_disableIndicatorColor); Q_INVOKABLE QBrush checked_normalIndicatorBorderColor() const; void setChecked_NormalIndicatorBorderColor(QBrush newChecked_normalIndicatorBorderColor); Q_INVOKABLE QBrush checked_hoverIndicatorBorderColor() const; void setChecked_HoverIndicatorBorderColor(QBrush newChecked_hoverIndicatorBorderColor); Q_INVOKABLE QBrush checked_clickIndicatorBorderColor() const; void setChecked_ClickIndicatorBorderColor(QBrush newChecked_clickIndicatorBorderColor); Q_INVOKABLE QBrush checked_disableIndicatorBorderColor() const; void setChecked_DisableIndicatorBorderColor(QBrush newChecked_disableIndicatorBorderColor); Q_INVOKABLE QBrush checked_normalChildrenColor() const; void setChecked_NormalChildrenColor(QBrush newChecked_normalChildrenColor); Q_INVOKABLE QBrush checked_hoverChildrenColor() const; void setChecked_HoverChildrenColor(QBrush newChecked_hoverChildrenColor); Q_INVOKABLE QBrush checked_clickChildrenColor() const; void setChecked_ClickChildrenColor(QBrush newChecked_clickChildrenColor); Q_INVOKABLE QBrush checked_disableChildrenColor() const; void setChecked_DisableChildrenColor(QBrush newChecked_disableChildrenColor); Q_INVOKABLE QBrush checked_normalChildrenBorderColor() const; void setChecked_NormalChildrenBorderColor(QBrush newChecked_normalChildrenBorderColor); Q_INVOKABLE QBrush checked_hoverChildrenBorderColor() const; void setChecked_HoverChildrenBorderColor(QBrush newChecked_hoverChildrenBorderColor); Q_INVOKABLE QBrush checked_clickChildrenBorderColor() const; void setChecked_ClickChildrenBorderColor(QBrush newChecked_clickChildrenBorderColor); Q_INVOKABLE QBrush checked_disableChildrenBorderColor() const; void setChecked_DisableChildrenBorderColor(QBrush 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); const QBrush &normalTransparentIndicatorColor() const; void setNormalTransparentIndicatorColor(const QBrush &newNormalTransparentIndicatorColor); const QBrush &hoverTransparentIndicatorColor() const; void setHoverTransparentIndicatorColor(const QBrush &newHoverTransparentIndicatorColor); const QBrush &clickTransparentIndicatorColor() const; void setClickTransparentIndicatorColor(const QBrush &newClickTransparentIndicatorColor); const QBrush &disableTransparentIndicatorColor() const; void setDisableTransparentIndicatorColor(const QBrush &newDisableTransparentIndicatorColor); const QBrush &normalTransparentIndicatorBorderColor() const; void setNormalTransparentIndicatorBorderColor(const QBrush &newNormalTransparentIndicatorBorderColor); const QBrush &hoverTransparentIndicatorBorderColor() const; void setHoverTransparentIndicatorBorderColor(const QBrush &newHoverTransparentIndicatorBorderColor); const QBrush &clickTransparentIndicatorBorderColor() const; void setClickTransparentIndicatorBorderColor(const QBrush &newClickTransparentIndicatorBorderColor); const QBrush &disableTransparentIndicatorBorderColor() const; void setDisableTransparentIndicatorBorderColor(const QBrush &newDisableTransparentIndicatorBorderColor); 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(); void parametryChanged(); void normalTransparentIndicatorColorChanged(); void hoverTransparentIndicatorColorChanged(); void clickTransparentIndicatorColorChanged(); void disableTransparentIndicatorColorChanged(); void normalTransparentIndicatorBorderColorChanged(); void hoverTransparentIndicatorBorderColorChanged(); void clickTransparentIndicatorBorderColorChanged(); void disableTransparentIndicatorBorderColorChanged(); private: double m_leftRightMargin; double m_upDownMargin; double m_space; Q_INVOKABLE QBrush m_disableTextColor ; Q_INVOKABLE QBrush m_normalTextColor ; Q_INVOKABLE QBrush m_normalIndicatorColor ; Q_INVOKABLE QBrush m_hoverIndicatorColor ; Q_INVOKABLE QBrush m_clickIndicatorColor ; Q_INVOKABLE QBrush m_disableIndicatorColor ; Q_INVOKABLE QBrush m_normalIndicatorBorderColor ; Q_INVOKABLE QBrush m_hoverIndicatorBorderColor ; Q_INVOKABLE QBrush m_clickIndicatorBorderColor ; Q_INVOKABLE QBrush m_disableIndicatorBorderColor ; Q_INVOKABLE QBrush m_checked_normalIndicatorColor ; Q_INVOKABLE QBrush m_checked_hoverIndicatorColor ; Q_INVOKABLE QBrush m_checked_clickIndicatorColor ; Q_INVOKABLE QBrush m_checked_disableIndicatorColor ; Q_INVOKABLE QBrush m_checked_normalIndicatorBorderColor ; Q_INVOKABLE QBrush m_checked_hoverIndicatorBorderColor ; Q_INVOKABLE QBrush m_checked_clickIndicatorBorderColor ; Q_INVOKABLE QBrush m_checked_disableIndicatorBorderColor ; Q_INVOKABLE QBrush m_checked_normalChildrenColor ; Q_INVOKABLE QBrush m_checked_hoverChildrenColor ; Q_INVOKABLE QBrush m_checked_clickChildrenColor ; Q_INVOKABLE QBrush m_checked_disableChildrenColor ; Q_INVOKABLE QBrush m_checked_normalChildrenBorderColor ; Q_INVOKABLE QBrush m_checked_hoverChildrenBorderColor ; Q_INVOKABLE QBrush m_checked_clickChildrenBorderColor ; Q_INVOKABLE QBrush m_checked_disableChildrenBorderColor ; int m_borderWidth; int m_indicatorWidth; int m_childrenWidth; int m_radius; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_normalTransparentIndicatorColor; QBrush m_hoverTransparentIndicatorColor; QBrush m_clickTransparentIndicatorColor; QBrush m_disableTransparentIndicatorColor; QBrush m_normalTransparentIndicatorBorderColor; QBrush m_hoverTransparentIndicatorBorderColor; QBrush m_clickTransparentIndicatorBorderColor; QBrush m_disableTransparentIndicatorBorderColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUICheckBox, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUICHECKBOX_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuitooltip.cpp0000664000175000017500000001056415154306200026350 0ustar fengfeng#include "ukuitooltip.h" #include "qdebug.h" #include "settings/ukui-style-settings.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(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { auto settings = UKUIStyleSettings::globalInstance(); connect(settings, &UKUIStyleSettings::changed, this, [=](const QString &key) { if (key == "menuTransparency" || key == "menu-transparency") { initParam(m_instance); return; } }, Qt::UniqueConnection ); } } } UKUIToolTip::~UKUIToolTip() { } void UKUIToolTip::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setPadding(8); setBackBorderColor(instance->kLineWindowInactive()); setBackColor(instance->kContainGeneralNormal()); //setShadowColor(instance->kShadowMin()); setTextColor(instance->windowTextActive()); setRadius(instance->kradiusMenu()); QColor c = instance->baseActive().color(); if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { auto opacity = UKUIStyleSettings::globalInstance()->get("menuTransparency").toInt()/100.0; c.setAlphaF(opacity); } setBackTransparentColor(c); setBackTransparentBorderColor(instance->kLineWindowInactive()); emit parametryChanged(); } UKUIToolTip* UKUIToolTip::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(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 QBrush &UKUIToolTip::backColor() const { return m_backColor; } void UKUIToolTip::setBackColor(const QBrush &newBackColor) { if (m_backColor == newBackColor) return; m_backColor = newBackColor; emit backColorChanged(); } const QBrush &UKUIToolTip::backBorderColor() const { return m_backBorderColor; } void UKUIToolTip::setBackBorderColor(const QBrush &newBackBorderColor) { if (m_backBorderColor == newBackBorderColor) return; m_backBorderColor = newBackBorderColor; emit backBorderColorChanged(); } const QBrush &UKUIToolTip::shadowColor() const { return m_shadowColor; } void UKUIToolTip::setShadowColor(const QBrush &newShadowColor) { if (m_shadowColor == newShadowColor) return; m_shadowColor = newShadowColor; emit shadowColorChanged(); } const QBrush &UKUIToolTip::textColor() const { return m_textColor; } void UKUIToolTip::setTextColor(const QBrush &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(); } const QBrush &UKUIToolTip::backTransparentColor() const { return m_backTransparentColor; } void UKUIToolTip::setBackTransparentColor(const QBrush &newBackTransparentColor) { if (m_backTransparentColor == newBackTransparentColor) return; m_backTransparentColor = newBackTransparentColor; emit backTransparentColorChanged(); } const QBrush &UKUIToolTip::backTransparentBorderColor() const { return m_backBorderTransparentColor; } void UKUIToolTip::setBackTransparentBorderColor(const QBrush &newBackBorderTransparentColor) { if (m_backBorderTransparentColor == newBackBorderTransparentColor) return; m_backBorderTransparentColor = newBackBorderTransparentColor; emit backTransparentBorderColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuitabbar.h0000664000175000017500000000342415154306200025553 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUITABBAR_H #define UKUITABBAR_H #include #include #include #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUITabBar : public QQuickItem { Q_OBJECT Q_PROPERTY(QBrush 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 QBrush &normalColor() const; void setNormalColor(const QBrush &newNormalColor); signals: void normalColorChanged(); void parametryChanged(); private: Q_INVOKABLE QBrush m_normalColor = QBrush(QColor("#FFFFFF")); UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUITabBar, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUITABBAR_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuitabbutton.h0000664000175000017500000001406115154306200026321 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUITABBUTTON_H #define UKUITABBUTTON_H #include #include #include #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUITabButton : public QQuickItem { Q_OBJECT Q_PROPERTY(QBrush normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged) Q_PROPERTY(QBrush hoverColor READ hoverColor WRITE setHoverColor NOTIFY hoverColorChanged) Q_PROPERTY(QBrush checkedColor READ checkedColor WRITE setCheckedColor NOTIFY checkedColorChanged) Q_PROPERTY(QBrush clickedColor READ clickedColor WRITE setClickedColor NOTIFY clickedColorChanged) Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) Q_PROPERTY(QBrush normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged) Q_PROPERTY(QBrush hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged) Q_PROPERTY(QBrush clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged) Q_PROPERTY(QBrush checkedBorderColor READ checkedBorderColor WRITE setCheckedBorderColor NOTIFY checkedBorderColorChanged) Q_PROPERTY(QBrush normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(QBrush normalTransparentColor READ normalTransparentColor WRITE setNormalTransparentColor NOTIFY normalTransparentColorChanged) Q_PROPERTY(QBrush hoverTransparentColor READ hoverTransparentColor WRITE setHoverTransparentColor NOTIFY hoverTransparentColorChanged) Q_PROPERTY(QBrush checkedTransparentColor READ checkedTransparentColor WRITE setCheckedTransparentColor NOTIFY checkedTransparentColorChanged) Q_PROPERTY(QBrush clickedTransparentColor READ clickedTransparentColor WRITE setClickedTransparentColor NOTIFY clickedTransparentColorChanged) Q_PROPERTY(QBrush focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged) public: explicit UKUITabButton(QQuickItem *parent = nullptr); ~UKUITabButton(); void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance); static UKUITabButton* qmlAttachedProperties(QObject* parent); const QBrush &normalColor() const; void setNormalColor(const QBrush &newNormalColor); const QBrush &hoverColor() const; void setHoverColor(const QBrush &newHoverColor); const QBrush &checkedColor() const; void setCheckedColor(const QBrush &newCheckedColor); const QBrush &clickedColor() const; void setClickedColor(const QBrush &newClickedColor); int borderWidth() const; void setBorderWidth(int newBorderWidth); const QBrush &normalBorderColor() const; void setNormalBorderColor(const QBrush &newNormalBorderColor); const QBrush &hoverBorderColor() const; void setHoverBorderColor(const QBrush &newHoverBorderColor); const QBrush &clickBorderColor() const; void setClickBorderColor(const QBrush &newClickBorderColor); const QBrush &checkedBorderColor() const; void setCheckedBorderColor(const QBrush &newCheckedBorderColor); const QBrush &normalTextColor() const; void setNormalTextColor(const QBrush &newNormalTextColor); const QBrush &normalTransparentColor() const; void setNormalTransparentColor(const QBrush &newNormalTransparentColor); const QBrush &hoverTransparentColor() const; void setHoverTransparentColor(const QBrush &newHoverTransparentColor); const QBrush &checkedTransparentColor() const; void setCheckedTransparentColor(const QBrush &newCheckedTransparentColor); const QBrush &clickedTransparentColor() const; void setClickedTransparentColor(const QBrush &newClickedTransparentColor); const QBrush &focusBorderColor() const; void setFocusBorderColor(const QBrush &newFocusBorderColor); signals: void normalColorChanged(); void hoverColorChanged(); void checkedColorChanged(); void clickedColorChanged(); void borderWidthChanged(); void normalBorderColorChanged(); void hoverBorderColorChanged(); void clickBorderColorChanged(); void checkedBorderColorChanged(); void disableTextColorChanged(); void parametryChanged(); void normalTransparentColorChanged(); void hoverTransparentColorChanged(); void checkedTransparentColorChanged(); void clickedTransparentColorChanged(); void focusBorderColorChanged(); private: Q_INVOKABLE QBrush m_normalColor = QBrush("#FFFFFF"); Q_INVOKABLE QBrush m_hoverColor = QBrush("#F2F2F2"); Q_INVOKABLE QBrush m_checkedColor = QBrush("#F2F2F2"); Q_INVOKABLE QBrush m_clickedColor = QBrush("#EEEEEE"); int m_borderWidth; Q_INVOKABLE QBrush m_normalBorderColor; Q_INVOKABLE QBrush m_hoverBorderColor; Q_INVOKABLE QBrush m_clickBorderColor; Q_INVOKABLE QBrush m_checkedBorderColor; Q_INVOKABLE QBrush m_normalTextColor; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_normalTransparentColor; QBrush m_hoverTransparentColor; QBrush m_checkedTransparentColor; QBrush m_clickedTransparentColor; QBrush m_focusBorderColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUITabButton, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUITABBUTTON_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiheaderview.h0000664000175000017500000000456415154306200026451 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUIHeaderView_H #define UKUIHeaderView_H #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUIHeaderView : public QQuickItem { Q_OBJECT Q_PROPERTY(QBrush normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged) Q_PROPERTY(QBrush lineColor READ lineColor WRITE setLineColor NOTIFY lineColorChanged) Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth NOTIFY lineWidthChanged) Q_PROPERTY(int normalHeight READ normalHeight WRITE setnormalHeight NOTIFY lineWidthChanged) public: explicit UKUIHeaderView(QQuickItem *parent = nullptr); ~UKUIHeaderView(); static UKUIHeaderView* qmlAttachedProperties(QObject* parent); void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance); const QBrush &normalTextColor() const; void setNormalTextColor(const QBrush &newNormalTextColor); const QBrush &lineColor() const; void setLineColor(const QBrush &newLineColor); int lineWidth() const; void setLineWidth(int newLineWidth); int normalHeight() const; void setnormalHeight(int newNormalHeight); signals: void parametryChanged(); void normalTextColorChanged(); void lineColorChanged(); void lineWidthChanged(); private: UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_normalTextColor; QBrush m_lineColor; int m_lineWidth; int m_normalHeight; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIHeaderView, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUIHeaderView_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuicombobox.h0000664000175000017500000002245215154306200026132 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUICOMBOBOX_H #define UKUICOMBOBOX_H #include #include #include #include #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(QBrush normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged) Q_PROPERTY(QBrush clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged) Q_PROPERTY(QBrush hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged) Q_PROPERTY(QBrush disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged) Q_PROPERTY(QBrush disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(QBrush 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(QBrush normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged) Q_PROPERTY(QBrush hoveredBorderColor READ hoveredBorderColor WRITE setHoveredBorderColor NOTIFY hoveredBorderColorChanged) Q_PROPERTY(QBrush clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged) Q_PROPERTY(QBrush disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged) Q_PROPERTY(QBrush focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged) Q_PROPERTY(QBrush normalTransparentBC READ normalTransparentBC WRITE setNormalTransparentBC NOTIFY normalTransparentBCChanged) Q_PROPERTY(QBrush clickedTransparentBC READ clickedTransparentBC WRITE setClickedTransparentBC NOTIFY clickedTransparentBCChanged) Q_PROPERTY(QBrush hoveredTransparentBC READ hoveredTransparentBC WRITE setHoveredTransparentBC NOTIFY hoveredTransparentBCChanged) Q_PROPERTY(QBrush disableTransparentBC READ disableTransparentBC WRITE setDisableTransparentBC NOTIFY disableTransparentBCChanged) Q_PROPERTY(QBrush normalTransparentBorderColor READ normalTransparentBorderColor WRITE setNormalTransparentBorderColor NOTIFY normalTransparentBorderColorChanged) Q_PROPERTY(QBrush clickedTransparentBorderColor READ clickedTransparentBorderColor WRITE setClickedTransparentBorderColor NOTIFY clickedTransparentBorderColorChanged) Q_PROPERTY(QBrush hoveredTransparentBorderColor READ hoveredTransparentBorderColor WRITE setHoveredTransparentBorderColor NOTIFY hoveredTransparentBorderColorChanged) Q_PROPERTY(QBrush disableTransparentBorderColor READ disableTransparentBorderColor WRITE setDisableTransparentBorderColor NOTIFY disableTransparentBorderColorChanged) 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); Q_INVOKABLE QBrush normalBC() const; void setNormalBC(QBrush newNormalBC); Q_INVOKABLE QBrush clickedBC() const; void setClickedBC(QBrush newClickedBC); Q_INVOKABLE QBrush hoveredBC() const; void setHoveredBC(QBrush newHoveredBC); Q_INVOKABLE QBrush disableBC() const; void setDisableBC(QBrush newDisableBC); Q_INVOKABLE QBrush disableTextColor() const; void setDisableTextColor(QBrush newDisableTextColor); Q_INVOKABLE QBrush normalTextColor() const; void setNormalTextColor(QBrush newNormalTextColor); int borderWidth() const; void setBorderWidth(int newBorderWidth); int focusBorderWidth() const; void setFocusBorderWidth(int newFocusBorderWidth); Q_INVOKABLE QBrush normalBorderColor() const; void setNormalBorderColor(QBrush newNormalBorderColor); Q_INVOKABLE QBrush clickBorderColor() const; void setClickBorderColor(QBrush newClickBorderColor); Q_INVOKABLE QBrush disableBorderColor() const; void setDisableBorderColor(QBrush newDisableBorderColor); Q_INVOKABLE QBrush focusBorderColor() const; void setFocusBorderColor(QBrush newFocusBorderColor); const QBrush &normalTransparentBC() const; void setNormalTransparentBC(const QBrush &newNormalTransparentBC); const QBrush &clickedTransparentBC() const; void setClickedTransparentBC(const QBrush &newClickedTransparentBC); const QBrush &hoveredTransparentBC() const; void setHoveredTransparentBC(const QBrush &newHoveredTransparentBC); const QBrush &disableTransparentBC() const; void setDisableTransparentBC(const QBrush &newDisableTransparentBC); const QBrush &hoveredBorderColor() const; void setHoveredBorderColor(const QBrush &newHoveredBorderColor); const QBrush &normalTransparentBorderColor() const; void setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor); const QBrush &clickedTransparentBorderColor() const; void setClickedTransparentBorderColor(const QBrush &newClickedTransparentBorderColor); const QBrush &hoveredTransparentBorderColor() const; void setHoveredTransparentBorderColor(const QBrush &newHoveredTransparentBorderColor); const QBrush &disableTransparentBorderColor() const; void setDisableTransparentBorderColor(const QBrush &newDisableTransparentBorderColor); 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 parametryChanged(); void normalTransparentBCChanged(); void clickedTransparentBCChanged(); void hoveredTransparentBCChanged(); void disableTransparentBCChanged(); void hoveredBorderColorChanged(); void normalTransparentBorderColorChanged(); void clickedTransparentBorderColorChanged(); void hoveredTransparentBorderColorChanged(); void disableTransparentBorderColorChanged(); 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; Q_INVOKABLE QBrush m_normalBC ; Q_INVOKABLE QBrush m_clickedBC ; Q_INVOKABLE QBrush m_hoveredBC ; Q_INVOKABLE QBrush m_disableBC ; Q_INVOKABLE QBrush m_disableTextColor ; Q_INVOKABLE QBrush m_normalTextColor ; Q_INVOKABLE QBrush m_normalBorderColor ; Q_INVOKABLE QBrush m_clickBorderColor ; Q_INVOKABLE QBrush m_disableBorderColor ; Q_INVOKABLE QBrush m_focusBorderColor ; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_normalTransparentBC; QBrush m_clickedTransparentBC; QBrush m_hoveredTransparentBC; QBrush m_disableTransparentBC; QBrush m_hoveredBorderColor; QBrush m_normalTransparentBorderColor; QBrush m_clickedTransparentBorderColor; QBrush m_hoveredTransparentBorderColor; QBrush m_disableTransparentBorderColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIComboBox, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUICOMBOBOX_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuibutton.h0000664000175000017500000005070715154306200025641 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUIBUTTON_H #define UKUIBUTTON_H #include #include #include #include #include "tokenparameter.h" #include "parsecolorinterface.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(QBrush normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged) Q_PROPERTY(QBrush clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged) Q_PROPERTY(QBrush hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged) Q_PROPERTY(QBrush disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged) Q_PROPERTY(QBrush disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(QBrush normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged) Q_PROPERTY(QBrush highlightTextColor READ highlightTextColor WRITE setHighlightTextColor NOTIFY highlightTextColorChanged) Q_PROPERTY(QBrush highlightTextDisableColor READ highlightTextDisableColor WRITE setHighlightTextDisableColor NOTIFY highlightTextDisableColorChanged) Q_PROPERTY(QBrush normalHBC READ normalHBC WRITE setNormalHBC NOTIFY normalHBCChanged) Q_PROPERTY(QBrush clickedHBC READ clickedHBC WRITE setClickedHBC NOTIFY clickedHBCChanged) Q_PROPERTY(QBrush hoveredHBC READ hoveredHBC WRITE setHoveredHBC NOTIFY hoveredHBCChanged) Q_PROPERTY(QBrush 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(QBrush normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged) Q_PROPERTY(QBrush hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged) Q_PROPERTY(QBrush clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged) Q_PROPERTY(QBrush disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged) Q_PROPERTY(QBrush focusBorderColor READ focusBorderColor WRITE setFocusBorderColor NOTIFY focusBorderColorChanged) Q_PROPERTY(QBrush normalBorderHColor READ normalBorderHColor WRITE setNormalBorderHColor NOTIFY normalBorderHColorChanged) Q_PROPERTY(QBrush hoverBorderHColor READ hoverBorderHColor WRITE setHoverBorderHColor NOTIFY hoverBorderHColorChanged) Q_PROPERTY(QBrush clickBorderHColor READ clickBorderHColor WRITE setClickBorderHColor NOTIFY clickBorderHColorChanged) Q_PROPERTY(QBrush disableBorderHColor READ disableBorderHColor WRITE setDisableBorderHColor NOTIFY disableBorderHColorChanged) Q_PROPERTY(QBrush normalCloseBC READ normalCloseBC WRITE setNormalCloseBC NOTIFY normalCloseBCChanged) Q_PROPERTY(QBrush clickedCloseBC READ clickedCloseBC WRITE setClickedCloseBC NOTIFY clickedCloseBCChanged) Q_PROPERTY(QBrush hoveredCloseBC READ hoveredCloseBC WRITE setHoveredClosedBC NOTIFY hoveredCloseBCChanged) Q_PROPERTY(QBrush disableCloseBC READ disableCloseBC WRITE setDisableCloseBC NOTIFY disableCloseBCChanged) Q_PROPERTY(QBrush normalBorderCloseColor READ normalBorderCloseColor WRITE setNormalBorderCloseColor NOTIFY normalBorderCloseColorChanged) Q_PROPERTY(QBrush hoverBorderCloseColor READ hoverBorderCloseColor WRITE setHoverBorderCloseColor NOTIFY hoverBorderCloseColorChanged) Q_PROPERTY(QBrush clickBorderCloseColor READ clickBorderCloseColor WRITE setClickBorderCloseColor NOTIFY clickBorderCloseColorChanged) Q_PROPERTY(QBrush disableBorderCloseColor READ disableBorderCloseColor WRITE setDisableBorderCloseColor NOTIFY disableBorderCloseColorChanged) Q_PROPERTY(QBrush normalWindowBC READ normalWindowBC WRITE setNormalWindowBC NOTIFY normalWindowBCChanged) Q_PROPERTY(QBrush clickedWindowBC READ clickedWindowBC WRITE setClickedWindowBC NOTIFY clickedWindowBCChanged) Q_PROPERTY(QBrush hoveredWindowBC READ hoveredWindowBC WRITE setHoveredWindowBC NOTIFY hoveredWindowBCChanged) Q_PROPERTY(QBrush disableWindowBC READ disableWindowBC WRITE setDisableWindowBC NOTIFY disableWindowBCChanged) Q_PROPERTY(QBrush normalBorderWindowColor READ normalBorderWindowColor WRITE setNormalBorderWindowColor NOTIFY normalBorderWindowColorChanged) Q_PROPERTY(QBrush hoverBorderWindowColor READ hoverBorderWindowColor WRITE setHoverBorderWindowColor NOTIFY hoverBorderWindowColorChanged) Q_PROPERTY(QBrush clickBorderWindowColor READ clickBorderWindowColor WRITE setClickBorderWindowColor NOTIFY clickBorderWindowColorChanged) Q_PROPERTY(QBrush disableBorderWindowColor READ disableBorderWindowColor WRITE setDisableBorderWindowColor NOTIFY disableBorderWindowColorChanged) Q_PROPERTY(QBrush normalTransparentBC READ normalTransparentBC WRITE setNormalTransparentBC NOTIFY normalTransparentBCChanged) Q_PROPERTY(QBrush clickedTransparentBC READ clickedTransparentBC WRITE setClickedTransparentBC NOTIFY clickedTransparentBCChanged) Q_PROPERTY(QBrush hoveredTransparentBC READ hoveredTransparentBC WRITE setHoveredTransparentBC NOTIFY hoveredTransparentBCChanged) Q_PROPERTY(QBrush disableTransparentBC READ disableTransparentBC WRITE setDisableTransparentBC NOTIFY disableTransparentBCChanged) Q_PROPERTY(QBrush normalBorderTransparentBC READ normalBorderTransparentBC WRITE setNormalBorderTransparentBC NOTIFY normalBorderTransparentBCChanged) Q_PROPERTY(QBrush clickedBorderTransparentBC READ clickedBorderTransparentBC WRITE setClickedBorderTransparentBC NOTIFY clickedBorderTransparentBCChanged) Q_PROPERTY(QBrush hoveredBorderTransparentBC READ hoveredBorderTransparentBC WRITE setHoveredBorderTransparentBC NOTIFY hoveredBorderTransparentBCChanged) Q_PROPERTY(QBrush disableBorderTransparentBC READ disableBorderTransparentBC WRITE setDisableBorderTransparentBC NOTIFY disableBorderTransparentBCChanged) Q_PROPERTY(QBrush normalWindowTransparentBC READ normalWindowTransparentBC WRITE setNormalWindowTransparentBC NOTIFY normalWindowTransparentBCChanged) Q_PROPERTY(QBrush clickedWindowTransparentBC READ clickedWindowTransparentBC WRITE setClickedWindowTransparentBC NOTIFY clickedWindowTransparentBCChanged) Q_PROPERTY(QBrush hoveredWindowTransparentBC READ hoveredWindowTransparentBC WRITE setHoveredWindowTransparentBC NOTIFY hoveredWindowTransparentBCChanged) Q_PROPERTY(QBrush disableWindowTransparentBC READ disableWindowTransparentBC WRITE setDisableWindowTransparentBC NOTIFY disableWindowTransparentBCChanged) Q_PROPERTY(QBrush normalBorderWindowTransparentColor READ normalBorderWindowTransparentColor WRITE setNormalBorderWindowTransparentColor NOTIFY normalBorderWindowTransparentColorChanged) Q_PROPERTY(QBrush hoveredBorderWindowTransparentColor READ hoveredBorderWindowTransparentColor WRITE setHoveredBorderWindowTransparentColor NOTIFY hoveredBorderWindowTransparentColorChanged) Q_PROPERTY(QBrush clickedBorderWindowTransparentColor READ clickedBorderWindowTransparentColor WRITE setClickedBorderWindowTransparentColor NOTIFY clickedBorderWindowTransparentColorChanged) Q_PROPERTY(QBrush disableBorderWindowTransparentColor READ disableBorderWindowTransparentColor WRITE setDisableBorderWindowTransparentColor NOTIFY disableBorderWindowTransparentColorChanged) 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); Q_INVOKABLE QBrush normalBC() const; void setNormalBC(QBrush newNormalBC); Q_INVOKABLE QBrush clickedBC() const; void setClickedBC(QBrush newClickedBC); Q_INVOKABLE QBrush hoveredBC() const; void setHoveredBC(QBrush newHoveredBC); Q_INVOKABLE QBrush disableBC() const; void setDisableBC(QBrush newDisableBC); Q_INVOKABLE QBrush disableTextColor() const; void setDisableTextColor(QBrush newDisableTextColor); Q_INVOKABLE QBrush normalTextColor() const; void setNormalTextColor(QBrush newNormalTextColor); Q_INVOKABLE QBrush normalHBC() const; void setNormalHBC(QBrush newNormalHBC); Q_INVOKABLE QBrush clickedHBC() const; void setClickedHBC(QBrush newClickedHBC); Q_INVOKABLE QBrush hoveredHBC(); void setHoveredHBC(QBrush newHoveredHBC); Q_INVOKABLE QBrush disableHBC() const; void setDisableHBC(QBrush newDisableHBC); int borderWidth() const; void setBorderWidth(int newBorderWidth); Q_INVOKABLE QBrush normalBorderColor() const; void setNormalBorderColor(QBrush newNormalBorderColor); Q_INVOKABLE QBrush hoverBorderColor() const; void setHoverBorderColor(QBrush newHoverBorderColor); Q_INVOKABLE QBrush clickBorderColor() const; void setClickBorderColor(QBrush newClickBorderColor); Q_INVOKABLE QBrush disableBorderColor() const; void setDisableBorderColor(QBrush newDisableBorderColor); Q_INVOKABLE QBrush normalBorderHColor() const; void setNormalBorderHColor(QBrush newNormalBorderHColor); Q_INVOKABLE QBrush hoverBorderHColor() const; void setHoverBorderHColor(QBrush newHoverBorderHColor); Q_INVOKABLE QBrush clickBorderHColor() const; void setClickBorderHColor(QBrush newClickBorderHColor); Q_INVOKABLE QBrush disableBorderHColor() const; void setDisableBorderHColor(QBrush newDisableBorderHColor); Q_INVOKABLE QBrush focusBorderColor() const; void setFocusBorderColor(QBrush newFocusBorderColor); int focusBorderWidth() const; void setFocusBorderWidth(int newFocusBorderWidth); Q_INVOKABLE QBrush highlightTextColor() const; void setHighlightTextColor(QBrush newHighlightTextColor); Q_INVOKABLE QBrush highlightTextDisableColor() const; void setHighlightTextDisableColor(QBrush newHighlightTextDisableColor); const QBrush &normalCloseBC() const; void setNormalCloseBC(const QBrush &newNormalCloseBC); const QBrush &clickedCloseBC() const; void setClickedCloseBC(const QBrush &newClickedCloseBC); const QBrush &hoveredCloseBC() const; void setHoveredClosedBC(const QBrush &newHoveredCloseBC); const QBrush &disableCloseBC() const; void setDisableCloseBC(const QBrush &newDisableCloseBC); const QBrush &normalBorderCloseColor() const; void setNormalBorderCloseColor(const QBrush &newNormalBorderCloseColor); const QBrush &hoverBorderCloseColor() const; void setHoverBorderCloseColor(const QBrush &newHoverBorderCloseColor); const QBrush &clickBorderCloseColor() const; void setClickBorderCloseColor(const QBrush &newClickBorderCloseColor); const QBrush &disableBorderCloseColor() const; void setDisableBorderCloseColor(const QBrush &newDisableBorderCloseColor); const QBrush &normalWindowBC() const; void setNormalWindowBC(const QBrush &newNormalWindowBC); const QBrush &clickedWindowBC() const; void setClickedWindowBC(const QBrush &newClickedWindowBC); const QBrush &hoveredWindowBC() const; void setHoveredWindowBC(const QBrush &newHoveredWindowBC); const QBrush &disableWindowBC() const; void setDisableWindowBC(const QBrush &newDisableWindowBC); const QBrush &normalBorderWindowColor() const; void setNormalBorderWindowColor(const QBrush &newNormalBorderWindowColor); const QBrush &hoverBorderWindowColor() const; void setHoverBorderWindowColor(const QBrush &newHoverBorderWindowColor); const QBrush &clickBorderWindowColor() const; void setClickBorderWindowColor(const QBrush &newClickBorderWindowColor); const QBrush &disableBorderWindowColor() const; void setDisableBorderWindowColor(const QBrush &newDisableBorderWindowColor); const QBrush &normalTransparentBC() const; void setNormalTransparentBC(const QBrush &newNormalTransparentBC); const QBrush &clickedTransparentBC() const; void setClickedTransparentBC(const QBrush &newClickedTransparentBC); const QBrush &hoveredTransparentBC() const; void setHoveredTransparentBC(const QBrush &newHoveredTransparentBC); const QBrush &disableTransparentBC() const; void setDisableTransparentBC(const QBrush &newDisableTransparentBC); const QBrush &normalBorderTransparentBC() const; void setNormalBorderTransparentBC(const QBrush &newNormalBorderTransparentBC); const QBrush &clickedBorderTransparentBC() const; void setClickedBorderTransparentBC(const QBrush &newClickedBorderTransparentBC); const QBrush &hoveredBorderTransparentBC() const; void setHoveredBorderTransparentBC(const QBrush &newHoveredBorderTransparentBC); const QBrush &disableBorderTransparentBC() const; void setDisableBorderTransparentBC(const QBrush &newDisableBorderTransparentBC); const QBrush &normalWindowTransparentBC() const; void setNormalWindowTransparentBC(const QBrush &newNormalWindowTransparentBC); const QBrush &clickedWindowTransparentBC() const; void setClickedWindowTransparentBC(const QBrush &newClickedWindowTransparentBC); const QBrush &hoveredWindowTransparentBC() const; void setHoveredWindowTransparentBC(const QBrush &newHoveredWindowTransparentBC); const QBrush &disableWindowTransparentBC() const; void setDisableWindowTransparentBC(const QBrush &newDisableWindowTransparentBC); const QBrush &normalBorderWindowTransparentColor() const; void setNormalBorderWindowTransparentColor(const QBrush &newNormalBorderWindowTransparentColor); const QBrush &hoveredBorderWindowTransparentColor() const; void setHoveredBorderWindowTransparentColor(const QBrush &newHoveredBorderWindowTransparentColor); const QBrush &clickedBorderWindowTransparentColor() const; void setClickedBorderWindowTransparentColor(const QBrush &newClickedBorderWindowTransparentColor); const QBrush &disableBorderWindowTransparentColor() const; void setDisableBorderWindowTransparentColor(const QBrush &newDisableBorderWindowTransparentColor); 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(); void highlightTextColorChanged(); void highlightTextDisableColorChanged(); void parametryChanged(); void normalCloseBCChanged(); void clickedCloseBCChanged(); void hoveredCloseBCChanged(); void disableCloseBCChanged(); void normalBorderCloseColorChanged(); void hoverBorderCloseColorChanged(); void clickBorderCloseColorChanged(); void disableBorderCloseColorChanged(); void normalWindowBCChanged(); void clickedWindowBCChanged(); void hoveredWindowBCChanged(); void disableWindowBCChanged(); void normalBorderWindowColorChanged(); void hoverBorderWindowColorChanged(); void clickBorderWindowColorChanged(); void disableBorderWindowColorChanged(); void normalTransparentBCChanged(); void clickedTransparentBCChanged(); void hoveredTransparentBCChanged(); void disableTransparentBCChanged(); void normalBorderTransparentBCChanged(); void clickedBorderTransparentBCChanged(); void hoveredBorderTransparentBCChanged(); void disableBorderTransparentBCChanged(); void normalWindowTransparentBCChanged(); void clickedWindowTransparentBCChanged(); void hoveredWindowTransparentBCChanged(); void disableWindowTransparentBCChanged(); void normalBorderWindowTransparentColorChanged(); void hoveredBorderWindowTransparentColorChanged(); void clickedBorderWindowTransparentColorChanged(); void disableBorderWindowTransparentColorChanged(); private: double m_radius = 6.0; double m_leftRightMargin = 8.0; double m_upDownMargin = 4.0; double m_space = 4.0; int m_normalWidth = 96; int m_normalHeight = 36; int m_borderWidth; int m_focusBorderWidth; QBrush m_normalBC ; QBrush m_clickedBC ; QBrush m_hoveredBC ; QBrush m_disableBC ; QBrush m_disableTextColor ; QBrush m_normalTextColor ; QBrush m_normalHBC ; QBrush m_clickedHBC ; QBrush m_hoveredHBC ; QBrush m_disableHBC ; QBrush m_normalBorderColor ; QBrush m_hoverBorderColor ; QBrush m_clickBorderColor ; QBrush m_disableBorderColor ; QBrush m_normalBorderHColor ; QBrush m_hoverBorderHColor ; QBrush m_clickBorderHColor ; QBrush m_disableBorderHColor ; QBrush m_focusBorderColor ; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_highlightTextColor; QBrush m_highlightTextDisableColor; QBrush m_normalCloseBC; QBrush m_clickedCloseBC; QBrush m_hoveredCloseBC; QBrush m_disableCloseBC; QBrush m_normalBorderCloseColor; QBrush m_hoverBorderCloseColor; QBrush m_clickBorderCloseColor; QBrush m_disableBorderCloseColor; QBrush m_normalWindowBC; QBrush m_clickedWindowBC; QBrush m_hoveredWindowBC; QBrush m_disableWindowBC; QBrush m_normalBorderWindowColor; QBrush m_hoverBorderWindowColor; QBrush m_clickBorderWindowColor; QBrush m_disableBorderWindowColor; QBrush m_normalTransparentBC; QBrush m_clickedTransparentBC; QBrush m_hoveredTransparentBC; QBrush m_disableTransparentBC; QBrush m_normalBorderTransparentBC; QBrush m_clickedBorderTransparentBC; QBrush m_hoveredBorderTransparentBC; QBrush m_disableBorderTransparentBC; QBrush m_normalWindowTransparentBC; QBrush m_clickedWindowTransparentBC; QBrush m_hoveredWindowTransparentBC; QBrush m_disableWindowTransparentBC; QBrush m_normalBorderWindowTransparentColor; QBrush m_hoveredBorderWindowTransparentColor; QBrush m_clickedBorderWindowTransparentColor; QBrush m_disableBorderWindowTransparentColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIButton, QML_HAS_ATTACHED_PROPERTIES) //Q_DECLARE_METATYPE(UKUIQQC2Style::UKUIButton); //Q_DECLARE_METATYPE(std::shared_ptr) #endif // UKUIBUTTON_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiscrollbar.cpp0000664000175000017500000001017615154306200026640 0ustar fengfeng#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(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUIScrollBar::~UKUIScrollBar() { } void UKUIScrollBar::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setNormalColor(instance->kComponentSelectedNormal()); setHoverColor(instance->kComponentSelectedHover()); setClickColor(instance->kComponentSelectedClick()); setDisableColor(instance->kComponentSelectedDisable()); setNormalTransparentColor(instance->kComponentSelectedAlphaNormal()); setHoverTransparentColor(instance->kComponentSelectedAlphaHover()); setClickTransparentColor(instance->kComponentSelectedAlphaClick()); setDisableTransparentColor(instance->kComponentSelectedAlphaDisable()); emit parametryChanged(); } UKUIScrollBar* UKUIScrollBar::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUIScrollBar(p); } const QBrush &UKUIScrollBar::normalColor() const { return m_normalColor; } void UKUIScrollBar::setNormalColor(const QBrush &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 QBrush &UKUIScrollBar::hoverColor() const { return m_hoverColor; } void UKUIScrollBar::setHoverColor(const QBrush &newHoverColor) { if (m_hoverColor == newHoverColor) return; m_hoverColor = newHoverColor; emit hoverColorChanged(); } const QBrush &UKUIScrollBar::clickColor() const { return m_clickColor; } void UKUIScrollBar::setClickColor(const QBrush &newClickColor) { if (m_clickColor == newClickColor) return; m_clickColor = newClickColor; emit clickColorChanged(); } const QBrush &UKUIScrollBar::disableColor() const { return m_disableColor; } void UKUIScrollBar::setDisableColor(const QBrush &newDisableColor) { if (m_disableColor == newDisableColor) return; m_disableColor = newDisableColor; emit disableColorChanged(); } const QBrush &UKUIScrollBar::normalTransparentColor() const { return m_normalTransparentColor; } void UKUIScrollBar::setNormalTransparentColor(const QBrush &newNormalTransparentColor) { if (m_normalTransparentColor == newNormalTransparentColor) return; m_normalTransparentColor = newNormalTransparentColor; emit normalTransparentColorChanged(); } const QBrush &UKUIScrollBar::hoverTransparentColor() const { return m_hoverTransparentColor; } void UKUIScrollBar::setHoverTransparentColor(const QBrush &newHoverTransparentColor) { if (m_hoverTransparentColor == newHoverTransparentColor) return; m_hoverTransparentColor = newHoverTransparentColor; emit hoverTransparentColorChanged(); } const QBrush &UKUIScrollBar::clickTransparentColor() const { return m_clickTransparentColor; } void UKUIScrollBar::setClickTransparentColor(const QBrush &newClickTransparentColor) { if (m_clickTransparentColor == newClickTransparentColor) return; m_clickTransparentColor = newClickTransparentColor; emit clickTransparentColorChanged(); } const QBrush &UKUIScrollBar::disableTransparentColor() const { return m_disableTransparentColor; } void UKUIScrollBar::setDisableTransparentColor(const QBrush &newDisableTransparentColor) { if (m_disableTransparentColor == newDisableTransparentColor) return; m_disableTransparentColor = newDisableTransparentColor; emit disableTransparentColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuibutton.cpp0000664000175000017500000006124515154306200026173 0ustar fengfeng#include #include "ukuibutton.h" #include "qdebug.h" using namespace UKUIQQC2Style; UKUIButton::UKUIButton(QQuickItem *parent) : QQuickItem(parent) { { m_normalBC = QBrush(QColor("#E6E6E6")); m_clickedBC = QBrush(QColor("#B9B9B9")); m_hoveredBC = QBrush(QColor("#DCDCDC")); m_disableBC = QBrush(QColor("#EEEEEE")); m_disableTextColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.35)); m_normalTextColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.85)); m_normalHBC = QBrush(QColor("#3790FA")); m_clickedHBC = QBrush(QColor("#3790FA")); m_hoveredHBC = QBrush(QColor("#3790FA")); m_disableHBC = QBrush(QColor("#EEEEEE")); m_highlightTextColor = QBrush(QColor("#FFFFFF")); m_highlightTextDisableColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.35)); } if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); connect(qApp, &QApplication::paletteChanged, this, [=](const QPalette &pal){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUIButton::~UKUIButton() { } UKUIButton* UKUIButton::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUIButton(p); } void UKUIButton::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setNormalBC(instance->kComponentNormal()); setClickedBC(instance->kComponentClick()); setHoveredBC(instance->kComponentHover()); setDisableBC(instance->kComponentDisable()); // qDebug() << "kComponentHover...." << instance->kComponentHover().gradient(); // if(instance->kComponentHover().gradient() && instance->kComponentHover().gradient()->stops().length() >= 2){ // qDebug() << "second0" << instance->kComponentHover().gradient()->stops().at(0).second; // qDebug() << "second1" << instance->kComponentHover().gradient()->stops().at(1).second; // } setNormalHBC(instance->kBrandNormal()); setHoveredHBC(instance->kBrandHover()); setClickedHBC(instance->kBrandClick()); setDisableHBC(instance->kBrandDisable()); setNormalTextColor(instance->kFontPrimary()); setDisableTextColor(instance->kFontPrimaryDisable()); setHighlightTextColor(instance->kFontWhite()); setHighlightTextDisableColor(instance->kFontWhiteDisable()); setBorderWidth(1); setFocusBorderWidth(1);//instance->focusline()); setNormalBorderColor(instance->kLineComponentNormal()); setClickBorderColor(instance->kLineComponentClick()); setHoverBorderColor(instance->kLineComponentHover()); setDisableBorderColor(instance->kLineComponentDisable()); setNormalBorderHColor(instance->kLineComponentNormal()); setClickBorderHColor(instance->kLineComponentClick()); setHoverBorderHColor(instance->kLineComponentHover()); setDisableBorderHColor(instance->kLineComponentDisable()); setFocusBorderColor(instance->kBrandFocus()); setRadius(instance->kradiusNormal()); setNormalCloseBC(instance->kGrayAlpha0()); setClickedCloseBC(instance->kErrorClick()); setHoveredClosedBC(instance->kErrorHover()); setDisableCloseBC(instance->kGrayAlpha0()); setNormalBorderCloseColor(QBrush(QColor(0,0,0,0))); setHoverBorderCloseColor(QBrush(QColor(0,0,0,0))); setClickBorderCloseColor(QBrush(QColor(0,0,0,0))); setDisableBorderCloseColor(QBrush(QColor(0,0,0,0))); setNormalWindowBC(instance->kGrayAlpha0()); setClickedWindowBC(instance->kComponentClick()); setHoveredWindowBC(instance->kComponentHover()); setDisableWindowBC(instance->kGrayAlpha0()); setNormalBorderWindowColor(QBrush(QColor(0,0,0,0))); setHoverBorderWindowColor(QBrush(QColor(0,0,0,0))); setClickBorderWindowColor(QBrush(QColor(0,0,0,0))); setDisableBorderWindowColor(QBrush(QColor(0,0,0,0))); setNormalTransparentBC(instance->kComponentAlphaNormal()); setHoveredTransparentBC(instance->kComponentAlphaHover()); setClickedTransparentBC(instance->kComponentAlphaClick()); setDisableTransparentBC(instance->kComponentAlphaDisable()); setNormalBorderTransparentBC(instance->kLineComponentNormal()); setHoveredBorderTransparentBC(instance->kLineComponentHover()); setClickedBorderTransparentBC(instance->kLineComponentClick()); setDisableBorderTransparentBC(instance->kLineComponentDisable()); setNormalWindowTransparentBC(instance->kGrayAlpha0()); setClickedWindowTransparentBC(instance->kComponentAlphaClick()); setHoveredWindowTransparentBC(instance->kComponentAlphaHover()); setDisableWindowTransparentBC(instance->kGrayAlpha0()); setNormalBorderWindowTransparentColor(QBrush(QColor(0,0,0,0))); setHoveredBorderWindowTransparentColor(QBrush(QColor(0,0,0,0))); setClickedBorderWindowTransparentColor(QBrush(QColor(0,0,0,0))); setDisableBorderWindowTransparentColor(QBrush(QColor(0,0,0,0))); emit parametryChanged(); // 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(); } QBrush UKUIButton::normalBC() const { return m_normalBC; } void UKUIButton::setNormalBC(QBrush newNormalBC) { if (m_normalBC != newNormalBC) { m_normalBC = newNormalBC; emit normalBCChanged(); } } QBrush UKUIButton::clickedBC() const { return m_clickedBC; } void UKUIButton::setClickedBC(QBrush newClickedBC) { if (m_clickedBC != newClickedBC){ m_clickedBC = newClickedBC; emit clickedBCChanged(); } } QBrush UKUIButton::hoveredBC() const { return m_hoveredBC; } void UKUIButton::setHoveredBC(QBrush newHoveredBC) { if (m_hoveredBC != newHoveredBC){ m_hoveredBC = newHoveredBC; emit hoveredBCChanged(); } } QBrush UKUIButton::disableBC() const { return m_disableBC; } void UKUIButton::setDisableBC(QBrush newDisableBC) { if (m_disableBC != newDisableBC){ m_disableBC = newDisableBC; emit disableBCChanged(); } } QBrush UKUIButton::disableTextColor() const { return m_disableTextColor; } void UKUIButton::setDisableTextColor(QBrush newDisableTextColor) { if (m_disableTextColor != newDisableTextColor){ m_disableTextColor = newDisableTextColor; emit disableTextColorChanged(); } } QBrush UKUIButton::normalTextColor() const { return m_normalTextColor; } void UKUIButton::setNormalTextColor(QBrush newNormalTextColor) { if (m_normalTextColor != newNormalTextColor){ m_normalTextColor = newNormalTextColor; emit normalTextColorChanged(); } } QBrush UKUIButton::normalHBC() const { return m_normalHBC; } void UKUIButton::setNormalHBC(QBrush newNormalHBC) { if (m_normalHBC != newNormalHBC){ m_normalHBC = newNormalHBC; emit normalHBCChanged(); } } QBrush UKUIButton::clickedHBC() const { return m_clickedHBC; } void UKUIButton::setClickedHBC(QBrush newClickedHBC) { if (m_clickedHBC != newClickedHBC){ m_clickedHBC = newClickedHBC; emit clickedHBCChanged(); } } QBrush UKUIButton::hoveredHBC() { return m_hoveredHBC; } void UKUIButton::setHoveredHBC(QBrush newHoveredHBC) { if (m_hoveredHBC != newHoveredHBC){ m_hoveredHBC = newHoveredHBC; emit hoveredHBCChanged(); } } QBrush UKUIButton::disableHBC() const { return m_disableHBC; } void UKUIButton::setDisableHBC(QBrush 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(); } QBrush UKUIButton::normalBorderColor() const { return m_normalBorderColor; } void UKUIButton::setNormalBorderColor(QBrush newNormalBorderColor) { if (m_normalBorderColor != newNormalBorderColor){ m_normalBorderColor = newNormalBorderColor; emit normalBorderColorChanged(); } } QBrush UKUIButton::hoverBorderColor() const { return m_hoverBorderColor; } void UKUIButton::setHoverBorderColor(QBrush newHoverBorderColor) { if (m_hoverBorderColor != newHoverBorderColor){ m_hoverBorderColor = newHoverBorderColor; emit hoverBorderColorChanged(); } } QBrush UKUIButton::clickBorderColor() const { return m_clickBorderColor; } void UKUIButton::setClickBorderColor(QBrush newClickBorderColor) { if (m_clickBorderColor!= newClickBorderColor){ m_clickBorderColor = newClickBorderColor; emit clickBorderColorChanged(); } } QBrush UKUIButton::disableBorderColor() const { return m_disableBorderColor; } void UKUIButton::setDisableBorderColor(QBrush newDisableBorderColor) { if (m_disableBorderColor != newDisableBorderColor){ m_disableBorderColor = newDisableBorderColor; emit disableBorderColorChanged(); } } QBrush UKUIButton::normalBorderHColor() const { return m_normalBorderHColor; } void UKUIButton::setNormalBorderHColor(QBrush newNormalBorderHColor) { if (m_normalBorderHColor != newNormalBorderHColor){ m_normalBorderHColor = newNormalBorderHColor; emit normalBorderHColorChanged(); } } QBrush UKUIButton::hoverBorderHColor() const { return m_hoverBorderHColor; } void UKUIButton::setHoverBorderHColor(QBrush newHoverBorderHColor) { if (m_hoverBorderHColor != newHoverBorderHColor){ m_hoverBorderHColor = newHoverBorderHColor; emit hoverBorderHColorChanged(); } } QBrush UKUIButton::clickBorderHColor() const { return m_clickBorderHColor; } void UKUIButton::setClickBorderHColor(QBrush newClickBorderHColor) { if (m_clickBorderHColor != newClickBorderHColor){ m_clickBorderHColor = newClickBorderHColor; emit clickBorderHColorChanged(); } } QBrush UKUIButton::disableBorderHColor() const { return m_disableBorderHColor; } void UKUIButton::setDisableBorderHColor(QBrush newDisableBorderHColor) { if (m_disableBorderHColor != newDisableBorderHColor){ m_disableBorderHColor = newDisableBorderHColor; emit disableBorderHColorChanged(); } } QBrush UKUIButton::focusBorderColor() const { return m_focusBorderColor; } void UKUIButton::setFocusBorderColor(QBrush 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(); } QBrush UKUIButton::highlightTextColor() const { return m_highlightTextColor; } void UKUIButton::setHighlightTextColor(QBrush newHighlightTextColor) { if (m_highlightTextColor == newHighlightTextColor) return; m_highlightTextColor = newHighlightTextColor; emit highlightTextColorChanged(); } QBrush UKUIButton::highlightTextDisableColor() const { return m_highlightTextDisableColor; } void UKUIButton::setHighlightTextDisableColor(QBrush newHighlightTextDisableColor) { if (m_highlightTextDisableColor == newHighlightTextDisableColor) return; m_highlightTextDisableColor = newHighlightTextDisableColor; emit highlightTextDisableColorChanged(); } const QBrush &UKUIButton::normalCloseBC() const { return m_normalCloseBC; } void UKUIButton::setNormalCloseBC(const QBrush &newNormalCloseBC) { if (m_normalCloseBC == newNormalCloseBC) return; m_normalCloseBC = newNormalCloseBC; emit normalCloseBCChanged(); } const QBrush &UKUIButton::clickedCloseBC() const { return m_clickedCloseBC; } void UKUIButton::setClickedCloseBC(const QBrush &newClickedCloseBC) { if (m_clickedCloseBC == newClickedCloseBC) return; m_clickedCloseBC = newClickedCloseBC; emit clickedCloseBCChanged(); } const QBrush &UKUIButton::hoveredCloseBC() const { return m_hoveredCloseBC; } void UKUIButton::setHoveredClosedBC(const QBrush &newHoveredCloseBC) { if (m_hoveredCloseBC == newHoveredCloseBC) return; m_hoveredCloseBC = newHoveredCloseBC; emit hoveredCloseBCChanged(); } const QBrush &UKUIButton::disableCloseBC() const { return m_disableCloseBC; } void UKUIButton::setDisableCloseBC(const QBrush &newDisableCloseBC) { if (m_disableCloseBC == newDisableCloseBC) return; m_disableCloseBC = newDisableCloseBC; emit disableCloseBCChanged(); } const QBrush &UKUIButton::normalBorderCloseColor() const { return m_normalBorderCloseColor; } void UKUIButton::setNormalBorderCloseColor(const QBrush &newNormalBorderCloseColor) { if (m_normalBorderCloseColor == newNormalBorderCloseColor) return; m_normalBorderCloseColor = newNormalBorderCloseColor; emit normalBorderCloseColorChanged(); } const QBrush &UKUIButton::hoverBorderCloseColor() const { return m_hoverBorderCloseColor; } void UKUIButton::setHoverBorderCloseColor(const QBrush &newHoverBorderCloseColor) { if (m_hoverBorderCloseColor == newHoverBorderCloseColor) return; m_hoverBorderCloseColor = newHoverBorderCloseColor; emit hoverBorderCloseColorChanged(); } const QBrush &UKUIButton::clickBorderCloseColor() const { return m_clickBorderCloseColor; } void UKUIButton::setClickBorderCloseColor(const QBrush &newClickBorderCloseColor) { if (m_clickBorderCloseColor == newClickBorderCloseColor) return; m_clickBorderCloseColor = newClickBorderCloseColor; emit clickBorderCloseColorChanged(); } const QBrush &UKUIButton::disableBorderCloseColor() const { return m_disableBorderCloseColor; } void UKUIButton::setDisableBorderCloseColor(const QBrush &newDisableBorderCloseColor) { if (m_disableBorderCloseColor == newDisableBorderCloseColor) return; m_disableBorderCloseColor = newDisableBorderCloseColor; emit disableBorderCloseColorChanged(); } const QBrush &UKUIButton::normalWindowBC() const { return m_normalWindowBC; } void UKUIButton::setNormalWindowBC(const QBrush &newNormalWindowBC) { if (m_normalWindowBC == newNormalWindowBC) return; m_normalWindowBC = newNormalWindowBC; emit normalWindowBCChanged(); } const QBrush &UKUIButton::clickedWindowBC() const { return m_clickedWindowBC; } void UKUIButton::setClickedWindowBC(const QBrush &newClickedWindowBC) { if (m_clickedWindowBC == newClickedWindowBC) return; m_clickedWindowBC = newClickedWindowBC; emit clickedWindowBCChanged(); } const QBrush &UKUIButton::hoveredWindowBC() const { return m_hoveredWindowBC; } void UKUIButton::setHoveredWindowBC(const QBrush &newHoveredWindowBC) { if (m_hoveredWindowBC == newHoveredWindowBC) return; m_hoveredWindowBC = newHoveredWindowBC; emit hoveredWindowBCChanged(); } const QBrush &UKUIButton::disableWindowBC() const { return m_disableWindowBC; } void UKUIButton::setDisableWindowBC(const QBrush &newDisableWindowBC) { if (m_disableWindowBC == newDisableWindowBC) return; m_disableWindowBC = newDisableWindowBC; emit disableWindowBCChanged(); } const QBrush &UKUIButton::normalBorderWindowColor() const { return m_normalBorderWindowColor; } void UKUIButton::setNormalBorderWindowColor(const QBrush &newNormalBorderWindowColor) { if (m_normalBorderWindowColor == newNormalBorderWindowColor) return; m_normalBorderWindowColor = newNormalBorderWindowColor; emit normalBorderWindowColorChanged(); } const QBrush &UKUIButton::hoverBorderWindowColor() const { return m_hoverBorderWindowColor; } void UKUIButton::setHoverBorderWindowColor(const QBrush &newHoverBorderWindowColor) { if (m_hoverBorderWindowColor == newHoverBorderWindowColor) return; m_hoverBorderWindowColor = newHoverBorderWindowColor; emit hoverBorderWindowColorChanged(); } const QBrush &UKUIButton::clickBorderWindowColor() const { return m_clickBorderWindowColor; } void UKUIButton::setClickBorderWindowColor(const QBrush &newClickBorderWindowColor) { if (m_clickBorderWindowColor == newClickBorderWindowColor) return; m_clickBorderWindowColor = newClickBorderWindowColor; emit clickBorderWindowColorChanged(); } const QBrush &UKUIButton::disableBorderWindowColor() const { return m_disableBorderWindowColor; } void UKUIButton::setDisableBorderWindowColor(const QBrush &newDisableBorderWindowColor) { if (m_disableBorderWindowColor == newDisableBorderWindowColor) return; m_disableBorderWindowColor = newDisableBorderWindowColor; emit disableBorderWindowColorChanged(); } const QBrush &UKUIButton::normalTransparentBC() const { return m_normalTransparentBC; } void UKUIButton::setNormalTransparentBC(const QBrush &newNormalTransparentBC) { if (m_normalTransparentBC == newNormalTransparentBC) return; m_normalTransparentBC = newNormalTransparentBC; emit normalTransparentBCChanged(); } const QBrush &UKUIButton::clickedTransparentBC() const { return m_clickedTransparentBC; } void UKUIButton::setClickedTransparentBC(const QBrush &newClickedTransparentBC) { if (m_clickedTransparentBC == newClickedTransparentBC) return; m_clickedTransparentBC = newClickedTransparentBC; emit clickedTransparentBCChanged(); } const QBrush &UKUIButton::hoveredTransparentBC() const { return m_hoveredTransparentBC; } void UKUIButton::setHoveredTransparentBC(const QBrush &newHoveredTransparentBC) { if (m_hoveredTransparentBC == newHoveredTransparentBC) return; m_hoveredTransparentBC = newHoveredTransparentBC; emit hoveredTransparentBCChanged(); } const QBrush &UKUIButton::disableTransparentBC() const { return m_disableTransparentBC; } void UKUIButton::setDisableTransparentBC(const QBrush &newDisableTransparentBC) { if (m_disableTransparentBC == newDisableTransparentBC) return; m_disableTransparentBC = newDisableTransparentBC; emit disableTransparentBCChanged(); } const QBrush &UKUIButton::normalBorderTransparentBC() const { return m_normalBorderTransparentBC; } void UKUIButton::setNormalBorderTransparentBC(const QBrush &newNormalBorderTransparentBC) { if (m_normalBorderTransparentBC == newNormalBorderTransparentBC) return; m_normalBorderTransparentBC = newNormalBorderTransparentBC; emit normalBorderTransparentBCChanged(); } const QBrush &UKUIButton::clickedBorderTransparentBC() const { return m_clickedBorderTransparentBC; } void UKUIButton::setClickedBorderTransparentBC(const QBrush &newClickedBorderTransparentBC) { if (m_clickedBorderTransparentBC == newClickedBorderTransparentBC) return; m_clickedBorderTransparentBC = newClickedBorderTransparentBC; emit clickedBorderTransparentBCChanged(); } const QBrush &UKUIButton::hoveredBorderTransparentBC() const { return m_hoveredBorderTransparentBC; } void UKUIButton::setHoveredBorderTransparentBC(const QBrush &newHoveredBorderTransparentBC) { if (m_hoveredBorderTransparentBC == newHoveredBorderTransparentBC) return; m_hoveredBorderTransparentBC = newHoveredBorderTransparentBC; emit hoveredBorderTransparentBCChanged(); } const QBrush &UKUIButton::disableBorderTransparentBC() const { return m_disableBorderTransparentBC; } void UKUIButton::setDisableBorderTransparentBC(const QBrush &newDisableBorderTransparentBC) { if (m_disableBorderTransparentBC == newDisableBorderTransparentBC) return; m_disableBorderTransparentBC = newDisableBorderTransparentBC; emit disableBorderTransparentBCChanged(); } const QBrush &UKUIButton::normalWindowTransparentBC() const { return m_normalWindowTransparentBC; } void UKUIButton::setNormalWindowTransparentBC(const QBrush &newNormalWindowTransparentBC) { if (m_normalWindowTransparentBC == newNormalWindowTransparentBC) return; m_normalWindowTransparentBC = newNormalWindowTransparentBC; emit normalWindowTransparentBCChanged(); } const QBrush &UKUIButton::clickedWindowTransparentBC() const { return m_clickedWindowTransparentBC; } void UKUIButton::setClickedWindowTransparentBC(const QBrush &newClickedWindowTransparentBC) { if (m_clickedWindowTransparentBC == newClickedWindowTransparentBC) return; m_clickedWindowTransparentBC = newClickedWindowTransparentBC; emit clickedWindowTransparentBCChanged(); } const QBrush &UKUIButton::hoveredWindowTransparentBC() const { return m_hoveredWindowTransparentBC; } void UKUIButton::setHoveredWindowTransparentBC(const QBrush &newHoveredWindowTransparentBC) { if (m_hoveredWindowTransparentBC == newHoveredWindowTransparentBC) return; m_hoveredWindowTransparentBC = newHoveredWindowTransparentBC; emit hoveredWindowTransparentBCChanged(); } const QBrush &UKUIButton::disableWindowTransparentBC() const { return m_disableWindowTransparentBC; } void UKUIButton::setDisableWindowTransparentBC(const QBrush &newDisableWindowTransparentBC) { if (m_disableWindowTransparentBC == newDisableWindowTransparentBC) return; m_disableWindowTransparentBC = newDisableWindowTransparentBC; emit disableWindowTransparentBCChanged(); } const QBrush &UKUIButton::normalBorderWindowTransparentColor() const { return m_normalBorderWindowTransparentColor; } void UKUIButton::setNormalBorderWindowTransparentColor(const QBrush &newNormalBorderWindowTransparentColor) { if (m_normalBorderWindowTransparentColor == newNormalBorderWindowTransparentColor) return; m_normalBorderWindowTransparentColor = newNormalBorderWindowTransparentColor; emit normalBorderWindowTransparentColorChanged(); } const QBrush &UKUIButton::hoveredBorderWindowTransparentColor() const { return m_hoveredBorderWindowTransparentColor; } void UKUIButton::setHoveredBorderWindowTransparentColor(const QBrush &newHoveredBorderWindowTransparentColor) { if (m_hoveredBorderWindowTransparentColor == newHoveredBorderWindowTransparentColor) return; m_hoveredBorderWindowTransparentColor = newHoveredBorderWindowTransparentColor; emit hoveredBorderWindowTransparentColorChanged(); } const QBrush &UKUIButton::clickedBorderWindowTransparentColor() const { return m_clickedBorderWindowTransparentColor; } void UKUIButton::setClickedBorderWindowTransparentColor(const QBrush &newClickedBorderWindowTransparentColor) { if (m_clickedBorderWindowTransparentColor == newClickedBorderWindowTransparentColor) return; m_clickedBorderWindowTransparentColor = newClickedBorderWindowTransparentColor; emit clickedBorderWindowTransparentColorChanged(); } const QBrush &UKUIButton::disableBorderWindowTransparentColor() const { return m_disableBorderWindowTransparentColor; } void UKUIButton::setDisableBorderWindowTransparentColor(const QBrush &newDisableBorderWindowTransparentColor) { if (m_disableBorderWindowTransparentColor == newDisableBorderWindowTransparentColor) return; m_disableBorderWindowTransparentColor = newDisableBorderWindowTransparentColor; emit disableBorderWindowTransparentColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/appparameter.h0000664000175000017500000000772515154306200026113 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef APPPARAMETER_H #define APPPARAMETER_H #include #include #include #include #include #include "tokenparameter.h" 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) Q_PROPERTY(bool isDark READ isDark WRITE setIsDark NOTIFY isDarkChanged) Q_PROPERTY(double menuTransparency READ menuTransparency WRITE setMenuTransparency NOTIFY menuTransparencyChanged) Q_PROPERTY(QBrush windowColor READ windowColor WRITE setWindowColor NOTIFY windowColorChanged) Q_PROPERTY(bool focusEnable READ focusEnable WRITE setFocusEnable NOTIFY focusEnableChanged) 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); bool isDark() const; void setIsDark(bool newIsDark); double menuTransparency() const; void setMenuTransparency(double newMenuTransparency); const QBrush &windowColor() const; void setWindowColor(const QBrush &newWindowColor); Q_INVOKABLE bool themeHasIcon(QString iconName); Q_INVOKABLE bool showToolTipWindow(); Q_INVOKABLE QPoint posByCursor(int width, int height); bool focusEnable() const; void setFocusEnable(bool newFocusEnable); public slots: void slotChangeStyle(const QString& key); signals: void fontChanged(); void paletteChanged(); void iconWidthChanged(); void spaceChanged(); void isDarkChanged(); void parametryChanged(); void menuTransparencyChanged(); void windowColorChanged(); void focusEnableChanged(); void iconThemeChanged(); private: QFont m_font; QPalette m_palette; int m_iconWidth = 16; int m_space = 8; bool m_isDark = false; double m_menuTransparency; QBrush m_windowColor; bool m_focusEnable = false; }; 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(); } inline bool APPParameter::isDark() const { return m_isDark; } inline void APPParameter::setIsDark(bool newIsDark) { if (m_isDark == newIsDark) return; m_isDark = newIsDark; emit isDarkChanged(); } } QML_DECLARE_TYPEINFO(UKUIQQC2Style::APPParameter, QML_HAS_ATTACHED_PROPERTIES) #endif // APPPARAMETER_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiitemdelegate.h0000664000175000017500000004720415154306200026755 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUIITEMDELEGATE_H #define UKUIITEMDELEGATE_H #include #include #include #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUIItemDelegate : public QQuickItem { Q_OBJECT Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged) Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged) Q_PROPERTY(QBrush normalTextColor READ normalTextColor WRITE setNormalTextColor NOTIFY normalTextColorChanged) Q_PROPERTY(QBrush disableTextColor READ disableTextColor WRITE setDisableTextColor NOTIFY disableTextColorChanged) Q_PROPERTY(QBrush normalBC READ normalBC WRITE setNormalBC NOTIFY normalBCChanged) Q_PROPERTY(QBrush clickedBC READ clickedBC WRITE setClickedBC NOTIFY clickedBCChanged) Q_PROPERTY(QBrush hoveredBC READ hoveredBC WRITE setHoveredBC NOTIFY hoveredBCChanged) Q_PROPERTY(QBrush disableBC READ disableBC WRITE setDisableBC NOTIFY disableBCChanged) Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) Q_PROPERTY(QBrush normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged) Q_PROPERTY(QBrush hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged) Q_PROPERTY(QBrush clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged) Q_PROPERTY(QBrush disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged) Q_PROPERTY(QBrush normalHTextColor READ normalHTextColor WRITE setNormalHTextColor NOTIFY normalHTextColorChanged) Q_PROPERTY(QBrush disableHTextColor READ disableHTextColor WRITE setDisableHTextColor NOTIFY disableHTextColorChanged) Q_PROPERTY(QBrush normalHBC READ normalHBC WRITE setNormalHBC NOTIFY normalHBCChanged) Q_PROPERTY(QBrush clickedHBC READ clickedHBC WRITE setClickedHBC NOTIFY clickedHBCChanged) Q_PROPERTY(QBrush hoveredHBC READ hoveredHBC WRITE setHoveredHBC NOTIFY hoveredHBCChanged) Q_PROPERTY(QBrush disableHBC READ disableHBC WRITE setDisableHBC NOTIFY disabledHBCChanged) Q_PROPERTY(QBrush normalBorderHColor READ normalBorderHColor WRITE setNormalBorderHColor NOTIFY normalBorderHColorChanged) Q_PROPERTY(QBrush hoverBorderHColor READ hoverBorderHColor WRITE setHoverBorderHColor NOTIFY hoverBorderHColorChanged) Q_PROPERTY(QBrush clickBorderHColor READ clickBorderHColor WRITE setClickBorderHColor NOTIFY clickBorderHColorChanged) Q_PROPERTY(QBrush disableBorderHColor READ disableBorderHColor WRITE setDisableBorderHColor NOTIFY disabledBorderHColorChanged) Q_PROPERTY(QBrush normalCheckedBC READ normalCheckedBC WRITE setNormalCheckedBC NOTIFY normalCheckedBCChanged) Q_PROPERTY(QBrush clickedCheckedBC READ clickedCheckedBC WRITE setClickedCheckedBC NOTIFY clickedCheckedBCChanged) Q_PROPERTY(QBrush hoveredCheckedBC READ hoveredCheckedBC WRITE setHoveredCheckedBC NOTIFY hoveredCheckedBCChanged) Q_PROPERTY(QBrush disableCheckedBC READ disableCheckedBC WRITE setDisableCheckedBC NOTIFY disableCheckedBCChanged) Q_PROPERTY(QBrush normalBorderCheckedColor READ normalBorderCheckedColor WRITE setNormalBorderCheckedColor NOTIFY normalBorderCheckedColorChanged) Q_PROPERTY(QBrush hoverBorderCheckedColor READ hoverBorderCheckedColor WRITE setHoverBorderCheckedColor NOTIFY hoverBorderCheckedColorChanged) Q_PROPERTY(QBrush clickBorderCheckedColor READ clickBorderCheckedColor WRITE setClickBorderCheckedColor NOTIFY clickBorderCheckedColorChanged) Q_PROPERTY(QBrush disableBorderCheckedColor READ disableBorderCheckedColor WRITE setDisableBorderCheckedColor NOTIFY disableBorderCheckedColorChanged) Q_PROPERTY(int implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged) Q_PROPERTY(QBrush normalTransparentBC READ normalTransparentBC WRITE setNormalTransparentBC NOTIFY normalTransparentBCChanged) Q_PROPERTY(QBrush clickedTransparentBC READ clickedTransparentBC WRITE setClickedTransparentBC NOTIFY clickedTransparentBCChanged) Q_PROPERTY(QBrush hoveredTransparentBC READ hoveredTransparentBC WRITE setHoveredTransparentBC NOTIFY hoveredTransparentBCChanged) Q_PROPERTY(QBrush disableTransparentBC READ disableTransparentBC WRITE setDisableTransparentBC NOTIFY disableTransparentBCChanged) Q_PROPERTY(QBrush normalTransparentBorderColor READ normalTransparentBorderColor WRITE setNormalTransparentBorderColor NOTIFY normalTransparentBorderColorChanged) Q_PROPERTY(QBrush clickedTransparentBorderColor READ clickedTransparentBorderColor WRITE setClickedTransparentBorderColor NOTIFY clickedTransparentBorderColorChanged) Q_PROPERTY(QBrush hoveredTransparentBorderColor READ hoveredTransparentBorderColor WRITE setHoveredTransparentBorderColor NOTIFY hoveredTransparentBorderColorChanged) Q_PROPERTY(QBrush disableTransparentBorderColor READ disableTransparentBorderColor WRITE setDisableTransparentBorderColor NOTIFY disableTransparentBorderColorChanged) Q_PROPERTY(QBrush normalCheckedTransparentBC READ normalCheckedTransparentBC WRITE setNormalCheckedTransparentBC NOTIFY normalCheckedTransparentBCChanged) Q_PROPERTY(QBrush clickedCheckedTransparentBC READ clickedCheckedTransparentBC WRITE setClickedCheckedTransparentBC NOTIFY clickedCheckedTransparentBCChanged) Q_PROPERTY(QBrush hoveredCheckedTransparentBC READ hoveredCheckedTransparentBC WRITE setHoveredCheckedTransparentBC NOTIFY hoveredCheckedTransparentBCChanged) Q_PROPERTY(QBrush disableCheckedTransparentBC READ disableCheckedTransparentBC WRITE setDisableCheckedTransparentBC NOTIFY disableCheckedTransparentBCChanged) Q_PROPERTY(QBrush normalCheckedTransparentBorderColor READ normalCheckedTransparentBorderColor WRITE setNormalCheckedTransparentBorderColor NOTIFY normalCheckedTransparentBorderColorChanged) Q_PROPERTY(QBrush clickedCheckedTransparentBorderColor READ clickedCheckedTransparentBorderColor WRITE setClickedCheckedTransparentBorderColor NOTIFY clickedCheckedTransparentBorderColorChanged) Q_PROPERTY(QBrush hoveredCheckedTransparentBorderColor READ hoveredCheckedTransparentBorderColor WRITE setHoveredCheckedTransparentBorderColor NOTIFY hoveredCheckedTransparentBorderColorChanged) Q_PROPERTY(QBrush disableCheckedTransparentBorderColor READ disableCheckedTransparentBorderColor WRITE setDisableCheckedTransparentBorderColor NOTIFY disableCheckedTransparentBorderColorChanged) Q_PROPERTY(QBrush normalAlternateBC READ normalAlternateBC WRITE setNormalAlternateBC NOTIFY normalAlternateBCChanged) Q_PROPERTY(QBrush clickedAlternatedBC READ clickedAlternateBC WRITE setClickedAlternateBC NOTIFY clickedAlternateBCChanged) Q_PROPERTY(QBrush hoveredAlternatedBC READ hoveredAlternateBC WRITE setHoveredAlternateBC NOTIFY hoveredAlternateBCChanged) Q_PROPERTY(QBrush disableAlternateBC READ disableAlternateBC WRITE setDisableAlternateBC NOTIFY disableAlternateBCChanged) Q_PROPERTY(QBrush normalAlternateTransparentBC READ normalAlternateTransparentBC WRITE setNormalAlternateTransparentBC NOTIFY normalAlternateTransparentBCChanged) Q_PROPERTY(QBrush clickedAlternateTransparentBC READ clickedAlternateTransparentBC WRITE setClickedAlternateTransparentBC NOTIFY clickedAlternateTransparentBCChanged) Q_PROPERTY(QBrush hoveredAlternateTransparentBC READ hoveredAlternateTransparentBC WRITE setHoveredAlternateTransparentBC NOTIFY hoveredAlternateTransparentBCChanged) Q_PROPERTY(QBrush disableAlternateTransparentBC READ disableAlternateTransparentBC WRITE setDisableAlternateTransparentBC NOTIFY disableAlternateTransparentBCChanged) public: explicit UKUIItemDelegate(QQuickItem *parent = nullptr); ~UKUIItemDelegate(); void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance); static UKUIItemDelegate* qmlAttachedProperties(QObject* parent); Q_INVOKABLE QBrush normalTextColor() const; void setNormalTextColor(QBrush newNormalTextColor); Q_INVOKABLE QBrush disableTextColor() const; void setDisableTextColor(QBrush newDisableTextColor); Q_INVOKABLE QBrush normalBC() const; void setNormalBC(QBrush newNormalBC); Q_INVOKABLE QBrush clickedBC() const; void setClickedBC(QBrush newClickedBC); Q_INVOKABLE QBrush hoveredBC() const; void setHoveredBC(QBrush newHoveredBC); Q_INVOKABLE QBrush disableBC() const; void setDisableBC(QBrush newDisableBC); int radius() const; void setRadius(int newRadius); int borderWidth() const; void setBorderWidth(int newBorderWidth); Q_INVOKABLE QBrush normalBorderColor() const; void setNormalBorderColor(QBrush newNormalBorderColor); Q_INVOKABLE QBrush hoverBorderColor() const; void setHoverBorderColor(QBrush newHoverBorderColor); Q_INVOKABLE QBrush clickBorderColor() const; void setClickBorderColor(QBrush newClickBorderColor); Q_INVOKABLE QBrush disableBorderColor() const; void setDisableBorderColor(QBrush newDisableBorderColor); const QBrush &clickedHBC() const; void setClickedHBC(const QBrush &newClickedHBC); const QBrush &hoveredHBC() const; void setHoveredHBC(const QBrush &newHoveredHBC); const QBrush &hoverBorderHColor() const; void setHoverBorderHColor(const QBrush &newHoverBorderHColor); const QBrush &clickBorderHColor() const; void setClickBorderHColor(const QBrush &newClickBorderHColor); const QBrush &normalHBC() const; void setNormalHBC(const QBrush &newNormalHBC); const QBrush &normalBorderHColor() const; void setNormalBorderHColor(const QBrush &newNormalBorderHColor); const QBrush &normalCheckedBC() const; void setNormalCheckedBC(const QBrush &newNormalCheckedBC); const QBrush &clickedCheckedBC() const; void setClickedCheckedBC(const QBrush &newClickedCheckedBC); const QBrush &hoveredCheckedBC() const; void setHoveredCheckedBC(const QBrush &newHoveredCheckedBC); const QBrush &normalBorderCheckedColor() const; void setNormalBorderCheckedColor(const QBrush &newNormalBorderCheckedColor); const QBrush &hoverBorderCheckedColor() const; void setHoverBorderCheckedColor(const QBrush &newHoverBorderCheckedColor); const QBrush &clickBorderCheckedColor() const; void setClickBorderCheckedColor(const QBrush &newClickBorderCheckedColor); int implicitHeight() const; void setImplicitHeight(int newImplicitHeight); int padding() const; void setPadding(int newPadding); const QBrush &normalHTextColor() const; void setNormalHTextColor(const QBrush &newNormalHTextColor); const QBrush &disableHTextColor() const; void setDisableHTextColor(const QBrush &newDisableHTextColor); const QBrush &normalTransparentBC() const; void setNormalTransparentBC(const QBrush &newNormalTransparentBC); const QBrush &clickedTransparentBC() const; void setClickedTransparentBC(const QBrush &newClickedTransparentBC); const QBrush &hoveredTransparentBC() const; void setHoveredTransparentBC(const QBrush &newHoveredTransparentBC); const QBrush &disableTransparentBC() const; void setDisableTransparentBC(const QBrush &newDisableTransparentBC); const QBrush &normalTransparentBorderColor() const; void setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor); const QBrush &clickedTransparentBorderColor() const; void setClickedTransparentBorderColor(const QBrush &newClickedTransparentBorderColor); const QBrush &hoveredTransparentBorderColor() const; void setHoveredTransparentBorderColor(const QBrush &newHoveredTransparentBorderColor); const QBrush &disableTransparentBorderColor() const; void setDisableTransparentBorderColor(const QBrush &newDisableTransparentBorderColor); const QBrush &disableHBC() const; void setDisableHBC(const QBrush &newDisableHBC); const QBrush &disableBorderHColor() const; void setDisableBorderHColor(const QBrush &newDisableBorderHColor); const QBrush &disableCheckedBC() const; void setDisableCheckedBC(const QBrush &newDisableCheckedBC); const QBrush &disableBorderCheckedColor() const; void setDisableBorderCheckedColor(const QBrush &newDisableBorderCheckedColor); const QBrush &normalCheckedTransparentBC() const; void setNormalCheckedTransparentBC(const QBrush &newNormalCheckedTransparentBC); const QBrush &clickedCheckedTransparentBC() const; void setClickedCheckedTransparentBC(const QBrush &newClickedCheckedTransparentBC); const QBrush &hoveredCheckedTransparentBC() const; void setHoveredCheckedTransparentBC(const QBrush &newHoveredCheckedTransparentBC); const QBrush &disableCheckedTransparentBC() const; void setDisableCheckedTransparentBC(const QBrush &newDisableCheckedTransparentBC); const QBrush &normalCheckedTransparentBorderColor() const; void setNormalCheckedTransparentBorderColor(const QBrush &newNormalCheckedTransparentBorderColor); const QBrush &clickedCheckedTransparentBorderColor() const; void setClickedCheckedTransparentBorderColor(const QBrush &newClickedCheckedTransparentBorderColor); const QBrush &hoveredCheckedTransparentBorderColor() const; void setHoveredCheckedTransparentBorderColor(const QBrush &newHoveredCheckedTransparentBorderColor); const QBrush &disableCheckedTransparentBorderColor() const; void setDisableCheckedTransparentBorderColor(const QBrush &newDisableCheckedTransparentBorderColor); QBrush normalAlternateBC() const; void setNormalAlternateBC(const QBrush &newNormalAlternateBC); QBrush clickedAlternateBC() const; void setClickedAlternateBC(const QBrush &newClickeAlternatedBC); QBrush hoveredAlternateBC() const; void setHoveredAlternateBC(const QBrush &newHovereAlternatedBC); QBrush disableAlternateBC() const; void setDisableAlternateBC(const QBrush &newDisableAlternateBC); QBrush normalAlternateTransparentBC() const; void setNormalAlternateTransparentBC(const QBrush &newNormalAlternateTransparentBC); QBrush clickedAlternateTransparentBC() const; void setClickedAlternateTransparentBC(const QBrush &newClickedAlternateTransparentBC); QBrush hoveredAlternateTransparentBC() const; void setHoveredAlternateTransparentBC(const QBrush &newHoveredAlternateTransparentBC); QBrush disableAlternateTransparentBC() const; void setDisableAlternateTransparentBC(const QBrush &newDisableAlternateTransparentBC); 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(); void parametryChanged(); void clickedHBCChanged(); void hoveredHBCChanged(); void hoverBorderHColorChanged(); void clickBorderHColorChanged(); void normalHBCChanged(); void normalBorderHColorChanged(); void normalCheckedBCChanged(); void clickedCheckedBCChanged(); void hoveredCheckedBCChanged(); void normalBorderCheckedColorChanged(); void hoverBorderCheckedColorChanged(); void clickBorderCheckedColorChanged(); void implicitHeightChanged(); void paddingChanged(); void normalHTextColorChanged(); void disableHTextColorChanged(); void normalTransparentBCChanged(); void clickedTransparentBCChanged(); void hoveredTransparentBCChanged(); void disableTransparentBCChanged(); void normalTransparentBorderColorChanged(); void clickedTransparentBorderColorChanged(); void hoveredTransparentBorderColorChanged(); void disableTransparentBorderColorChanged(); void disabledHBCChanged(); void disabledBorderHColorChanged(); void disableCheckedBCChanged(); void disableBorderCheckedColorChanged(); void normalCheckedTransparentBCChanged(); void clickedCheckedTransparentBCChanged(); void hoveredCheckedTransparentBCChanged(); void disableCheckedTransparentBCChanged(); void normalCheckedTransparentBorderColorChanged(); void clickedCheckedTransparentBorderColorChanged(); void hoveredCheckedTransparentBorderColorChanged(); void disableCheckedTransparentBorderColorChanged(); void normalAlternateBCChanged(); void clickedAlternateBCChanged(); void hoveredAlternateBCChanged(); void disableAlternateBCChanged(); void normalAlternateTransparentBCChanged(); void clickedAlternateTransparentBCChanged(); void hoveredAlternateTransparentBCChanged(); void disableAlternateTransparentBCChanged(); private: Q_INVOKABLE QBrush m_normalTextColor ; Q_INVOKABLE QBrush m_disableTextColor ; Q_INVOKABLE QBrush m_normalBC ; Q_INVOKABLE QBrush m_clickedBC ; Q_INVOKABLE QBrush m_hoveredBC ; Q_INVOKABLE QBrush m_disableBC ; Q_INVOKABLE QBrush m_normalBorderColor ; Q_INVOKABLE QBrush m_hoverBorderColor ; Q_INVOKABLE QBrush m_clickBorderColor ; Q_INVOKABLE QBrush m_disableBorderColor ; int m_radius; int m_borderWidth; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_clickedHBC; QBrush m_hoveredHBC; QBrush m_hoverBorderHColor; QBrush m_clickBorderHColor; QBrush m_normalHBC; QBrush m_normalBorderHColor; QBrush m_normalCheckedBC; QBrush m_clickedCheckedBC; QBrush m_hoveredCheckedBC; QBrush m_normalBorderCheckedColor; QBrush m_hoverBorderCheckedColor; QBrush m_clickBorderCheckedColor; int m_implicitHeight = 36; int m_padding; QBrush m_normalHTextColor; QBrush m_disableHTextColor; QBrush m_normalTransparentBC; QBrush m_clickedTransparentBC; QBrush m_hoveredTransparentBC; QBrush m_disableTransparentBC; QBrush m_normalTransparentBorderColor; QBrush m_clickedTransparentBorderColor; QBrush m_hoveredTransparentBorderColor; QBrush m_disableTransparentBorderColor; QBrush m_disableHBC; QBrush m_disableBorderHColor; QBrush m_disableCheckedBC; QBrush m_disableBorderCheckedColor; QBrush m_normalCheckedTransparentBC; QBrush m_clickedCheckedTransparentBC; QBrush m_hoveredCheckedTransparentBC; QBrush m_disableCheckedTransparentBC; QBrush m_normalCheckedTransparentBorderColor; QBrush m_clickedCheckedTransparentBorderColor; QBrush m_hoveredCheckedTransparentBorderColor; QBrush m_disableCheckedTransparentBorderColor; QBrush m_normalAlternateBC; QBrush m_clickedAlternatedBC; QBrush m_hoveredAlternatedBC; QBrush m_disableAlternateBC; QBrush m_normalAlternateTransparentBC; QBrush m_clickedAlternateTransparentBC; QBrush m_hoveredAlternateTransparentBC; QBrush m_disableAlternateTransparentBC; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIItemDelegate, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUIITEMDELEGATE_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiheaderview.cpp0000664000175000017500000000415715154306200027002 0ustar fengfeng#include #include "ukuiheaderview.h" #include "qdebug.h" using namespace UKUIQQC2Style; UKUIHeaderView::UKUIHeaderView(QQuickItem *parent) : QQuickItem(parent) { if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUIHeaderView::~UKUIHeaderView() { } UKUIHeaderView* UKUIHeaderView::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUIHeaderView(p); } void UKUIHeaderView::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setNormalTextColor(m_instance->kFontPrimary()); setLineColor(m_instance->kLineInputNormal()); setLineWidth(1); setnormalHeight(36); emit parametryChanged(); } const QBrush &UKUIHeaderView::normalTextColor() const { return m_normalTextColor; } void UKUIHeaderView::setNormalTextColor(const QBrush &newNormalTextColor) { if (m_normalTextColor == newNormalTextColor) return; m_normalTextColor = newNormalTextColor; emit normalTextColorChanged(); } const QBrush &UKUIHeaderView::lineColor() const { return m_lineColor; } void UKUIHeaderView::setLineColor(const QBrush &newLineColor) { if (m_lineColor == newLineColor) return; m_lineColor = newLineColor; emit lineColorChanged(); } int UKUIHeaderView::lineWidth() const { return m_lineWidth; } void UKUIHeaderView::setLineWidth(int newLineWidth) { if (m_lineWidth == newLineWidth) return; m_lineWidth = newLineWidth; emit lineWidthChanged(); } int UKUIHeaderView::normalHeight() const { return m_normalHeight; } void UKUIHeaderView::setnormalHeight(int newNormalHeight) { if (m_normalHeight == newNormalHeight) return; m_normalHeight = newNormalHeight; emit lineWidthChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/parsecolorinterface.cpp0000664000175000017500000000455015154306200030010 0ustar fengfeng#include "parsecolorinterface.h" #include "qdebug.h" #include "qpixmap.h" #include "qimage.h" #include #include #include #include #include #include using namespace UKUIQQC2Style; ParseColorInterface::ParseColorInterface(QObject *parent):QObject(parent) { } ParseColorInterface* ParseColorInterface::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new ParseColorInterface(p); } bool ParseColorInterface::isSolidPattern(QVariant dtColor) { if(dtColor.canConvert()){ QBrush c = dtColor.value(); if(c.style() == Qt::SolidPattern || c.style() == Qt::NoBrush) return true; if(c.style() == Qt::LinearGradientPattern && c.gradient() && c.gradient()->stops().length() == 2){ if(c.gradient()->stops().at(0).second != c.gradient()->stops().at(1).second) return false; } return true; } return false; } QColor ParseColorInterface::startColor(QVariant dtColor) { if(dtColor.canConvert()){ QBrush c = dtColor.value(); if(c.gradient() && c.gradient()->stops().length() >= 1) return c.gradient()->stops().at(0).second; else return c.color(); } else if(dtColor.canConvert()) return dtColor.value(); return QColor(); } QColor ParseColorInterface::endColor(QVariant dtColor) { if(dtColor.canConvert()){ QBrush c = dtColor.value(); if(c.gradient() && c.gradient()->stops().length() == 2) return c.gradient()->stops().at(1).second; else return c.color(); } else if(dtColor.canConvert()) return dtColor.value(); return QColor(); } QString ParseColorInterface::endString(QString s, QString lastS) { int lastIndex = s.lastIndexOf(lastS); QString returnS; if(lastIndex != -1){ returnS = s.right(s.length() - lastIndex - 1); } return returnS; } QColor ParseColorInterface::getDtColor(QVariant dtColorkey) { QString key = dtColorkey.toString(); const char* c= key.toLocal8Bit().constData(); if (!key.isEmpty() && qApp && qApp->property(c).isValid()){ QBrush b = qApp->property(c).value(); return b.color(); } return QColor(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuimenuitem.cpp0000664000175000017500000005246415154306200026506 0ustar fengfeng#include "ukuimenuitem.h" #include "qdebug.h" using namespace UKUIQQC2Style; UKUIMenuItem::UKUIMenuItem(QQuickItem *parent) : QQuickItem(parent) { if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUIMenuItem::~UKUIMenuItem() { } void UKUIMenuItem::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setBorderWidth(1); setNormalBC(QBrush(QColor(0,0,0,0))); setHoveredBC(instance->kComponentHover()); setClickedBC(instance->kComponentClick()); setDisableBC(QBrush(QColor(0,0,0,0))); setNormalBorderColor(QBrush(QColor(0,0,0,0))); setHoverBorderColor(instance->kLineComponentHover()); setClickBorderColor(instance->kLineComponentClick()); setDisableBorderColor(QBrush(QColor(0,0,0,0))); setNormalTextColor(instance->kFontPrimary()); setDisableTextColor(instance->kFontPrimaryDisable()); setNormalTransparentBC(QBrush(QColor(0,0,0,0))); setHoveredTransparentBC(instance->kComponentAlphaHover()); setClickedTransparentBC(instance->kComponentAlphaClick()); setDisableTransparentBC(QBrush(QColor(0,0,0,0))); setNormalTransparentBorderColor(QBrush(QColor(0,0,0,0))); setHoverTransparentBorderColor(instance->kLineComponentHover()); setClickTransparentBorderColor(instance->kLineComponentClick()); setDisableTransparentBorderColor(QBrush(QColor(0,0,0,0))); setNormalCheckedBC(instance->kComponentSelectedNormal()); setNormalBorderCheckedColor(instance->kLineComponentNormal()); setHoveredCheckedBC(instance->kComponentSelectedHover()); setHoverBorderCheckedColor(instance->kLineComponentHover()); setClickedCheckedBC(instance->kComponentSelectedClick()); setClickBorderCheckedColor(instance->kLineComponentClick()); setDisableCheckedBC(instance->kComponentSelectedDisable()); setDisableBorderCheckedColor(instance->kLineComponentDisable()); setNormalCheckedTransparentBC(instance->kComponentSelectedAlphaNormal()); setNormalBorderCheckedTransparentColor(instance->kLineComponentNormal()); setHoveredCheckedTransparentBC(instance->kComponentSelectedAlphaHover()); setHoverBorderCheckedTransparentColor(instance->kLineComponentHover()); setClickedCheckedTransparentBC(instance->kComponentSelectedAlphaClick()); setClickBorderCheckedTransparentColor(instance->kLineComponentClick()); setDisableCheckedTransparentBC(instance->kComponentSelectedAlphaDisable()); setDisableBorderCheckedTransparentColor(instance->kLineComponentDisable()); setNormalHTextColor(instance->kFontWhite()); setDisableHTextColor(instance->kFontWhiteDisable()); setNormalCheckedHBC(instance->kBrandNormal()); setHoveredCheckedHBC(instance->kBrandHover()); setClickedCheckedHBC(instance->kBrandClick()); setDisableCheckedHBC(instance->kBrandDisable()); setNormalCheckedHBorderColor(instance->kLineBrandNormal()); setHoveredCheckedHBorderColor(instance->kLineBrandHover()); setClickedCheckedHBorderColor(instance->kLineBrandClick()); setDisableCheckedHBorderColor(instance->kLineBrandDisable()); setMenuSeparatorColor(instance->kLineNormal()); emit parametryChanged(); } UKUIMenuItem* UKUIMenuItem::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(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 QBrush &UKUIMenuItem::normalBC() const { return m_normalBC; } void UKUIMenuItem::setNormalBC(const QBrush &newNormalBC) { if (m_normalBC == newNormalBC) return; m_normalBC = newNormalBC; emit normalBCChanged(); } const QBrush &UKUIMenuItem::clickedBC() const { return m_clickedBC; } void UKUIMenuItem::setClickedBC(const QBrush &newClickedBC) { if (m_clickedBC == newClickedBC) return; m_clickedBC = newClickedBC; emit clickedBCChanged(); } const QBrush &UKUIMenuItem::hoveredBC() const { return m_hoveredBC; } void UKUIMenuItem::setHoveredBC(const QBrush &newHoveredBC) { if (m_hoveredBC == newHoveredBC) return; m_hoveredBC = newHoveredBC; emit hoveredBCChanged(); } const QBrush &UKUIMenuItem::disableBC() const { return m_disableBC; } void UKUIMenuItem::setDisableBC(const QBrush &newDisableBC) { if (m_disableBC == newDisableBC) return; m_disableBC = newDisableBC; emit disableBCChanged(); } const QBrush &UKUIMenuItem::disableTextColor() const { return m_disableTextColor; } void UKUIMenuItem::setDisableTextColor(const QBrush &newDisableTextColor) { if (m_disableTextColor == newDisableTextColor) return; m_disableTextColor = newDisableTextColor; emit disableTextColorChanged(); } const QBrush &UKUIMenuItem::normalTextColor() const { return m_normalTextColor; } void UKUIMenuItem::setNormalTextColor(const QBrush &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 QBrush &UKUIMenuItem::normalBorderColor() const { return m_normalBorderColor; } void UKUIMenuItem::setNormalBorderColor(const QBrush &newNormalBorderColor) { if (m_normalBorderColor == newNormalBorderColor) return; m_normalBorderColor = newNormalBorderColor; emit normalBorderColorChanged(); } const QBrush &UKUIMenuItem::hoverBorderColor() const { return m_hoverBorderColor; } void UKUIMenuItem::setHoverBorderColor(const QBrush &newHoverBorderColor) { if (m_hoverBorderColor == newHoverBorderColor) return; m_hoverBorderColor = newHoverBorderColor; emit hoverBorderColorChanged(); } const QBrush &UKUIMenuItem::clickBorderColor() const { return m_clickBorderColor; } void UKUIMenuItem::setClickBorderColor(const QBrush &newClickBorderColor) { if (m_clickBorderColor == newClickBorderColor) return; m_clickBorderColor = newClickBorderColor; emit clickBorderColorChanged(); } const QBrush &UKUIMenuItem::disableBorderColor() const { return m_disableBorderColor; } void UKUIMenuItem::setDisableBorderColor(const QBrush &newDisableBorderColor) { if (m_disableBorderColor == newDisableBorderColor) return; m_disableBorderColor = newDisableBorderColor; emit disableBorderColorChanged(); } const QBrush &UKUIMenuItem::normalTransparentBC() const { return m_normalTransparentBC; } void UKUIMenuItem::setNormalTransparentBC(const QBrush &newNormalTransparentBC) { if (m_normalTransparentBC == newNormalTransparentBC) return; m_normalTransparentBC = newNormalTransparentBC; emit normalTransparentBCChanged(); } const QBrush &UKUIMenuItem::clickedTransparentBC() const { return m_clickedTransparentBC; } void UKUIMenuItem::setClickedTransparentBC(const QBrush &newClickedTransparentBC) { if (m_clickedTransparentBC == newClickedTransparentBC) return; m_clickedTransparentBC = newClickedTransparentBC; emit clickedTransparentBCChanged(); } const QBrush &UKUIMenuItem::hoveredTransparentBC() const { return m_hoveredTransparentBC; } void UKUIMenuItem::setHoveredTransparentBC(const QBrush &newHoveredTransparentBC) { if (m_hoveredTransparentBC == newHoveredTransparentBC) return; m_hoveredTransparentBC = newHoveredTransparentBC; emit hoveredTransparentBCChanged(); } const QBrush &UKUIMenuItem::disableTransparentBC() const { return m_disableTransparentBC; } void UKUIMenuItem::setDisableTransparentBC(const QBrush &newDisableTransparentBC) { if (m_disableTransparentBC == newDisableTransparentBC) return; m_disableTransparentBC = newDisableTransparentBC; emit disableTransparentBCChanged(); } const QBrush &UKUIMenuItem::normalTransparentBorderColor() const { return m_normalTransparentBorderColor; } void UKUIMenuItem::setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor) { if (m_normalTransparentBorderColor == newNormalTransparentBorderColor) return; m_normalTransparentBorderColor = newNormalTransparentBorderColor; emit normalTransparentBorderColorChanged(); } const QBrush &UKUIMenuItem::hoverTransparentBorderColor() const { return m_hoverTransparentBorderColor; } void UKUIMenuItem::setHoverTransparentBorderColor(const QBrush &newHoverTransparentBorderColor) { if (m_hoverTransparentBorderColor == newHoverTransparentBorderColor) return; m_hoverTransparentBorderColor = newHoverTransparentBorderColor; emit hoverTransparentBorderColorChanged(); } const QBrush &UKUIMenuItem::clickTransparentBorderColor() const { return m_clickTransparentBorderColor; } void UKUIMenuItem::setClickTransparentBorderColor(const QBrush &newClickTransparentBorderColor) { if (m_clickTransparentBorderColor == newClickTransparentBorderColor) return; m_clickTransparentBorderColor = newClickTransparentBorderColor; emit clickTransparentBorderColorChanged(); } const QBrush &UKUIMenuItem::disableTransparentBorderColor() const { return m_disableTransparentBorderColor; } void UKUIMenuItem::setDisableTransparentBorderColor(const QBrush &newDisableTransparentBorderColor) { if (m_disableTransparentBorderColor == newDisableTransparentBorderColor) return; m_disableTransparentBorderColor = newDisableTransparentBorderColor; emit disableTransparentBorderColorChanged(); } const QBrush &UKUIMenuItem::normalCheckedBC() const { return m_normalCheckedBC; } void UKUIMenuItem::setNormalCheckedBC(const QBrush &newNormalCheckedBC) { if (m_normalCheckedBC == newNormalCheckedBC) return; m_normalCheckedBC = newNormalCheckedBC; emit normalCheckedBCChanged(); } const QBrush &UKUIMenuItem::clickedCheckedBC() const { return m_clickedCheckedBC; } void UKUIMenuItem::setClickedCheckedBC(const QBrush &newClickedCheckedBC) { if (m_clickedCheckedBC == newClickedCheckedBC) return; m_clickedCheckedBC = newClickedCheckedBC; emit clickedCheckedBCChanged(); } const QBrush &UKUIMenuItem::hoveredCheckedBC() const { return m_hoveredCheckedBC; } void UKUIMenuItem::setHoveredCheckedBC(const QBrush &newHoveredCheckedBC) { if (m_hoveredCheckedBC == newHoveredCheckedBC) return; m_hoveredCheckedBC = newHoveredCheckedBC; emit hoveredCheckedBCChanged(); } const QBrush &UKUIMenuItem::disableCheckedBC() const { return m_disableCheckedBC; } void UKUIMenuItem::setDisableCheckedBC(const QBrush &newDisableCheckedBC) { if (m_disableCheckedBC == newDisableCheckedBC) return; m_disableCheckedBC = newDisableCheckedBC; emit disableCheckedBCChanged(); } const QBrush &UKUIMenuItem::normalBorderCheckedColor() const { return m_normalBorderCheckedColor; } void UKUIMenuItem::setNormalBorderCheckedColor(const QBrush &newNormalBorderCheckedColor) { if (m_normalBorderCheckedColor == newNormalBorderCheckedColor) return; m_normalBorderCheckedColor = newNormalBorderCheckedColor; emit normalBorderCheckedColorChanged(); } const QBrush &UKUIMenuItem::hoverBorderCheckedColor() const { return m_hoverBorderCheckedColor; } void UKUIMenuItem::setHoverBorderCheckedColor(const QBrush &newHoverBorderCheckedColor) { if (m_hoverBorderCheckedColor == newHoverBorderCheckedColor) return; m_hoverBorderCheckedColor = newHoverBorderCheckedColor; emit hoverBorderCheckedColorChanged(); } const QBrush &UKUIMenuItem::clickBorderCheckedColor() const { return m_clickBorderCheckedColor; } void UKUIMenuItem::setClickBorderCheckedColor(const QBrush &newClickBorderCheckedColor) { if (m_clickBorderCheckedColor == newClickBorderCheckedColor) return; m_clickBorderCheckedColor = newClickBorderCheckedColor; emit clickBorderCheckedColorChanged(); } const QBrush &UKUIMenuItem::disableBorderCheckedColor() const { return m_disableBorderCheckedColor; } void UKUIMenuItem::setDisableBorderCheckedColor(const QBrush &newDisableBorderCheckedColor) { if (m_disableBorderCheckedColor == newDisableBorderCheckedColor) return; m_disableBorderCheckedColor = newDisableBorderCheckedColor; emit disableBorderCheckedColorChanged(); } const QBrush &UKUIMenuItem::normalHTextColor() const { return m_normalHTextColor; } void UKUIMenuItem::setNormalHTextColor(const QBrush &newNormalHTextColor) { if (m_normalHTextColor == newNormalHTextColor) return; m_normalHTextColor = newNormalHTextColor; emit normalHTextColorChanged(); } const QBrush &UKUIMenuItem::disableHTextColor() const { return m_disableHTextColor; } void UKUIMenuItem::setDisableHTextColor(const QBrush &newDisableHTextColor) { if (m_disableHTextColor == newDisableHTextColor) return; m_disableHTextColor = newDisableHTextColor; emit disableHTextColorChanged(); } const QBrush &UKUIMenuItem::normalCheckedHBC() const { return m_normalCheckedHBC; } void UKUIMenuItem::setNormalCheckedHBC(const QBrush &newNormalCheckedHBC) { if (m_normalCheckedHBC == newNormalCheckedHBC) return; m_normalCheckedHBC = newNormalCheckedHBC; emit normalCheckedHBCChanged(); } const QBrush &UKUIMenuItem::clickedCheckedHBC() const { return m_clickedCheckedHBC; } void UKUIMenuItem::setClickedCheckedHBC(const QBrush &newClickedCheckedHBC) { if (m_clickedCheckedHBC == newClickedCheckedHBC) return; m_clickedCheckedHBC = newClickedCheckedHBC; emit clickedCheckedHBCChanged(); } const QBrush &UKUIMenuItem::hoveredCheckedHBC() const { return m_hoveredCheckedHBC; } void UKUIMenuItem::setHoveredCheckedHBC(const QBrush &newHoveredCheckedHBC) { if (m_hoveredCheckedHBC == newHoveredCheckedHBC) return; m_hoveredCheckedHBC = newHoveredCheckedHBC; emit hoveredCheckedHBCChanged(); } const QBrush &UKUIMenuItem::disableCheckedHBC() const { return m_disableCheckedHBC; } void UKUIMenuItem::setDisableCheckedHBC(const QBrush &newDisableCheckedHBC) { if (m_disableCheckedHBC == newDisableCheckedHBC) return; m_disableCheckedHBC = newDisableCheckedHBC; emit disableCheckedHBCChanged(); } const QBrush &UKUIMenuItem::normalCheckedHBorderColor() const { return m_normalCheckedHBorderColor; } void UKUIMenuItem::setNormalCheckedHBorderColor(const QBrush &newNormalCheckedHBorderColor) { if (m_normalCheckedHBorderColor == newNormalCheckedHBorderColor) return; m_normalCheckedHBorderColor = newNormalCheckedHBorderColor; emit normalCheckedHBorderColorChanged(); } const QBrush &UKUIMenuItem::clickedCheckedHBorderColor() const { return m_clickedCheckedHBorderColor; } void UKUIMenuItem::setClickedCheckedHBorderColor(const QBrush &newClickedCheckedHBorderColor) { if (m_clickedCheckedHBorderColor == newClickedCheckedHBorderColor) return; m_clickedCheckedHBorderColor = newClickedCheckedHBorderColor; emit clickedCheckedHBorderColorChanged(); } const QBrush &UKUIMenuItem::hoveredCheckedHBorderColor() const { return m_hoveredCheckedHBorderColor; } void UKUIMenuItem::setHoveredCheckedHBorderColor(const QBrush &newHoveredCheckedHBorderColor) { if (m_hoveredCheckedHBorderColor == newHoveredCheckedHBorderColor) return; m_hoveredCheckedHBorderColor = newHoveredCheckedHBorderColor; emit hoveredCheckedHBorderColorChanged(); } const QBrush &UKUIMenuItem::disableCheckedHBorderColor() const { return m_disableCheckedHBorderColor; } void UKUIMenuItem::setDisableCheckedHBorderColor(const QBrush &newDisableCheckedHBorderColor) { if (m_disableCheckedHBorderColor == newDisableCheckedHBorderColor) return; m_disableCheckedHBorderColor = newDisableCheckedHBorderColor; emit disableCheckedHBorderColorChanged(); } const QBrush &UKUIMenuItem::normalCheckedTransparentBC() const { return m_normalCheckedTransparentBC; } void UKUIMenuItem::setNormalCheckedTransparentBC(const QBrush &newNormalCheckedTransparentBC) { if (m_normalCheckedTransparentBC == newNormalCheckedTransparentBC) return; m_normalCheckedTransparentBC = newNormalCheckedTransparentBC; emit normalCheckedTransparentBCChanged(); } const QBrush &UKUIMenuItem::clickedCheckedTransparentBC() const { return m_clickedCheckedTransparentBC; } void UKUIMenuItem::setClickedCheckedTransparentBC(const QBrush &newClickedCheckedTransparentBC) { if (m_clickedCheckedTransparentBC == newClickedCheckedTransparentBC) return; m_clickedCheckedTransparentBC = newClickedCheckedTransparentBC; emit clickedCheckedTransparentBCChanged(); } const QBrush &UKUIMenuItem::hoveredCheckedTransparentBC() const { return m_hoveredCheckedTransparentBC; } void UKUIMenuItem::setHoveredCheckedTransparentBC(const QBrush &newHoveredCheckedTransparentBC) { if (m_hoveredCheckedTransparentBC == newHoveredCheckedTransparentBC) return; m_hoveredCheckedTransparentBC = newHoveredCheckedTransparentBC; emit hoveredCheckedTransparentBCChanged(); } const QBrush &UKUIMenuItem::disableCheckedTransparentBC() const { return m_disableCheckedTransparentBC; } void UKUIMenuItem::setDisableCheckedTransparentBC(const QBrush &newDisableCheckedTransparentBC) { if (m_disableCheckedTransparentBC == newDisableCheckedTransparentBC) return; m_disableCheckedTransparentBC = newDisableCheckedTransparentBC; emit disableCheckedTransparentBCChanged(); } const QBrush &UKUIMenuItem::normalBorderCheckedTransparentColor() const { return m_normalBorderCheckedTransparentColor; } void UKUIMenuItem::setNormalBorderCheckedTransparentColor(const QBrush &newNormalBorderCheckedTransparentColor) { if (m_normalBorderCheckedTransparentColor == newNormalBorderCheckedTransparentColor) return; m_normalBorderCheckedTransparentColor = newNormalBorderCheckedTransparentColor; emit normalBorderCheckedColorTransparentChanged(); } const QBrush &UKUIMenuItem::hoverBorderCheckedTransparentColor() const { return m_hoverBorderCheckedTransparentColor; } void UKUIMenuItem::setHoverBorderCheckedTransparentColor(const QBrush &newHoverBorderCheckedTransparentColor) { if (m_hoverBorderCheckedTransparentColor == newHoverBorderCheckedTransparentColor) return; m_hoverBorderCheckedTransparentColor = newHoverBorderCheckedTransparentColor; emit hoverBorderCheckedColorTransparentChanged(); } const QBrush &UKUIMenuItem::clickBorderCheckedTransparentColor() const { return m_clickBorderCheckedTransparentColor; } void UKUIMenuItem::setClickBorderCheckedTransparentColor(const QBrush &newClickBorderCheckedTransparentColor) { if (m_clickBorderCheckedTransparentColor == newClickBorderCheckedTransparentColor) return; m_clickBorderCheckedTransparentColor = newClickBorderCheckedTransparentColor; emit clickBorderCheckedColorTransparentChanged(); } const QBrush &UKUIMenuItem::disableBorderCheckedTransparentColor() const { return m_disableBorderCheckedTransparentColor; } void UKUIMenuItem::setDisableBorderCheckedTransparentColor(const QBrush &newDisableBorderCheckedTransparentColor) { if (m_disableBorderCheckedTransparentColor == newDisableBorderCheckedTransparentColor) return; m_disableBorderCheckedTransparentColor = newDisableBorderCheckedTransparentColor; emit disableBorderCheckedColorTransparentChanged(); } const QBrush &UKUIMenuItem::menuSeparatorColor() const { return m_menuSeparatorColor; } void UKUIMenuItem::setMenuSeparatorColor(const QBrush &newMenuSeparatorColor) { if (m_menuSeparatorColor == newMenuSeparatorColor) return; m_menuSeparatorColor = newMenuSeparatorColor; emit menuSeparatorColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiprogressbar.h0000664000175000017500000001340715154306200026653 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUIPROGRESSBAR_H #define UKUIPROGRESSBAR_H #include #include #include #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUIProgressBar : public QQuickItem { Q_OBJECT Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged) Q_PROPERTY(QBrush normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged) Q_PROPERTY(QBrush 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(QBrush indeterminateChildrenStartColor READ indeterminateChildrenStartColor WRITE setIndeterminateChildrenStartColor NOTIFY indeterminateChildrenStartColorChanged) Q_PROPERTY(QBrush indeterminateChildrenEndColor READ indeterminateChildrenEndColor WRITE setIndeterminateChildrenEndColor NOTIFY indeterminateChildrenEndColorChanged) Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) Q_PROPERTY(QBrush borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) Q_PROPERTY(QBrush hightlightTextColor READ hightlightTextColor WRITE setHightlightTextColor NOTIFY hightlightTextColorChanged) Q_PROPERTY(QBrush normalTransparentColor READ normalTransparentColor WRITE setNormalTransparentColor NOTIFY normalTransparentColorChanged) Q_PROPERTY(QBrush transparentborderColor READ transparentborderColor WRITE setTransparentBorderColor NOTIFY transparentBorderColorChanged) Q_PROPERTY(QBrush indeterminateColor READ indeterminateColor WRITE setIndeterminateColor NOTIFY indeterminateColorChanged) public: explicit UKUIProgressBar(QQuickItem *parent = nullptr); ~UKUIProgressBar(); void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance); static UKUIProgressBar* qmlAttachedProperties(QObject* parent); const QBrush &normalColor() const; void setNormalColor(const QBrush &newNormalColor); int radius() const; void setRadius(int newRadius); const QBrush &childrenColor() const; void setChildrenColor(const QBrush &newChildrenColor); int normalWidth() const; void setNormalWidth(int newNormalWidth); int normalHeight() const; void setNormalHeight(int newNormalHeight); int indeterminateChildrenWidth() const; void setIndeterminateChildrenWidth(int newIndeterminateChildrenWidth); const QBrush &indeterminateChildrenStartColor() const; void setIndeterminateChildrenStartColor(const QBrush &newIndeterminateChildrenStartColor); const QBrush &indeterminateChildrenEndColor() const; void setIndeterminateChildrenEndColor(const QBrush &newIndeterminateChildrenEndColor); int borderWidth() const; void setBorderWidth(int newBorderWidth); const QBrush &borderColor() const; void setBorderColor(const QBrush &newBorderColor); const QBrush &hightlightTextColor() const; void setHightlightTextColor(const QBrush &newHightlightTextColor); const QBrush &normalTransparentColor() const; void setNormalTransparentColor(const QBrush &newNormalTransparentColor); const QBrush &transparentborderColor() const; void setTransparentBorderColor(const QBrush &newTransparentborderColor); const QBrush &indeterminateColor() const; void setIndeterminateColor(const QBrush &newIndeterminateColor); int calculateHighColor(int c); signals: void normalColorChanged(); void radiusChanged(); void childrenColorChanged(); void normalWidthChanged(); void normalHeightChanged(); void indeterminateChildrenWidthChanged(); void indeterminateChildrenStartColorChanged(); void indeterminateChildrenEndColorChanged(); void borderWidthChanged(); void borderColorChanged(); void parametryChanged(); void hightlightTextColorChanged(); void normalTransparentColorChanged(); void transparentBorderColorChanged(); void indeterminateColorChanged(); private: Q_INVOKABLE QBrush m_normalColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.85)); int m_radius; Q_INVOKABLE QBrush m_childrenColor; int m_normalWidth; int m_normalHeight; int m_indeterminateChildrenWidth; Q_INVOKABLE QBrush m_indeterminateChildrenStartColor; Q_INVOKABLE QBrush m_indeterminateChildrenEndColor; int m_borderWidth; Q_INVOKABLE QBrush m_borderColor; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_hightlightTextColor; QBrush m_normalTransparentColor; QBrush m_transparentborderColor; QBrush m_indeterminateColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIProgressBar, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUIPROGRESSBAR_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiswitch.cpp0000664000175000017500000003164015154306200026155 0ustar fengfeng#include "ukuiswitch.h" #include "qdebug.h" using namespace UKUIQQC2Style; UKUISwitch::UKUISwitch(QQuickItem *parent) : QQuickItem(parent) { if(!qApp || !qApp->property("qqc2-globaltoken").isValid()) return; TokenParameter * token = qApp->property("qqc2-globaltoken").value(); if(token && token->getInstance()){ m_instance = token->getInstance(); initParam(m_instance); connect(m_instance, &UKUIGlobalDTConfig::GlobalDTConfig::tokenChanged, this, [=](){ initParam(m_instance); }, Qt::UniqueConnection); } } UKUISwitch::~UKUISwitch() { } void UKUISwitch::initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance) { setNormalColor(instance->kComponentNormal()); setHoverColor(instance->kComponentHover()); setClickColor(instance->kComponentClick()); setDisableColor(instance->kComponentDisable()); setNormalBorderColor(instance->kLineComponentNormal()); setHoverBorderColor(instance->kLineComponentHover()); setClickBorderColor(instance->kLineComponentClick()); setDisableBorderColor(instance->kLineComponentDisable()); setCheckedNormalColor(instance->kBrandNormal()); setCheckedHoverColor(instance->kBrandHover()); setCheckedClickColor(instance->kBrandClick()); setCheckedDisableColor(instance->kBrandDisable()); setCheckedNormalBorderColor(instance->kLineComponentNormal()); setCheckedHoverBorderColor(instance->kLineComponentHover()); setCheckedClickBorderColor(instance->kLineComponentClick()); setCheckedDisableBorderColor(instance->kLineComponentDisable()); setNormalIndicatorColor(instance->kFontWhite()); setDisableIndicatorColor(instance->kFontWhiteDisable()); setNormalTransparentColor(instance->kComponentAlphaNormal()); setHoverTransparentColor(instance->kComponentAlphaHover()); setClickTransparentColor(instance->kComponentAlphaClick()); setDisableTransparentColor(instance->kComponentAlphaDisable()); setNormalTransparentBorderColor(instance->kLineComponentNormal()); setHoverTransparentBorderColor(instance->kLineComponentHover()); setClickTransparentBorderColor(instance->kLineComponentClick()); setDisableTransparentBorderColor(instance->kLineComponentDisable()); setRecWidth(44); setRecHeight(22); setIndicatorWidth(16); setPadding(4); setBorderWidth(instance->normalline()); setIndicatorLeftRightPadding(4); emit parametryChanged(); } UKUISwitch* UKUISwitch::qmlAttachedProperties(QObject* parent) { auto p = qobject_cast(parent); return new UKUISwitch(p); } const QBrush &UKUISwitch::normalColor() const { return m_normalColor; } void UKUISwitch::setNormalColor(const QBrush &newNormalColor) { if (m_normalColor == newNormalColor) return; m_normalColor = newNormalColor; emit normalColorChanged(); } int UKUISwitch::padding() const { return m_padding; } void UKUISwitch::setPadding(int newPadding) { if (m_padding == newPadding) return; m_padding = newPadding; emit paddingChanged(); } const QBrush &UKUISwitch::hoverColor() const { return m_hoverColor; } void UKUISwitch::setHoverColor(const QBrush &newHoverColor) { if (m_hoverColor == newHoverColor) return; m_hoverColor = newHoverColor; emit hoverColorChanged(); } const QBrush &UKUISwitch::clickColor() const { return m_clickColor; } void UKUISwitch::setClickColor(const QBrush &newClickColor) { if (m_clickColor == newClickColor) return; m_clickColor = newClickColor; emit clickColorChanged(); } const QBrush &UKUISwitch::disableColor() const { return m_disableColor; } void UKUISwitch::setDisableColor(const QBrush &newDisableColor) { if (m_disableColor == newDisableColor) return; m_disableColor = newDisableColor; emit disableColorChanged(); } const QBrush &UKUISwitch::checkedNormalColor() const { return m_checkedNormalColor; } void UKUISwitch::setCheckedNormalColor(const QBrush &newCheckedNormalColor) { if (m_checkedNormalColor == newCheckedNormalColor) return; m_checkedNormalColor = newCheckedNormalColor; emit checkedNormalColorChanged(); } const QBrush &UKUISwitch::checkedHoverColor() const { return m_checkedHoverColor; } void UKUISwitch::setCheckedHoverColor(const QBrush &newCheckedHoverColor) { if (m_checkedHoverColor == newCheckedHoverColor) return; m_checkedHoverColor = newCheckedHoverColor; emit checkedHoverColorChanged(); } const QBrush &UKUISwitch::checkedClickColor() const { return m_checkedClickColor; } void UKUISwitch::setCheckedClickColor(const QBrush &newCheckedClickColor) { if (m_checkedClickColor == newCheckedClickColor) return; m_checkedClickColor = newCheckedClickColor; emit checkedClickColorChanged(); } const QBrush &UKUISwitch::checkedDisableColor() const { return m_checkedDisableColor; } void UKUISwitch::setCheckedDisableColor(const QBrush &newCheckedDisableColor) { if (m_checkedDisableColor == newCheckedDisableColor) return; m_checkedDisableColor = newCheckedDisableColor; emit checkedDisableColorChanged(); } const QBrush &UKUISwitch::normalBorderColor() const { return m_normalBorderColor; } void UKUISwitch::setNormalBorderColor(const QBrush &newNormalBorderColor) { if (m_normalBorderColor == newNormalBorderColor) return; m_normalBorderColor = newNormalBorderColor; emit normalBorderColorChanged(); } const QBrush &UKUISwitch::hoverBorderColor() const { return m_hoverBorderColor; } void UKUISwitch::setHoverBorderColor(const QBrush &newHoverBorderColor) { if (m_hoverBorderColor == newHoverBorderColor) return; m_hoverBorderColor = newHoverBorderColor; emit hoverBorderColorChanged(); } const QBrush &UKUISwitch::clickBorderColor() const { return m_clickBorderColor; } void UKUISwitch::setClickBorderColor(const QBrush &newClickBorderColor) { if (m_clickBorderColor == newClickBorderColor) return; m_clickBorderColor = newClickBorderColor; emit clickBorderColorChanged(); } const QBrush &UKUISwitch::disableBorderColor() const { return m_disableBorderColor; } void UKUISwitch::setDisableBorderColor(const QBrush &newDisableBorderColor) { if (m_disableBorderColor == newDisableBorderColor) return; m_disableBorderColor = newDisableBorderColor; emit disableBorderColorChanged(); } const QBrush &UKUISwitch::checkedNormalBorderColor() const { return m_checkedNormalBorderColor; } void UKUISwitch::setCheckedNormalBorderColor(const QBrush &newCheckedNormalBorderColor) { if (m_checkedNormalBorderColor == newCheckedNormalBorderColor) return; m_checkedNormalBorderColor = newCheckedNormalBorderColor; emit checkedNormalBorderColorChanged(); } const QBrush &UKUISwitch::checkedHoverBorderColor() const { return m_checkedHoverBorderColor; } void UKUISwitch::setCheckedHoverBorderColor(const QBrush &newCheckedHoverBorderColor) { if (m_checkedHoverBorderColor == newCheckedHoverBorderColor) return; m_checkedHoverBorderColor = newCheckedHoverBorderColor; emit checkedHoverBorderColorChanged(); } const QBrush &UKUISwitch::checkedClickBorderColor() const { return m_checkedClickBorderColor; } void UKUISwitch::setCheckedClickBorderColor(const QBrush &newCheckedClickBorderColor) { if (m_checkedClickBorderColor == newCheckedClickBorderColor) return; m_checkedClickBorderColor = newCheckedClickBorderColor; emit checkedClickBorderColorChanged(); } const QBrush &UKUISwitch::checkedDisableBorderColor() const { return m_checkedDisableBorderColor; } void UKUISwitch::setCheckedDisableBorderColor(const QBrush &newCheckedDisableBorderColor) { if (m_checkedDisableBorderColor == newCheckedDisableBorderColor) return; m_checkedDisableBorderColor = newCheckedDisableBorderColor; emit checkedDisableBorderColorChanged(); } int UKUISwitch::borderWidth() const { return m_borderWidth; } void UKUISwitch::setBorderWidth(int newBorderWidth) { if (m_borderWidth == newBorderWidth) return; m_borderWidth = newBorderWidth; emit borderWidthChanged(); } const QBrush &UKUISwitch::normalIndicatorColor() const { return m_normalIndicatorColor; } void UKUISwitch::setNormalIndicatorColor(const QBrush &newNormalIndicatorColor) { if (m_normalIndicatorColor == newNormalIndicatorColor) return; m_normalIndicatorColor = newNormalIndicatorColor; emit normalIndicatorColorChanged(); } const QBrush &UKUISwitch::disableIndicatorColor() const { return m_disableIndicatorColor; } void UKUISwitch::setDisableIndicatorColor(const QBrush &newDisableIndicatorColor) { if (m_disableIndicatorColor == newDisableIndicatorColor) return; m_disableIndicatorColor = newDisableIndicatorColor; emit disableIndicatorColorChanged(); } int UKUISwitch::indicatorWidth() const { return m_indicatorWidth; } void UKUISwitch::setIndicatorWidth(int newIndicatorWidth) { if (m_indicatorWidth == newIndicatorWidth) return; m_indicatorWidth = newIndicatorWidth; emit indicatorWidthChanged(); } int UKUISwitch::recWidth() const { return m_recWidth; } void UKUISwitch::setRecWidth(int newRecWidth) { if (m_recWidth == newRecWidth) return; m_recWidth = newRecWidth; emit recWidthHChanged(); } int UKUISwitch::recHeight() const { return m_recHeight; } void UKUISwitch::setRecHeight(int newRecHeight) { if (m_recHeight == newRecHeight) return; m_recHeight = newRecHeight; emit recHeightChanged(); } int UKUISwitch::indicatorLeftRightPadding() const { return m_indicatorLeftRightPadding; } void UKUISwitch::setIndicatorLeftRightPadding(int newIndicatorLeftRightPadding) { if (m_indicatorLeftRightPadding == newIndicatorLeftRightPadding) return; m_indicatorLeftRightPadding = newIndicatorLeftRightPadding; emit indicatorLeftRightPaddingChanged(); } const QBrush &UKUISwitch::normalTransparentColor() const { return m_normalTransparentColor; } void UKUISwitch::setNormalTransparentColor(const QBrush &newNormalTransparentColor) { if (m_normalTransparentColor == newNormalTransparentColor) return; m_normalTransparentColor = newNormalTransparentColor; emit normalTransparentColorChanged(); } const QBrush &UKUISwitch::hoverTransparentColor() const { return m_hoverTransparentColor; } void UKUISwitch::setHoverTransparentColor(const QBrush &newHoverTransparentColor) { if (m_hoverTransparentColor == newHoverTransparentColor) return; m_hoverTransparentColor = newHoverTransparentColor; emit hoverTransparentColorChanged(); } const QBrush &UKUISwitch::clickTransparentColor() const { return m_clickTransparentColor; } void UKUISwitch::setClickTransparentColor(const QBrush &newClickTransparentColor) { if (m_clickTransparentColor == newClickTransparentColor) return; m_clickTransparentColor = newClickTransparentColor; emit clickTransparentColorChanged(); } const QBrush &UKUISwitch::disableTransparentColor() const { return m_disableTransparentColor; } void UKUISwitch::setDisableTransparentColor(const QBrush &newDisableTransparentColor) { if (m_disableTransparentColor == newDisableTransparentColor) return; m_disableTransparentColor = newDisableTransparentColor; emit disableTransparentColorChanged(); } const QBrush &UKUISwitch::normalTransparentBorderColor() const { return m_normalTransparentBorderColor; } void UKUISwitch::setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor) { if (m_normalTransparentBorderColor == newNormalTransparentBorderColor) return; m_normalTransparentBorderColor = newNormalTransparentBorderColor; emit normalTransparentBorderColorChanged(); } const QBrush &UKUISwitch::hoverTransparentBorderColor() const { return m_hoverTransparentBorderColor; } void UKUISwitch::setHoverTransparentBorderColor(const QBrush &newHoverTransparentBorderColor) { if (m_hoverTransparentBorderColor == newHoverTransparentBorderColor) return; m_hoverTransparentBorderColor = newHoverTransparentBorderColor; emit hoverTransparentBorderColorChanged(); } const QBrush &UKUISwitch::clickTransparentBorderColor() const { return m_clickTransparentBorderColor; } void UKUISwitch::setClickTransparentBorderColor(const QBrush &newClickTransparentBorderColor) { if (m_clickTransparentBorderColor == newClickTransparentBorderColor) return; m_clickTransparentBorderColor = newClickTransparentBorderColor; emit clickTransparentBorderColorChanged(); } const QBrush &UKUISwitch::disableTransparentBorderColor() const { return m_disableTransparentBorderColor; } void UKUISwitch::setDisableTransparentBorderColor(const QBrush &newDisableTransparentBorderColor) { if (m_disableTransparentBorderColor == newDisableTransparentBorderColor) return; m_disableTransparentBorderColor = newDisableTransparentBorderColor; emit disableTransparentBorderColorChanged(); } qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiscrollbar.h0000664000175000017500000001017715154306200026306 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUISCROLLBAR_H #define UKUISCROLLBAR_H #include #include #include #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUIScrollBar : public QQuickItem { Q_OBJECT Q_PROPERTY(QBrush normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged) Q_PROPERTY(QBrush hoverColor READ hoverColor WRITE setHoverColor NOTIFY hoverColorChanged) Q_PROPERTY(QBrush clickColor READ clickColor WRITE setClickColor NOTIFY clickColorChanged) Q_PROPERTY(QBrush disableColor READ disableColor WRITE setDisableColor NOTIFY disableColorChanged) Q_PROPERTY(QBrush normalTransparentColor READ normalTransparentColor WRITE setNormalTransparentColor NOTIFY normalTransparentColorChanged) Q_PROPERTY(QBrush hoverTransparentColor READ hoverTransparentColor WRITE setHoverTransparentColor NOTIFY hoverTransparentColorChanged) Q_PROPERTY(QBrush clickTransparentColor READ clickTransparentColor WRITE setClickTransparentColor NOTIFY clickTransparentColorChanged) Q_PROPERTY(QBrush disableTransparentColor READ disableTransparentColor WRITE setDisableTransparentColor NOTIFY disableTransparentColorChanged) 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 QBrush &normalColor() const; void setNormalColor(const QBrush &newNormalColor); int padding() const; void setPadding(int newPadding); const QBrush &hoverColor() const; void setHoverColor(const QBrush &newHoverColor); const QBrush &clickColor() const; void setClickColor(const QBrush &newClickColor); const QBrush &disableColor() const; void setDisableColor(const QBrush &newDisableColor); const QBrush &normalTransparentColor() const; void setNormalTransparentColor(const QBrush &newNormalTransparentColor); const QBrush &hoverTransparentColor() const; void setHoverTransparentColor(const QBrush &newHoverTransparentColor); const QBrush &clickTransparentColor() const; void setClickTransparentColor(const QBrush &newClickTransparentColor); const QBrush &disableTransparentColor() const; void setDisableTransparentColor(const QBrush &newDisableTransparentColor); signals: void normalColorChanged(); void paddingChanged(); void hoverColorChanged(); void clickColorChanged(); void disableColorChanged(); void parametryChanged(); void normalTransparentColorChanged(); void hoverTransparentColorChanged(); void clickTransparentColorChanged(); void disableTransparentColorChanged(); private: Q_INVOKABLE QBrush m_normalColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.85)); int m_padding = 2; Q_INVOKABLE QBrush m_hoverColor; Q_INVOKABLE QBrush m_clickColor; Q_INVOKABLE QBrush m_disableColor; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_normalTransparentColor; QBrush m_hoverTransparentColor; QBrush m_clickTransparentColor; QBrush m_disableTransparentColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUIScrollBar, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUISCROLLBAR_H qt6-ukui-platformtheme/ukui-qml-style-helper/styleparameter/ukuiswitch.h0000664000175000017500000002661515154306200025630 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ #ifndef UKUISWITCH_H #define UKUISWITCH_H #include #include #include #include #include #include #include #include "tokenparameter.h" namespace UKUIQQC2Style { class UKUISwitch : public QQuickItem { Q_OBJECT Q_PROPERTY(QBrush normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged) Q_PROPERTY(QBrush hoverColor READ hoverColor WRITE setHoverColor NOTIFY hoverColorChanged) Q_PROPERTY(QBrush clickColor READ clickColor WRITE setClickColor NOTIFY clickColorChanged) Q_PROPERTY(QBrush disableColor READ disableColor WRITE setDisableColor NOTIFY disableColorChanged) Q_PROPERTY(QBrush checkedNormalColor READ checkedNormalColor WRITE setCheckedNormalColor NOTIFY checkedNormalColorChanged) Q_PROPERTY(QBrush checkedHoverColor READ checkedHoverColor WRITE setCheckedHoverColor NOTIFY checkedHoverColorChanged) Q_PROPERTY(QBrush checkedClickColor READ checkedClickColor WRITE setCheckedClickColor NOTIFY checkedClickColorChanged) Q_PROPERTY(QBrush checkedDisableColor READ checkedDisableColor WRITE setCheckedDisableColor NOTIFY checkedDisableColorChanged) Q_PROPERTY(QBrush normalBorderColor READ normalBorderColor WRITE setNormalBorderColor NOTIFY normalBorderColorChanged) Q_PROPERTY(QBrush hoverBorderColor READ hoverBorderColor WRITE setHoverBorderColor NOTIFY hoverBorderColorChanged) Q_PROPERTY(QBrush clickBorderColor READ clickBorderColor WRITE setClickBorderColor NOTIFY clickBorderColorChanged) Q_PROPERTY(QBrush disableBorderColor READ disableBorderColor WRITE setDisableBorderColor NOTIFY disableBorderColorChanged) Q_PROPERTY(QBrush checkedNormalBorderColor READ checkedNormalBorderColor WRITE setCheckedNormalBorderColor NOTIFY checkedNormalBorderColorChanged) Q_PROPERTY(QBrush checkedHoverBorderColor READ checkedHoverBorderColor WRITE setCheckedHoverBorderColor NOTIFY checkedHoverBorderColorChanged) Q_PROPERTY(QBrush checkedClickBorderColor READ checkedClickBorderColor WRITE setCheckedClickBorderColor NOTIFY checkedClickBorderColorChanged) Q_PROPERTY(QBrush checkedDisableBorderColor READ checkedDisableBorderColor WRITE setCheckedDisableBorderColor NOTIFY checkedDisableBorderColorChanged) Q_PROPERTY(QBrush normalIndicatorColor READ normalIndicatorColor WRITE setNormalIndicatorColor NOTIFY normalIndicatorColorChanged) Q_PROPERTY(QBrush disableIndicatorColor READ disableIndicatorColor WRITE setDisableIndicatorColor NOTIFY disableIndicatorColorChanged) Q_PROPERTY(QBrush normalTransparentColor READ normalTransparentColor WRITE setNormalTransparentColor NOTIFY normalTransparentColorChanged) Q_PROPERTY(QBrush hoverTransparentColor READ hoverTransparentColor WRITE setHoverTransparentColor NOTIFY hoverTransparentColorChanged) Q_PROPERTY(QBrush clickTransparentColor READ clickTransparentColor WRITE setClickTransparentColor NOTIFY clickTransparentColorChanged) Q_PROPERTY(QBrush disableTransparentColor READ disableTransparentColor WRITE setDisableTransparentColor NOTIFY disableTransparentColorChanged) Q_PROPERTY(QBrush normalTransparentBorderColor READ normalTransparentBorderColor WRITE setNormalTransparentBorderColor NOTIFY normalTransparentBorderColorChanged) Q_PROPERTY(QBrush hoverTransparentBorderColor READ hoverTransparentBorderColor WRITE setHoverTransparentBorderColor NOTIFY hoverTransparentBorderColorChanged) Q_PROPERTY(QBrush clickTransparentBorderColor READ clickTransparentBorderColor WRITE setClickTransparentBorderColor NOTIFY clickTransparentBorderColorChanged) Q_PROPERTY(QBrush disableTransparentBorderColor READ disableTransparentBorderColor WRITE setDisableTransparentBorderColor NOTIFY disableTransparentBorderColorChanged) Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged) Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) Q_PROPERTY(int recWidth READ recWidth WRITE setRecWidth NOTIFY recWidthHChanged) Q_PROPERTY(int recHeight READ recHeight WRITE setRecHeight NOTIFY recHeightChanged) Q_PROPERTY(int indicatorWidth READ indicatorWidth WRITE setIndicatorWidth NOTIFY indicatorWidthChanged) Q_PROPERTY(int indicatorLeftRightPadding READ indicatorLeftRightPadding WRITE setIndicatorLeftRightPadding NOTIFY indicatorLeftRightPaddingChanged) public: explicit UKUISwitch(QQuickItem *parent = nullptr); ~UKUISwitch(); void initParam(UKUIGlobalDTConfig::GlobalDTConfig* instance); static UKUISwitch* qmlAttachedProperties(QObject* parent); const QBrush &normalColor() const; void setNormalColor(const QBrush &newNormalColor); int padding() const; void setPadding(int newPadding); const QBrush &hoverColor() const; void setHoverColor(const QBrush &newHoverColor); const QBrush &clickColor() const; void setClickColor(const QBrush &newClickColor); const QBrush &disableColor() const; void setDisableColor(const QBrush &newDisableColor); const QBrush &checkedNormalColor() const; void setCheckedNormalColor(const QBrush &newCheckedNormalColor); const QBrush &checkedHoverColor() const; void setCheckedHoverColor(const QBrush &newCheckedHoverColor); const QBrush &checkedClickColor() const; void setCheckedClickColor(const QBrush &newCheckedClickColor); const QBrush &checkedDisableColor() const; void setCheckedDisableColor(const QBrush &newCheckedDisableColor); const QBrush &normalBorderColor() const; void setNormalBorderColor(const QBrush &newNormalBorderColor); const QBrush &hoverBorderColor() const; void setHoverBorderColor(const QBrush &newHoverBorderColor); const QBrush &clickBorderColor() const; void setClickBorderColor(const QBrush &newClickBorderColor); const QBrush &disableBorderColor() const; void setDisableBorderColor(const QBrush &newDisableBorderColor); const QBrush &checkedNormalBorderColor() const; void setCheckedNormalBorderColor(const QBrush &newCheckedNormalBorderColor); const QBrush &checkedHoverBorderColor() const; void setCheckedHoverBorderColor(const QBrush &newCheckedHoverBorderColor); const QBrush &checkedClickBorderColor() const; void setCheckedClickBorderColor(const QBrush &newCheckedClickBorderColor); const QBrush &checkedDisableBorderColor() const; void setCheckedDisableBorderColor(const QBrush &newCheckedDisableBorderColor); int borderWidth() const; void setBorderWidth(int newBorderWidth); const QBrush &normalIndicatorColor() const; void setNormalIndicatorColor(const QBrush &newNormalIndicatorColor); const QBrush &disableIndicatorColor() const; void setDisableIndicatorColor(const QBrush &newDisableIndicatorColor); int indicatorWidth() const; void setIndicatorWidth(int newIndicatorWidth); int recWidth() const; void setRecWidth(int newRecWidth); int recHeight() const; void setRecHeight(int newRecHeight); int indicatorLeftRightPadding() const; void setIndicatorLeftRightPadding(int newIndicatorLeftRightPadding); const QBrush &normalTransparentColor() const; void setNormalTransparentColor(const QBrush &newNormalTransparentColor); const QBrush &hoverTransparentColor() const; void setHoverTransparentColor(const QBrush &newHoverTransparentColor); const QBrush &clickTransparentColor() const; void setClickTransparentColor(const QBrush &newClickTransparentColor); const QBrush &disableTransparentColor() const; void setDisableTransparentColor(const QBrush &newDisableTransparentColor); const QBrush &normalTransparentBorderColor() const; void setNormalTransparentBorderColor(const QBrush &newNormalTransparentBorderColor); const QBrush &hoverTransparentBorderColor() const; void setHoverTransparentBorderColor(const QBrush &newHoverTransparentBorderColor); const QBrush &clickTransparentBorderColor() const; void setClickTransparentBorderColor(const QBrush &newClickTransparentBorderColor); const QBrush &disableTransparentBorderColor() const; void setDisableTransparentBorderColor(const QBrush &newDisableTransparentBorderColor); signals: void normalColorChanged(); void paddingChanged(); void hoverColorChanged(); void clickColorChanged(); void disableColorChanged(); void parametryChanged(); void checkedNormalColorChanged(); void checkedHoverColorChanged(); void checkedClickColorChanged(); void checkedDisableColorChanged(); void normalBorderColorChanged(); void hoverBorderColorChanged(); void clickBorderColorChanged(); void disableBorderColorChanged(); void checkedNormalBorderColorChanged(); void checkedHoverBorderColorChanged(); void checkedClickBorderColorChanged(); void checkedDisableBorderColorChanged(); void borderWidthChanged(); void normalIndicatorColorChanged(); void disableIndicatorColorChanged(); void indicatorWidthChanged(); void recWidthHChanged(); void recHeightChanged(); void indicatorLeftRightPaddingChanged(); void normalTransparentColorChanged(); void hoverTransparentColorChanged(); void clickTransparentColorChanged(); void disableTransparentColorChanged(); void normalTransparentBorderColorChanged(); void hoverTransparentBorderColorChanged(); void clickTransparentBorderColorChanged(); void disableTransparentBorderColorChanged(); private: Q_INVOKABLE QBrush m_normalColor = QBrush(QColor::fromRgbF(0, 0, 0, 0.85)); int m_padding = 2; Q_INVOKABLE QBrush m_hoverColor; Q_INVOKABLE QBrush m_clickColor; Q_INVOKABLE QBrush m_disableColor; UKUIGlobalDTConfig::GlobalDTConfig* m_instance = nullptr; QBrush m_checkedNormalColor; QBrush m_checkedHoverColor; QBrush m_checkedClickColor; QBrush m_checkedDisableColor; QBrush m_normalBorderColor; QBrush m_hoverBorderColor; QBrush m_clickBorderColor; QBrush m_disableBorderColor; QBrush m_checkedNormalBorderColor; QBrush m_checkedHoverBorderColor; QBrush m_checkedClickBorderColor; QBrush m_checkedDisableBorderColor; int m_borderWidth; QBrush m_normalIndicatorColor; QBrush m_disableIndicatorColor; int m_indicatorWidth; int m_recWidth; int m_recHeight; int m_indicatorLeftRightPadding; QBrush m_normalTransparentColor; QBrush m_hoverTransparentColor; QBrush m_clickTransparentColor; QBrush m_disableTransparentColor; QBrush m_normalTransparentBorderColor; QBrush m_hoverTransparentBorderColor; QBrush m_clickTransparentBorderColor; QBrush m_disableTransparentBorderColor; }; } QML_DECLARE_TYPEINFO(UKUIQQC2Style::UKUISwitch, QML_HAS_ATTACHED_PROPERTIES) #endif // UKUISWITCH_H qt6-ukui-platformtheme/ukui-qml-style-helper/kyquickstyleitem.h0000664000175000017500000002713215154306200024003 0ustar fengfeng/* * 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 . * * Authors: Yan Wang * */ #ifndef KYQUICKSTYLEITEM_H #define KYQUICKSTYLEITEM_H #include "kyquickpadding_p.h" //#include #include #include #include #include #include class QStyle; class QStyleOption; class QQuickTableRowImageProvider1 : public QQuickImageProvider { public: QQuickTableRowImageProvider1() : QQuickImageProvider(QQuickImageProvider::Pixmap) {} QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override; }; class KyQuickStyleItem: public QQuickItem { Q_OBJECT Q_PROPERTY(KyQuickPadding* border READ border CONSTANT) Q_PROPERTY( bool sunken READ sunken WRITE setSunken NOTIFY sunkenChanged) Q_PROPERTY( bool raised READ raised WRITE setRaised NOTIFY raisedChanged) Q_PROPERTY( bool active READ active WRITE setActive NOTIFY activeChanged) Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectedChanged) Q_PROPERTY( bool hasFocus READ hasFocus WRITE sethasFocus NOTIFY hasFocusChanged) Q_PROPERTY( bool on READ on WRITE setOn NOTIFY onChanged) Q_PROPERTY( bool hover READ hover WRITE setHover NOTIFY hoverChanged) Q_PROPERTY( bool horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged) Q_PROPERTY( bool isTransient READ isTransient WRITE setTransient NOTIFY transientChanged) Q_PROPERTY( QString elementType READ elementType WRITE setElementType NOTIFY elementTypeChanged) Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY( QString activeControl READ activeControl WRITE setActiveControl NOTIFY activeControlChanged) Q_PROPERTY( QString styleName READ styleName NOTIFY styleNameChanged) Q_PROPERTY( QVariantMap hints READ hints WRITE setHints NOTIFY hintChanged RESET resetHints) Q_PROPERTY( QVariantMap properties READ properties WRITE setProperties NOTIFY propertiesChanged) Q_PROPERTY( QFont font READ font NOTIFY fontChanged) // For range controls Q_PROPERTY( int minimum READ minimum WRITE setMinimum NOTIFY minimumChanged) Q_PROPERTY( int maximum READ maximum WRITE setMaximum NOTIFY maximumChanged) Q_PROPERTY( int value READ value WRITE setValue NOTIFY valueChanged) Q_PROPERTY( int step READ step WRITE setStep NOTIFY stepChanged) Q_PROPERTY( int paintMargins READ paintMargins WRITE setPaintMargins NOTIFY paintMarginsChanged) Q_PROPERTY( int contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged) Q_PROPERTY( int contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged) Q_PROPERTY( int textureWidth READ textureWidth WRITE setTextureWidth NOTIFY textureWidthChanged) Q_PROPERTY( int textureHeight READ textureHeight WRITE setTextureHeight NOTIFY textureHeightChanged) Q_PROPERTY( int leftPadding READ leftPadding NOTIFY leftPaddingChanged) Q_PROPERTY( int topPadding READ topPadding NOTIFY topPaddingChanged) Q_PROPERTY( int rightPadding READ rightPadding NOTIFY rightPaddingChanged) Q_PROPERTY( int bottomPadding READ bottomPadding NOTIFY bottomPaddingChanged) Q_PROPERTY( QString buttonType READ buttonType WRITE setbuttonType NOTIFY buttonTypeChanged) Q_PROPERTY( QString roundButton READ roundButton WRITE setroundButton NOTIFY roundButtonChanged) Q_PROPERTY( QQuickItem *control READ control WRITE setControl NOTIFY controlChanged) KyQuickPadding* border() { return &m_border; } public: KyQuickStyleItem(QQuickItem *parent = nullptr); ~KyQuickStyleItem() override; enum MenuItemType { SeparatorType = 0, ItemType, MenuType, ScrollIndicatorType }; enum Type { Undefined, Button, RadioButton, CheckBox, ComboBox, ComboBoxItem, Dial, ToolBar, ToolButton, Tab, TabFrame, Frame, FocusFrame, FocusRect, SpinBox, Slider, ScrollBar, ProgressBar, Edit, GroupBox, Header, Item, ItemRow, ItemBranchIndicator, Splitter, Menu, MenuItem, Widget, StatusBar, ScrollAreaCorner, MacHelpButton, MenuBar, MenuBarItem }; void paint(QPainter *); bool sunken() const { return m_sunken; } bool raised() const { return m_raised; } bool active() const { return m_active; } bool selected() const { return m_selected; } bool hasFocus() const { return m_focus; } bool on() const { return m_on; } bool hover() const { return m_hover; } bool horizontal() const { return m_horizontal; } bool isTransient() const { return m_transient; } int minimum() const { return m_minimum; } int maximum() const { return m_maximum; } int step() const { return m_step; } int value() const { return m_value; } int paintMargins() const { return m_paintMargins; } QString elementType() const { return m_type; } QString text() const { return m_text; } QString activeControl() const { return m_activeControl; } QVariantMap hints() const { return m_hints; } QVariantMap properties() const { return m_properties; } QFont font() const { return m_font;} QString styleName() const; void setSunken(bool sunken) { if (m_sunken != sunken) {m_sunken = sunken; emit sunkenChanged();}} void setRaised(bool raised) { if (m_raised!= raised) {m_raised = raised; emit raisedChanged();}} void setActive(bool active) { if (m_active!= active) {m_active = active; emit activeChanged();}} void setSelected(bool selected) { if (m_selected!= selected) {m_selected = selected; emit selectedChanged();}} void sethasFocus(bool focus) { if (m_focus != focus) {m_focus = focus; emit hasFocusChanged();}} void setOn(bool on) { if (m_on != on) {m_on = on ; emit onChanged();}} void setHover(bool hover) { if (m_hover != hover) {m_hover = hover ; emit hoverChanged();}} void setHorizontal(bool horizontal) { if (m_horizontal != horizontal) {m_horizontal = horizontal; emit horizontalChanged();}} void setTransient(bool transient) { if (m_transient != transient) {m_transient = transient; emit transientChanged();}} void setMinimum(int minimum) { if (m_minimum!= minimum) {m_minimum = minimum; emit minimumChanged();}} void setMaximum(int maximum) { if (m_maximum != maximum) {m_maximum = maximum; emit maximumChanged();}} void setValue(int value) { if (m_value!= value) {m_value = value; emit valueChanged();}} void setStep(int step) { if (m_step != step) { m_step = step; emit stepChanged(); }} void setPaintMargins(int value) { if (m_paintMargins!= value) {m_paintMargins = value; emit paintMarginsChanged(); } } void setElementType(const QString &str); void setText(const QString &str) { if (m_text != str) {m_text = str; emit textChanged();}} void setActiveControl(const QString &str) { if (m_activeControl != str) {m_activeControl = str; emit activeControlChanged();}} void setHints(const QVariantMap &str); void setProperties(const QVariantMap &props) { if (m_properties != props) { m_properties = props; emit propertiesChanged(); } } void resetHints(); int contentWidth() const { return m_contentWidth; } void setContentWidth(int arg); int contentHeight() const { return m_contentHeight; } void setContentHeight(int arg); virtual void initStyleOption (); void resolvePalette(); int leftPadding() const; int topPadding() const; int rightPadding() const; int bottomPadding() const; Q_INVOKABLE qreal textWidth(const QString &); Q_INVOKABLE qreal textHeight(const QString &); int textureWidth() const { return m_textureWidth; } void setTextureWidth(int w); int textureHeight() const { return m_textureHeight; } void setTextureHeight(int h); QQuickItem *control() const; void setControl(QQuickItem *control); static QStyle *style(); QString buttonType() const { return m_buttonType;} void setbuttonType(QString buttonType) { m_buttonType = buttonType ; emit buttonTypeChanged(); } QString roundButton() const { return m_roundButton;} void setroundButton(QString roundButton) { m_roundButton = roundButton ; emit roundButtonChanged(); } public Q_SLOTS: int pixelMetric(const QString&); QVariant styleHint(const QString&); void updateSizeHint(); void updateRect(); void updateBaselineOffset(); void updateItem(){polish();} QString hitTest(int x, int y); QRectF subControlRect(const QString &subcontrolString); QString elidedText(const QString &text, int elideMode, int width); bool hasThemeIcon(const QString &) const; Q_SIGNALS: void elementTypeChanged(); void textChanged(); void sunkenChanged(); void raisedChanged(); void activeChanged(); void selectedChanged(); void hasFocusChanged(); void onChanged(); void hoverChanged(); void horizontalChanged(); void transientChanged(); void minimumChanged(); void maximumChanged(); void stepChanged(); void valueChanged(); void activeControlChanged(); void infoChanged(); void styleNameChanged(); void paintMarginsChanged(); void hintChanged(); void propertiesChanged(); void fontChanged(); void controlChanged(); void contentWidthChanged(int arg); void contentHeightChanged(int arg); void textureWidthChanged(int w); void textureHeightChanged(int h); void leftPaddingChanged(); void topPaddingChanged(); void rightPaddingChanged(); void bottomPaddingChanged(); void buttonTypeChanged(); void roundButtonChanged(); protected: bool event(QEvent *) override; QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override; void updatePolish() override; bool eventFilter(QObject *watched, QEvent *event) override; private: const char* classNameForItem() const; QSize sizeFromContents(int width, int height); qreal baselineOffset(); void styleChanged(); protected: QStyleOption *m_styleoption; QPointer m_control; QPointer m_window; Type m_itemType; QString m_type; QString m_text; QString m_activeControl; QVariantMap m_hints; QVariantMap m_properties; QFont m_font; bool m_sunken; bool m_raised; bool m_active; bool m_selected; bool m_focus; bool m_hover; bool m_on; bool m_horizontal; bool m_transient; bool m_sharedWidget; int m_minimum; int m_maximum; int m_value; int m_step; int m_paintMargins; int m_contentWidth; int m_contentHeight; int m_textureWidth; int m_textureHeight; Qt::FocusReason m_lastFocusReason; QImage m_image; KyQuickPadding m_border; static QStyle *s_style; QString m_buttonType; QString m_roundButton; }; #endif // KYQUICKSTYLEITEM_H qt6-ukui-platformtheme/ukui-qml-style-helper/kystylehelper.h0000664000175000017500000001202615154306200023263 0ustar fengfeng/* * 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 . * * Authors: Yan Wang * */ #ifndef KYSTYLEHELPER_H #define KYSTYLEHELPER_H #include #include #include #include class KyStyleHelper : public QQuickItem { Q_OBJECT Q_DISABLE_COPY(KyStyleHelper) Q_PROPERTY(QPalette palette READ palette NOTIFY paletteChanged) Q_PROPERTY(QFont font READ font NOTIFY fontChanged) Q_PROPERTY(QColor windowtextcolorrole READ windowtextcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor buttoncolorrole READ buttoncolor NOTIFY qcolorChanged) Q_PROPERTY(QColor lightcolorrole READ lightcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor midlightcolorrole READ midlightcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor darkcolorrole READ darkcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor midcolorrole READ midcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor textcolorrole READ textcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor brighttextcolorrole READ brighttextcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor buttontextcolorrole READ buttontextcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor basecolorrole READ basecolor NOTIFY qcolorChanged) Q_PROPERTY(QColor windowcolorrole READ windowcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor shadowcolorrole READ shadowcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor highlightcolorrole READ highlightcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor highlightedtextcolorrole READ highlightedtextcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor linkcolorrole READ linkcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor linkvisitedcolorrole READ linkvisitedcolor NOTIFY qcolorChanged) Q_PROPERTY(QColor alternatebasecolorrole READ alternatebasecolor NOTIFY qcolorChanged) Q_PROPERTY(QColor tooltipbasecolorrole READ tooltipbasecolor NOTIFY qcolorChanged) Q_PROPERTY(QColor tooltiptextcolorrole READ tooltiptextcolor NOTIFY qcolorChanged) Q_PROPERTY( QString buttonType READ buttonType WRITE setbuttonType NOTIFY buttonTypeChanged) public: explicit KyStyleHelper(QQuickItem *parent = nullptr); ~KyStyleHelper() override; static KyStyleHelper* qmlAttachedProperties(QObject* parent); QString buttonType() const { return m_buttonType;} void setbuttonType(QString buttonType) { m_buttonType = buttonType ; emit buttonTypeChanged(); } /* Get palette */ QPalette palette() { return qApp->palette(); } /* Get font */ QFont font() { return qApp->font(); } /* Get different type of color */ QColor windowtextcolor() { return qApp->palette().windowText().color(); } QColor buttoncolor() { return qApp->palette().button().color(); } QColor lightcolor() { return qApp->palette().light().color(); } QColor midlightcolor() { return qApp->palette().midlight().color(); } QColor darkcolor() { return qApp->palette().dark().color(); } QColor midcolor() { return qApp->palette().mid().color(); } QColor textcolor() { return qApp->palette().text().color(); } QColor brighttextcolor() { return qApp->palette().brightText().color(); } QColor buttontextcolor() { return qApp->palette().buttonText().color(); } QColor basecolor() { return qApp->palette().base().color(); } QColor windowcolor() { return qApp->palette().window().color(); } QColor shadowcolor() { return qApp->palette().shadow().color(); } QColor highlightcolor() { return qApp->palette().highlight().color(); } QColor highlightedtextcolor() { return qApp->palette().highlightedText().color(); } QColor linkcolor() { return qApp->palette().link().color(); } QColor linkvisitedcolor() { return qApp->palette().linkVisited().color(); } QColor alternatebasecolor() { return qApp->palette().alternateBase().color(); } QColor tooltipbasecolor() { return qApp->palette().toolTipBase().color(); } QColor tooltiptextcolor() { return qApp->palette().toolTipText().color(); } signals: void paletteChanged(); void fontChanged(); void qcolorChanged(); void buttonTypeChanged(); protected: QString m_buttonType; }; QML_DECLARE_TYPEINFO(KyStyleHelper, QML_HAS_ATTACHED_PROPERTIES) #endif // KYSTYLEHELPER_H qt6-ukui-platformtheme/ukui-qml-style-helper/kyquickpadding_p.h0000664000175000017500000000406115154306200023705 0ustar fengfeng/* * 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 . * * Authors: Yan Wang * */ #ifndef KYQUICKPADDING_P_H #define KYQUICKPADDING_P_H #include class KyQuickPadding : public QObject { Q_OBJECT Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged) Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged) Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightChanged) Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomChanged) int m_left; int m_top; int m_right; int m_bottom; public: KyQuickPadding(QObject *parent = nullptr) : QObject(parent), m_left(0), m_top(0), m_right(0), m_bottom(0) {} int left() const { return m_left; } int top() const { return m_top; } int right() const { return m_right; } int bottom() const { return m_bottom; } public Q_SLOTS: void setLeft(int arg) { if (m_left != arg) {m_left = arg; emit leftChanged();}} void setTop(int arg) { if (m_top != arg) {m_top = arg; emit topChanged();}} void setRight(int arg) { if (m_right != arg) {m_right = arg; emit rightChanged();}} void setBottom(int arg) {if (m_bottom != arg) {m_bottom = arg; emit bottomChanged();}} Q_SIGNALS: void leftChanged(); void topChanged(); void rightChanged(); void bottomChanged(); }; #endif // KYQUICKPADDING_P_H qt6-ukui-platformtheme/ukui-qml-style-helper/KyIcon.cpp0000664000175000017500000001010615154306200022103 0ustar fengfeng/* * 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 . * * Authors: Yan Wang * */ #include "KyIcon.h" #include #include #include #include #include "effects/highlight-effect.h" #include QStyle *KyIcon::style() { return qApp->style(); } KyIcon::KyIcon(QQuickPaintedItem *parent) : QQuickPaintedItem(parent), m_hover(false), m_selected(false), m_focus(false), m_active(true), m_sunken(false), m_on(false), m_icontype("default") { if (QGSettings::isSchemaInstalled("org.ukui.style")) { QGSettings* styleSettings = new QGSettings("org.ukui.style", QByteArray(), this); connect(styleSettings, &QGSettings::changed, this, [&](){ emit hoverChanged(); emit selectedChanged(); emit hasFocusChanged(); emit activeChanged(); emit sunkenChanged(); emit onChanged(); emit icontypeChanged(); emit iconNameChanged(); update(); }); } connect(this, &KyIcon::iconNameChanged, this, &KyIcon::updateItem); connect(this, &KyIcon::hoverChanged, this, &KyIcon::updateItem); connect(this, &KyIcon::selectedChanged, this, &KyIcon::updateItem); connect(this, &KyIcon::hasFocusChanged, this, &KyIcon::updateItem); connect(this, &KyIcon::activeChanged, this, &KyIcon::updateItem); connect(this, &KyIcon::sunkenChanged, this, &KyIcon::updateItem); connect(this, &KyIcon::onChanged, this, &KyIcon::updateItem); connect(this, &KyIcon::icontypeChanged, this, &KyIcon::updateItem); } void KyIcon::setIcon(const QIcon &icon) { m_icon = icon; } void KyIcon::setIconName(const QString &iconName) { m_iconName = iconName; if(!QIcon::hasThemeIcon(m_iconName)) { m_icon = m_iconHelper.loadIcon(iconName); qWarning() << "未找到名为 " << m_iconName << " 的图标!"; return; } m_icon = QIcon::fromTheme(m_iconName); emit iconNameChanged(); } void KyIcon::paint(QPainter *painter) { if(m_icon.isNull()) return; QWidget wid; QStyleOption opt; opt.state = {}; if (isEnabled()) { opt.state |= QStyle::State_Enabled; } if (m_hover) opt.state |= QStyle::State_MouseOver; if (m_selected) opt.state |= QStyle::State_Selected; if (m_focus) opt.state |= QStyle::State_HasFocus; if (m_active) opt.state |= QStyle::State_Active; if (m_sunken) opt.state |= QStyle::State_Sunken; if (m_on) opt.state |= QStyle::State_On; QPixmap pixmap = m_icon.pixmap(QSize(width(), height())); if (m_icontype == "ordinary") { pixmap = HighLightEffect::ordinaryGeneratePixmap(pixmap, &opt, &wid); /* 主题切换做处理*/ } if (m_icontype == "hover") { pixmap = HighLightEffect::hoverGeneratePixmap(pixmap, &opt, &wid); /* 选中点击做处理*/ } if (m_icontype == "filledSymbolicColor") { pixmap = HighLightEffect::filledSymbolicColoredGeneratePixmap(pixmap, &opt, &wid); /* 非纯色图标主题切换且选中点击做处理*/ } else if (m_icontype == "default") { pixmap = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, &opt, &wid); /* 主题切换且选中点击做处理*/ } KyIcon::style()->drawItemPixmap(painter, boundingRect().toRect(), Qt::AlignCenter,pixmap); } qt6-ukui-platformtheme/ukui-qqc2-style/0000775000175000017500000000000015154306201017006 5ustar fengfengqt6-ukui-platformtheme/ukui-qqc2-style/README.md0000664000175000017500000000114515154306200020265 0ustar fengfeng# kylin-qqc2-style kylin qquick control 2 ## Description kylin-qqc2-style 是参考 qqc2-desktop-style 实现的一个 qml 主题,主要包括以下几部分: > 1. org.kylin.style: 提供 qml style org.kylin.style,可以通过 QQuickStyle::setStyle 或其他方式设置 qml 应用使用次样式 > 2. qqc2-style-plugin: 提供一个自定义的 QQuickItem 供 org.kylin.style 使用 ## Depends qtbase qquick kirigami2-dev KIconLoader KColorScheme KSharedConfig KConfigGroup ## build & install mkdir build cd build qmake .. make sudo make install qt6-ukui-platformtheme/ukui-qqc2-style/CMakeLists.txt0000664000175000017500000000241015154306200021542 0ustar fengfengcmake_minimum_required(VERSION 3.16) project(ukui-qqc2-style) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 CONFIG REQUIRED COMPONENTS Gui ) file(GLOB QML_UKUIFILES "org.ukui.style/*.qml" "org.ukui.style/qmldir") file(GLOB PRIVATE_FILES "org.ukui.style/private/*") file(GLOB_RECURSE OTHER_FILES qml.qrc) SOURCE_GROUP("QMLFiles" FILES ${QML_UKUIFILES}) 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}) message("cmake_install_libdir..." , ${CMAKE_INSTALL_LIBDIR}) if(UNIX) # file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/org.ukui.style/*.qml) message("CMAKE_LIBRARY_ARCHITECTURE123....." "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/qt6/qml/QtQuick/Controls/org.ukui.style/") set(TARGET_PATH "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/qt6/qml/QtQuick/Controls/org.ukui.style/") message("qqc2 targetpath", ${TARGET_PATH}) set(TARGET_UKUIFILES ${QML_UKUIFILES}) install(FILES ${TARGET_UKUIFILES} DESTINATION ${TARGET_PATH}) install(FILES ${PRIVATE_FILES} DESTINATION "${TARGET_PATH}/private") endif() qt6-ukui-platformtheme/ukui-qqc2-style/qml.qrc0000664000175000017500000000446515154306201020317 0ustar fengfeng org.ukui.style/Menu.qml org.ukui.style/Slider.qml org.ukui.style/ApplicationWindow.qml org.ukui.style/MenuItem.qml org.ukui.style/ComboBox.qml org.ukui.style/TabBar.qml org.ukui.style/CheckBox.qml org.ukui.style/ItemDelegate.qml org.ukui.style/ScrollBar.qml org.ukui.style/Popup.qml org.ukui.style/TabButton.qml org.ukui.style/TextField.qml org.ukui.style/Button.qml org.ukui.style/ProgressBar.qml org.ukui.style/RadioButton.qml org.ukui.style/Label.qml org.ukui.style/SpinBox.qml org.ukui.style/ToolButton.qml org.ukui.style/RoundButton.qml org.ukui.style/ToolTip.qml org.ukui.style/ScrollView.qml org.ukui.style/CheckDelegate.qml org.ukui.style/RadioDelegate.qml org.ukui.style/Switch.qml org.ukui.style/SwitchDelegate.qml org.ukui.style/TextArea.qml org.ukui.style/VerticalHeaderView.qml org.ukui.style/HorizontalHeaderView.qml org.ukui.style/Pane.qml org.ukui.style/private/RadiusRectangle.qml org.ukui.style/private/ParseInterface.qml org.ukui.style/private/NormalControlColor.qml org.ukui.style/private/MobileTextActionsToolBar.qml org.ukui.style/private/MobileCursor.qml org.ukui.style/private/IconLabelContent.qml org.ukui.style/private/FocusRect.qml org.ukui.style/private/DefaultListItemBackground.qml org.ukui.style/private/ButtonIconLabelContent.qml org.ukui.style/private/BackGroundRectangle.qml org.ukui.style/BusyIndicator.qml org.ukui.style/private/NormalBack.qml org.ukui.style/private/WindowBack.qml qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/0000775000175000017500000000000015160516153021716 5ustar fengfengqt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/RadioDelegate.qml0000664000175000017500000003210315154306200025112 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块(该模块在Qt6中被彻底移除) // import QtQuick.Controls.impl 2.12 (已删除) import QtQuick.Templates 6.2 as T // 替代原2.12 import org.ukui.qqc2style.private 1.0 as StylePrivate T.RadioDelegate { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + implicitIndicatorWidth + spacing + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding, implicitIndicatorHeight + topPadding + bottomPadding) hoverEnabled: true font: app.font palette: app.palette property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property alias indicatorColor: indicatorRec.color property alias childrenColor: childrenRec.color property bool isHoveredExpanded: false //记录小圆是否处于 “hover 放大到 8px” 的状态 property var tansparentNormalColor: radiobutton.normalTransparentIndicatorColor property var normalColor: radiobutton.normalIndicatorColor property var borderColor: control.checked ? (!control.enabled ? radiobutton.checked_disableIndicatorBorderColor : control.pressed ? radiobutton.checked_clickIndicatorBorderColor : control.hovered ? radiobutton.checked_hoverIndicatorBorderColor : radiobutton.checked_normalIndicatorBorderColor) : (!control.enabled ? radiobutton.disableIndicatorBorderColor : control.pressed ? radiobutton.clickIndicatorBorderColor : control.hovered ? radiobutton.hoverIndicatorBorderColor : radiobutton.normalIndicatorBorderColor) property var backColor: control.checked ? (!control.enabled ? radiobutton.checked_disableIndicatorColor : control.pressed ? radiobutton.checked_clickIndicatorColor : control.hovered ? radiobutton.checked_hoverIndicatorColor : radiobutton.checked_normalIndicatorColor) : isTransaprent ? (!control.enabled ? radiobutton.disableTransparentIndicatorColor : control.pressed ? radiobutton.clickTransparentIndicatorColor : control.hovered ? radiobutton.hoverTransparentIndicatorColor : tansparentNormalColor) : (!control.enabled ? radiobutton.disableIndicatorColor : control.pressed ? radiobutton.clickIndicatorColor : control.hovered ? radiobutton.hoverIndicatorColor : normalColor) property var childrenDtColor: !control.enabled ? radiobutton.checked_disableChildrenColor : control.pressed ? radiobutton.checked_clickChildrenColor: control.hovered ? radiobutton.checked_hoverChildrenColor: radiobutton.checked_normalChildrenColor ParseInterface{ id: parseInterface } StylePrivate.UKUIRadioButton{ id: radiobutton } StylePrivate.APPParameter{ id: app } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } padding: 6 spacing: radiobutton.space contentItem: IconLabelContent { id: iconLabel controlRoot: control anchors.left: control.left anchors.right: control.right anchors.leftMargin: control.mirrored ? control.indicator.width + control.spacing : control.leftPadding anchors.rightMargin: !control.mirrored ? control.indicator.width + control.spacing : control.rightPadding //leftSpace: control.mirrored ? control.indicator.width + control.spacing : control.leftPadding //x: control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 //anchors.centerIn: control implicitWidth: iconLabel.adjustWidth(control.leftPadding + control.rightPadding) } // keep in sync with RadioButton.qml (shared RadioIndicator.qml was removed for performance reasons) indicator: Rectangle { id: indicatorRec implicitWidth: radiobutton.indicatorWidth implicitHeight: implicitWidth x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 radius: width / 2 color: gradientRec.visible ? "transparent" : getStartColor(backColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(backColor) } GradientStop { position: 1.0; color: getEndColor(backColor)} } visible: !parseInterface.isSolidPattern(backColor) } Rectangle{ anchors.fill: parent radius: width / 2 border.width: radiobutton.borderWidth border.color: getStartColor((app.focusEnable && control.visualFocus) ? (control.checked ? borderColor : radiobutton.checked_normalIndicatorColor) : borderColor) color: "transparent" } Rectangle { id:childrenRec // width: control.hovered ? 8 : radiobutton.childrenWidth width: 8 height: width // anchors.centerIn: parent anchors.horizontalCenter: parent.horizontalCenter // 水平居中 anchors.verticalCenter: parent.verticalCenter // 垂直居中 radius: width / 2 color: gradientChildrenRec.visible ? "transparent" : getStartColor(childrenDtColor) visible: control.checked Rectangle{ id: gradientChildrenRec anchors.fill: parent radius: parent.radius border.width: parent.border.width border.color: parent.border.color gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(childrenDtColor) } GradientStop { position: 1.0; color: getEndColor(childrenDtColor)} } visible: !parseInterface.isSolidPattern(childrenDtColor) } } NumberAnimation { id: scaleAnim target: childrenRec property: "scale" from: 0.0 to: radiobutton.childrenWidth / 8 // 关键:计算基准大小对应的缩放比例 duration: 200 easing.type: Easing.InOutQuint } NumberAnimation { id: uncheckScaleAnim target: childrenRec property: "scale" from: radiobutton.childrenWidth / 8 // 从基准大小开始 to: 0.0 duration: 150 easing.type: Easing.InOutQuint onRunningChanged: { if (!running && !control.checked) { childrenRec.visible = false; control.isHoveredExpanded = false; // 重置状态 } } } ColorAnimation { id: transparentColorAnim target: control property: "tansparentNormalColor" from: radiobutton.checked_normalIndicatorColor to: radiobutton.normalTransparentIndicatorColor duration: 150 easing.type: Easing.InOutQuint running: false } ColorAnimation { id: colorAnim target: control property: "normalColor" from: radiobutton.checked_normalIndicatorColor to: radiobutton.normalIndicatorColor duration: 150 easing.type: Easing.InOutQuint running: false } NumberAnimation { id: hoverScaleAnim target: childrenRec property: "scale" duration: 100 easing.type: Easing.InOutQuint } } onHoveredChanged: { if (!control.enabled || !control.checked) { return; } const baseScale = radiobutton.childrenWidth / 8; const targetScale = 1.0; hoverScaleAnim.stop(); if (hovered) { // 鼠标移入:从基准大小放大到8px if (childrenRec.scale === baseScale) { // 仅当当前是基准大小时才放大 hoverScaleAnim.from = baseScale; hoverScaleAnim.to = targetScale; hoverScaleAnim.start(); control.isHoveredExpanded = true; // 标记为“已放大到8px” } } else { if (control.isHoveredExpanded) { hoverScaleAnim.from = targetScale; hoverScaleAnim.to = baseScale; hoverScaleAnim.start(); control.isHoveredExpanded = false; } } } function handleChildrenScale() { if (!control.enabled || !control.checked) { return; } const baseScale = radiobutton.childrenWidth / 8; const expandedScale = 1.0; hoverScaleAnim.stop(); // 新增:按下状态处理 if (control.pressed) { // 按下时立即缩小到基准大小 if (childrenRec.scale !== baseScale) { hoverScaleAnim.from = childrenRec.scale; hoverScaleAnim.to = baseScale; hoverScaleAnim.start(); control.isHoveredExpanded = false; } } else if (control.hovered) { // 松开后恢复为8px if (childrenRec.scale === baseScale) { hoverScaleAnim.from = baseScale; hoverScaleAnim.to = expandedScale; hoverScaleAnim.start(); control.isHoveredExpanded = true; } } else { // 非hover状态处理 if (control.isHoveredExpanded) { hoverScaleAnim.from = expandedScale; hoverScaleAnim.to = baseScale; hoverScaleAnim.start(); control.isHoveredExpanded = false; } } } // 新增:处理按下和松开事件 onPressedChanged: { // 按下时强制更新小圆圈大小 if (control.pressed && control.hovered && control.checked && control.enabled) { handleChildrenScale(); } // 松开时恢复 else if (!control.pressed && control.hovered && control.checked && control.enabled) { handleChildrenScale(); } } onCheckedChanged: { if (checked) { childrenRec.scale = 0.0; childrenRec.visible = true; scaleAnim.start(); control.isHoveredExpanded = false; } else { uncheckScaleAnim.start(); if(isTransaprent) transparentColorAnim.start() else colorAnim.start(); control.isHoveredExpanded = false; } } background: Item { anchors.fill: parent // visible: control.down || control.highlighted // color: control.down ? control.palette.midlight : control.palette.light } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/VerticalHeaderView.qml0000664000175000017500000000510015154306200026133 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.15 import QtQuick.Controls 6.2 // 替代原2.15 import QtQuick.Templates 6.2 as T // 替代原2.15 import org.ukui.qqc2style.private 1.0 as StylePrivate T.VerticalHeaderView { id: control implicitWidth: contentWidth implicitHeight: syncView ? syncView.height : 0 delegate: Item { // Qt6: add cellPadding (and font etc) as public API in headerview readonly property real cellPadding: 8 implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2)) implicitHeight: text.implicitHeight + (cellPadding * 2) Text { id: text text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData width: parent.width height: parent.height horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: getStartColor(headerview.normalTextColor) wrapMode: Text.Wrap } Rectangle{ anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right height: headerview.lineWidth color: headerview.lineColor } } StylePrivate.APPParameter{ id: appP } StylePrivate.UKUIHeaderView{ id: headerview } ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/MenuItem.qml0000664000175000017500000004060415154306200024151 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改:统一升级所有Qt模块为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.6 import QtQuick.Layouts 6.2 // 替代原1.2(Qt6中Layouts模块版本同步6.x) import QtQuick.Templates 6.2 as T // 替代原2.5 import org.ukui.qqc2style.private 1.0 as StylePrivate import QtQuick.Controls 6.2 // 替代原2.5 T.MenuItem { id: controlRoot palette: app.palette font: app.font implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, image.sourceSize.width + label.implicitWidth + labelLeftSpace + leftPadding + rightPadding + (hasChecked ? /*arrow.implicitWidth*/menuItem.imageWidth + menuItem.imageSpace : 0) + (controlRoot.subMenu != null ? /*indicator.implicitWidth*/menuItem.imageWidth + menuItem.imageSpace : 0) + itemLeftSpace) implicitHeight: visible ? Math.max(implicitBackgroundHeight + topInset + bottomInset, Math.max(implicitContentHeight, (controlRoot.subMenu ? indicator.implicitHeight : 0) + topPadding + bottomPadding), menuItem.normalHeight) : 0 baselineOffset: contentItem.y + contentItem.baselineOffset padding: menuItem.topBottomPadding onCheckedChanged: { // console.log("checked changedddddddd", checked, controlRoot.text) // itemHasChecked = controlRoot.checkable && controlRoot.checked; //itemLeftSpace = (!(itemHasChecked)/* && !controlRoot.subMenu*/) ? controlRoot.leftPadding : menuItem.imageWidth + 4 + controlRoot.leftPadding // console.log("checked changedd aaaaaaaaaaaaa", checked, controlRoot.text, itemHasChecked, itemLeftSpace, menuItem.imageWidth) image.source = contentImageSource(); indicatorImage.source = indicatorImageSource() arrowImage.source = arrowImageSource() controlRoot.update(); controlRoot.update() } property bool itemHasChecked: controlRoot.checkable && controlRoot.checked property bool hasChecked: false property int gridUnit: fontMetrics.height property int labelLeftSpace: image.visible ? 8 : 0 property int itemLeftSpace: (!(itemHasChecked)/* && !controlRoot.subMenu*/) ? controlRoot.leftPadding : menuItem.imageWidth + 8 + controlRoot.leftPadding property var isTransaprent:{ if(controlRoot.hasOwnProperty("transparent")) return controlRoot.transparent else return true } property var isHightModel:{ if(controlRoot.hasOwnProperty("type")){ if(controlRoot.type === "import") return true } return false } property var isKeyBorderSelect: hovered //键盘选中 或者hover property var borderHColor: !controlRoot.enabled ? menuItem.disableCheckedHBorderColor : controlRoot.pressed ? menuItem.clickedCheckedHBorderColor : isKeyBorderSelect ? menuItem.hoveredCheckedHBorderColor : menuItem.normalCheckedHBorderColor property var backHColor: !controlRoot.enabled ? menuItem.disableCheckedHBC : controlRoot.pressed ? menuItem.clickedCheckedHBC : isKeyBorderSelect ? menuItem.hoveredCheckedHBC : menuItem.normalCheckedHBC property var borderColor: !controlRoot.enabled ? (isTransaprent ? menuItem.disableTransparentBorderColor : menuItem.disableBorderColor) : controlRoot.pressed ? (isTransaprent ? menuItem.clickTransparentBorderColor : menuItem.clickBorderColor) : isKeyBorderSelect ? (isTransaprent ? menuItem.hoverTransparentBorderColor : menuItem.hoverBorderColor) : (isTransaprent ? menuItem.normalTransparentBorderColor : menuItem.normalBorderColor) property var backColor: !controlRoot.enabled ? (isTransaprent ? menuItem.disableTransparentBC : menuItem.disableBC) : controlRoot.pressed ? (isTransaprent ? menuItem.clickedTransparentBC : menuItem.clickedBC) : (isKeyBorderSelect || (controlRoot.subMenu && controlRoot.subMenu.visible)) ? (isTransaprent ? menuItem.hoveredTransparentBC : menuItem.hoveredBC) : (isTransaprent ? menuItem.normalTransparentBC : menuItem.normalBC) // property var borderCheckedColor: !controlRoot.enabled ? (isTransaprent ? menuItem.disableCheckedTransparentBorderColor : menuItem.disableBorderCheckedColor) : // controlRoot.pressed ? (isTransaprent ? menuItem.clickedCheckedTransparentBorderColor : menuItem.clickBorderCheckedColor) : // isKeyBorderSelect ? (isTransaprent ? menuItem.hoveredCheckedTransparentBorderColor : menuItem.hoverBorderCheckedColor) : // (isTransaprent ? menuItem.normalCheckedTransparentBorderColor : menuItem.normalBorderCheckedColor) // property var backCheckedColor: !controlRoot.enabled ? (isTransaprent ? menuItem.disableCheckedTransparentBC : menuItem.disableCheckedBC) : // controlRoot.pressed ? (isTransaprent ? menuItem.clickedCheckedTransparentBC : menuItem.clickedCheckedBC) : // isKeyBorderSelect ? (isTransaprent ? menuItem.hoveredCheckedTransparentBC : menuItem.hoveredCheckedBC) : // (isTransaprent ? menuItem.normalCheckedTransparentBC : menuItem.normalCheckedBC) property var bacDtColor: !controlRoot.enabled ? menuItem.disableBC : controlRoot.pressed ? menuItem.clickedBC : isKeyBorderSelect ? menuItem.hoveredBC : menuItem.normalBC leftPadding: menuItem.leftRightPadding/* : Math.floor(gridUnit/4)*2*/ rightPadding: menuItem.leftRightPadding// Math.floor(gridUnit/4)*2 hoverEnabled: true onItemHasCheckedChanged: { itemLeftSpace = (!(itemHasChecked)/* && !controlRoot.subMenu*/) ? controlRoot.leftPadding : menuItem.imageWidth + 8 + controlRoot.leftPadding } onHasCheckedChanged: { implicitWidth = Math.max(implicitBackgroundWidth + leftInset + rightInset, image.sourceSize.width + label.implicitWidth + labelLeftSpace + leftPadding + rightPadding + (hasChecked ? /*arrow.implicitWidth*/menuItem.imageWidth + menuItem.imageSpace : 0) + (controlRoot.subMenu != null ? /*indicator.implicitWidth*/menuItem.imageWidth + menuItem.imageSpace : 0) + itemLeftSpace) } StylePrivate.APPParameter{ id: appP } NormalControlColor{ id:ncColor } ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } Shortcut { //in case of explicit & the button manages it by itself enabled: !(RegExp(/\&[^\&]/).test(controlRoot.text)) onActivated: { if (controlRoot.checkable) { controlRoot.toggle(); } else { controlRoot.clicked(); } } } contentItem:Item{ // x: itemLeftSpace + controlRoot.leftPadding anchors.left: parent.left anchors.leftMargin: itemLeftSpace anchors.right: parent.right anchors.rightMargin: controlRoot.rightPadding implicitHeight: Math.max(image.height, label.height) Image { id: image source: contentImageSource()//controlRoot.icon.source cache: false anchors.verticalCenter: parent.verticalCenter sourceSize.width: (controlRoot.display !== AbstractButton.TextOnly && source !== "" ) ? menuItem.imageWidth : 0 sourceSize.height: (controlRoot.display !== AbstractButton.TextOnly && source !== "" ) ? menuItem.imageWidth : 0 visible: controlRoot.display !== AbstractButton.TextOnly && source !== "" && status != Image.Null } Text { id:label text: controlRoot.text font:controlRoot.font elide: Text.ElideRight color: getStartColor(controlRoot.enabled ? (isHightModel ? menuItem.normalHTextColor : menuItem.normalTextColor) : (isHightModel ? menuItem.disableHTextColor : menuItem.disableTextColor)) visible: controlRoot.display !== AbstractButton.IconOnly && text !== "" anchors.verticalCenter: parent.verticalCenter anchors.left: image.visible ? image.right : parent.left anchors.leftMargin: labelLeftSpace//(image.visible && image.status !== Image.Null) ? 4 : labelLeftSpace anchors.right: parent.right } } indicator: Image { id:indicatorImage anchors.left: controlRoot.mirrored ?controlRoot.right : controlRoot.left anchors.leftMargin: controlRoot.mirrored ? - controlRoot.rightPadding - menuItem.imageWidth : controlRoot.leftPadding anchors.verticalCenter: controlRoot.verticalCenter visible: controlRoot.checked source: indicatorImageSource() sourceSize.width: menuItem.imageWidth sourceSize.height: menuItem.imageWidth cache: false } arrow: Image { id: arrowImage anchors.left: controlRoot.mirrored ?controlRoot.left : controlRoot.right anchors.leftMargin: controlRoot.mirrored ? controlRoot.leftPadding : - controlRoot.rightPadding - menuItem.imageWidth anchors.verticalCenter: parent.verticalCenter sourceSize.width: menuItem.imageWidth sourceSize.height: menuItem.imageWidth visible: controlRoot.subMenu mirror: controlRoot.mirrored source: arrowImageSource() cache: false } background: Rectangle { id: backrect width: controlRoot.width height: controlRoot.height radius: menuItem.radius //opacity: (isHightModel || isKeyBorderSelect || controlRoot.pressed || controlRoot.checked) ? 1 : 0 border.width: menuItem.borderWidth border.color: getStartColor(isHightModel ? borderHColor : borderColor) color: gradientRec.visible ? "transparent" : getStartColor(isHightModel ? backHColor : backColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius border.width: parent.border.width border.color: parent.border.color gradient: Gradient { id:gradient GradientStop { position: 0.0; color: getStartColor(isHightModel ? backHColor : backColor) } GradientStop { position: 1.0; color: getEndColor(isHightModel ? backHColor : backColor)} } visible: !parseInterface.isSolidPattern(isHightModel ? backHColor : backColor) } } onPressedChanged: { stateChange() } onHoveredChanged: { stateChange() } Component.onCompleted: { itemLeftSpace = (!(itemHasChecked)) ? controlRoot.leftPadding : menuItem.imageWidth + 8 + controlRoot.leftPadding stateChange() image.source = contentImageSource(); indicatorImage.source = indicatorImageSource() arrowImage.source = arrowImageSource() } function stateChange() { bacDtColor = !controlRoot.enabled ? menuItem.disableBC : controlRoot.pressed ? menuItem.clickedBC : isKeyBorderSelect ? menuItem.hoveredBC : menuItem.normalBC backrect.border.color = getStartColor(!controlRoot.enabled ? menuItem.disableBorderColor : controlRoot.pressed ? menuItem.clickBorderColor : isKeyBorderSelect ? menuItem.hoverBorderColor : menuItem.normalBorderColor); controlRoot.update() } property variant fontMetrics: TextMetrics { text: "M" function roundedIconSize(size) { if (size < 16) { return size; } else if (size < 22) { return 16; } else if (size < 32) { return 22; } else if (size < 48) { return 32; } else if (size < 64) { return 48; } else { return size; } } } StylePrivate.UKUIMenuItem{ id: menuItem } StylePrivate.APPParameter{ id: app onParametryChanged:{ image.source = contentImageSource(); indicatorImage.source = indicatorImageSource() arrowImage.source = arrowImageSource() controlRoot.update(); } onIconThemeChanged: { image.source = "" image.source = contentImageSource() indicatorImage.source = "" indicatorImage.source = indicatorImageSource() arrowImage.source = "" arrowImage.source = arrowImageSource() } } onEnabledChanged: { image.source = contentImageSource(); indicatorImage.source = indicatorImageSource() arrowImage.source = arrowImageSource() controlRoot.update(); } function contentImageSource() { if((controlRoot.icon.source.toString() === "" && controlRoot.icon.name.toString() === "")) return controlRoot.icon.source //var model = !controlRoot.enabled ? "disenable" : (appP.isDark || isHightModel) ? "highlight" : /*controlRoot.pressed ? "highlight" : isKeyBorderSelect ? "highlight" :*/ "normal" var model = "normal"; if(!controlRoot.enabled){ if(appP.isDark || isHightModel) model = "highDisbale" else model = "disenable" } else if(appP.isDark || isHightModel){ model = "highlight" } let s = controlRoot.icon.source.toString() if(s === "") s = controlRoot.icon.name.toString() return "image://imageProvider/" + s + "/" + model; } function indicatorImageSource(){ // return "image://imageProvider/file:///usr/share/icons/ukui-icon-theme-default/scalable/actions/object-select-symbolic.svg/normal" var model = "normal" if(!controlRoot.enabled){ if(appP.isDark || isHightModel) model = "highDisbale" else model = "disenable" } else if(appP.isDark || isHightModel){ model = "highlight" } var icon = "object-select-symbolic"; if(controlRoot.checkable){ if(!app.themeHasIcon(icon)) icon = "file:///usr/share/icons/ukui-icon-theme-default/scalable/actions/object-select-symbolic.svg" return "image://imageProvider/" + icon + "/" + model } else return "" } function arrowImageSource(){ var model = "normal" if(!controlRoot.enabled){ if(appP.isDark || isHightModel) model = "highDisbale" else model = "disenable" } else if(appP.isDark || isHightModel){ model = "highlight" } var icon = "ukui-end-symbolic"; if(!app.themeHasIcon(icon)) icon = "file:///usr/share/icons/ukui-icon-theme-default/scalable/actions/ukui-end-symbolic.svg" return "image://imageProvider/" + icon + "/" + model } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/Pane.qml0000664000175000017500000000454615154306200023316 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块(该模块在Qt6中被彻底移除,且当前代码未使用其内容) // import QtQuick.Controls.impl 2.12 (已删除) import QtQuick.Templates 6.2 as T // 替代原2.12 import org.ukui.qqc2style.private 1.0 as StylePrivate T.Pane { id: control property var dColor:{ if(control.hasOwnProperty("dtColor")) return control.dtColor else return "" } onDColorChanged: { if(dColor !== "") rec.color = parseInterface.getDTColor(dColor) } implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, contentHeight + topPadding + bottomPadding) palette: appP.palette StylePrivate.APPParameter{ id: appP onParametryChanged: { if(control.hasOwnProperty("dtColor")) rec.color = parseInterface.getDTColor(dtColor) } } ParseInterface{ id: parseInterface } padding: 12 background: Rectangle { id: rec color: { if(dColor !== ""){ return parseInterface.getDTColor(dColor) } else return appP.palette.window } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/ProgressBar.qml0000664000175000017500000002312415160516153024664 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:统一升级所有Qt模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.12 import QtQuick.Templates 6.2 as T // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块(该模块在Qt6中被彻底移除) // import QtQuick.Controls.impl 2.12 (已删除) import org.ukui.qqc2style.private 1.0 as StylePrivate import Qt5Compat.GraphicalEffects 1.0 T.ProgressBar { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding) palette: app.palette ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property var isShowNormalProgressBarAnim:{ if(control.hasOwnProperty("showNormalProgressBarAnim")) return control.showNormalSliderAnim else return false } property real animationSpeed: 160 // 统一速度值(像素/秒) property real sliderWidth: 56 // 保持滑块宽度不变 // 用于普通模式动画的属性 property real animationX: -sliderWidth // 计算进度百分比的辅助属性 property real progressPercent: Math.min(Math.max(0, (control.value - control.from) / (control.to - control.from) * 100), 100) background: Rectangle { radius: progressbar.radius implicitWidth: progressbar.normalWidth implicitHeight: control.indeterminate ? 8 : progressbar.normalHeight height: control.indeterminate ? 8 : progressbar.normalHeight color: gradientRec.visible ? "transparent" : getStartColor(isTransaprent ? progressbar.normalTransparentColor : progressbar.normalColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(isTransaprent ? progressbar.normalTransparentColor : progressbar.normalColor)} GradientStop { position: 1.0; color: getEndColor(isTransaprent ? progressbar.normalTransparentColor : progressbar.normalColor)} } visible: !parseInterface.isSolidPattern(isTransaprent ? progressbar.normalTransparentColor : progressbar.normalColor) } Rectangle{ anchors.fill: parent radius: parent.radius color: "transparent" border.width: progressbar.borderWidth border.color: getStartColor(isTransaprent ? progressbar.transparentborderColor : progressbar.borderColor) } } contentItem: Item{ implicitHeight: background.height implicitWidth: background.width Item { id: staticProgress x: !control.mirrored ? 0 : (control.width * (1.0 - control.position)) width: control.width * control.position height: parent.height visible: !control.indeterminate // 启用图层效果实现圆角剪裁 layer.enabled: true layer.effect: OpacityMask { maskSource: Rectangle { width: staticProgress.width height: staticProgress.height radius: progressbar.radius } } Rectangle { anchors.fill: parent color: gradientItem.visible ? "transparent" : getStartColor(progressbar.childrenColor) radius: progressbar.radius Rectangle{ id: gradientItem anchors.fill: parent radius: parent.radius border.width: progressbar.borderWidth border.color: getStartColor(progressbar.childrenColor) gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(progressbar.childrenColor) } GradientStop { position: 1.0; color: getEndColor(progressbar.childrenColor)} } visible: !parseInterface.isSolidPattern(progressbar.childrenColor) } } // 普通模式下滑块效果 Rectangle { id: normalAnimationRec x: animationX width: sliderWidth height: parent.height visible: isShowNormalProgressBarAnim && !control.indeterminate && control.value > control.from color: "transparent" radius: progressbar.radius // 渐变滑块效果 Rectangle { anchors.centerIn: parent width: parent.width height: parent.height radius: parent.radius gradient: Gradient { orientation: Gradient.Horizontal GradientStop { position: 0.02; color: "transparent" } GradientStop { position: 0.4; color: Qt.rgba(1, 1, 1, 0.35) } GradientStop { position: 0.6; color: Qt.rgba(1, 1, 1, 0.35) } GradientStop { position: 0.98; color: "transparent" } } } } } Text{ visible: !control.indeterminate anchors.centerIn: parent text: (control.position * 100).toString() + "%" font: app.font color: control.value > (control.from + (control.to - control.from) * 1.0 / 2.0 ) ? getStartColor(progressbar.hightlightTextColor) : getStartColor(StylePrivate.UKUILabel.normalColor) } // 不确定状态的滑块 Rectangle { id:rec implicitHeight: parent.height implicitWidth: control.width * progressbar.indeterminateChildrenWidth / progressbar.normalWidth visible: false radius: height/2 LinearGradient { anchors.fill: parent start: Qt.point(0, 0) end: Qt.point(width, 0) gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(progressbar.indeterminateColor) } GradientStop { position: 1.0; color: getEndColor(progressbar.indeterminateColor)} } } } // 圆角矩形作为遮罩 Rectangle { id: mask anchors.fill: rec radius: rec.radius color: "white" visible: false } OpacityMask { anchors.centerIn: parent anchors.fill: rec source: rec maskSource: mask visible: control.indeterminate } // 不确定状态的动画 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 } // 普通模式的动画 - 固定大小滑块从左到右滑动 SequentialAnimation { id: normalAnimation running: !control.indeterminate && control.value > control.from loops: Animation.Infinite PropertyAnimation { target: control property: "animationX" from: -sliderWidth to: control.width * (progressPercent / 100) duration: Math.abs(control.width * (progressPercent / 100) - (-sliderWidth)) * 1000 / animationSpeed easing.type: Easing.Linear } PauseAnimation { duration: 300 } // 直接跳回起点 PropertyAction { target: control property: "animationX" value: -sliderWidth } } } StylePrivate.UKUIProgressBar{ id: progressbar } StylePrivate.APPParameter{ id: app } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/qmldir0000664000175000017500000000115015154306201023120 0ustar fengfeng singleton MobileTextActionsToolBar 1.0 private/MobileTextActionsToolBar.qml DefaultListItemBackground 1.0 private/DefaultListItemBackground.qml MobileCursor 1.0 private/MobileCursor.qml FocusRect 1.0 private/FocusRect.qml RadiusRectangle 1.0 private/RadiusRectangle.qml ParseInterface 1.0 private/ParseInterface.qml NormalControlColor 1.0 private/NormalControlColor.qml ButtonIconLabelContent 1.0 private/ButtonIconLabelContent.qml BackGroundRectangle 1.0 private/BackGroundRectangle.qml IconLabelContent 1.0 private/IconLabelContent.qml NormalBack 1.0 private/NormalBack.qml WindowBack 1.0 private/WindowBack.qml qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/TextArea.qml0000664000175000017500000001746415154306200024153 0ustar fengfeng/**************************************************************************** ** ** 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$ ** ****************************************************************************/ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有impl模块 // import QtQuick.Controls.impl 2.12 import QtQuick.Layouts 6.2 // 替代原1.3(Qt6中Layouts模块版本同步6.x) import QtQuick.Templates 6.2 as T // 替代原2.12 import org.ukui.qqc2style.private 1.0 as StylePrivate T.TextArea { id: control implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, implicitBackgroundWidth + leftInset + rightInset, placeholder.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, implicitBackgroundHeight + topInset + bottomInset, placeholder.implicitHeight + topPadding + bottomPadding) padding: textfield.leftRightPadding leftPadding: padding color: getStartColor(!control.enabled ? textfield.disableTextColor : textfield.normalTextColor) selectionColor: getStartColor(textfield.focusBorderColor) selectedTextColor: control.palette.highlightedText placeholderTextColor: getStartColor(!control.enabled ? textfield.placeHolderDisableTextColor : textfield.placeHolderNormalTextColor) font: app.font hoverEnabled: true selectByMouse: true wrapMode: TextArea.Wrap Layout.fillWidth: true Layout.fillHeight: true palette: app.palette property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property var backColor: !control.enabled ? (isTransaprent ? textfield.disableTransparentBC : textfield.disableBC) : (control.activeFocus) ? (isTransaprent ? textfield.inputNormalTransparentBC : textfield.inputNormalBC) : click ? (isTransaprent ? textfield.inputNormalTransparentBC : textfield.inputNormalBC) : control.hovered ? (isTransaprent ? textfield.hoveredTransparentBC : textfield.hoveredBC) : (isTransaprent ? textfield.normalTransparentBC : textfield.normalBC) property var backBorderColor: !control.enabled ? textfield.disableBorderColor : (control.activeFocus) ? textfield.focusBorderColor : control.hovered ? textfield.hoverBorderColor : textfield.normalBorderColor // property bool hover: false property bool click: false ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } background: Rectangle { id: backrec radius: textfield.radius implicitWidth: textfield.normalWidth implicitHeight: textfield.normalHeight color: gradientRec.visible ? "transparent" : getStartColor(backColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(backColor) } GradientStop { position: 1.0; color: getEndColor(backColor)} } visible: !parseInterface.isSolidPattern(backColor) } Rectangle{ anchors.fill: parent radius: textfield.radius color: "transparent" border.color: getStartColor(backBorderColor) border.width: (control.activeFocus) ? textfield.focusBorderWidth : textfield.borderWidth } // Component.onCompleted: console.log("123321....", verticalScrollBar.visible) //没办法内置滚动条 滚动条没办法跟内容联动 // ScrollBar.vertical: ScrollBar { // id: verticalScrollBar // parent: backrec // anchors.right: backrec.right // anchors.top: backrec.top // anchors.bottom: backrec.bottom // visible: control.contentHeight > control.height // orientation: Qt.Vertical // size: control.height * 1.0/ control.contentHeight*1.0 //control.flickableItem.visibleArea.heightRatio // //position: 0.5//control.flickableItem.visibleArea.yPosition // active: visible//control.flickableItem.moving || control.flickableItem.dragging // onPositionChanged: { // var newY = position * (control.contentHeight - control.height) // control.flickableItem.contentY = newY // // control.flickable.contentY = position * control.contentHeight // } // // policy: (verticalScrollBarAlwaysVisible || control.flickableItem.contentHeight > control.height) ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded // // orientation: Qt.Vertical // // size: control.flickableItem.visibleArea.heightRatio // // position: control.flickableItem.visibleArea.yPosition // // active: control.flickableItem.moving || control.flickableItem.dragging // } } 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: app.font color: getStartColor(!control.enabled ? textfield.placeHolderDisableTextColor : textfield.placeHolderNormalTextColor) verticalAlignment: control.verticalAlignment visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) elide: Text.ElideRight renderType: control.renderType } StylePrivate.UKUITextArea{ id: textfield } StylePrivate.APPParameter{ id: app } onPressed: { click = true; } onReleased: click = false } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/ItemDelegate.qml0000664000175000017500000002113215154306200024752 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块(当前代码未使用该模块任何内容) // import QtQuick.Controls.impl 2.12 (已删除) import QtQuick.Templates 6.2 as T // 替代原2.12 import org.ukui.qqc2style.private 1.0 as StylePrivate // 保留,需确认Qt6适配性 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, itemdelegate.implicitHeight + topInset + bottomInset) padding: itemdelegate.padding spacing: app.space icon.width: app.iconWidth icon.height: app.iconWidth hoverEnabled: true font: app.font palette: app.palette // icon.color: control.palette.text property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property var isAlternate:{ if(control.hasOwnProperty("alternate")){ if(control.alternate && index%2 === 1) return true } else return false } property var borderHColor: !control.enabled ? itemdelegate.disableBorderHColor : /*control.pressed ? itemdelegate.clickBorderHColor : control.hovered ? itemdelegate.hoverBorderHColor : */itemdelegate.normalBorderHColor property var backHColor: !control.enabled ? itemdelegate.disableHBC : /*control.pressed ? itemdelegate.clickedHBC : control.hovered ? itemdelegate.hoveredHBC :*/ itemdelegate.normalHBC property var borderColor: !control.enabled ? (isTransaprent ? itemdelegate.disableTransparentBorderColor : itemdelegate.disableBorderColor) : //control.pressed ? (isTransaprent ? itemdelegate.clickedTransparentBorderColor : itemdelegate.clickBorderColor) : control.hovered ? (isTransaprent ? itemdelegate.hoveredTransparentBorderColor : itemdelegate.hoverBorderColor) : (isTransaprent ? itemdelegate.normalTransparentBorderColor : itemdelegate.normalBorderColor) property var backColor: !control.enabled ? (isTransaprent ? (isAlternate ? itemdelegate.disableAlternateTransparentBC : itemdelegate.disableTransparentBC ): (isAlternate ? itemdelegate.disableAlternateBC : itemdelegate.disableBC)) : //control.pressed ? (isTransaprent ? (isAlternate ? itemdelegate.clickedAlternateTransparentBC : itemdelegate.clickedTransparentBC ): (isAlternate ? itemdelegate.clickedAlternatedBC : itemdelegate.clickedBC)) : control.hovered ? (isTransaprent ? (isAlternate ? itemdelegate.hoveredAlternateTransparentBC : itemdelegate.hoveredTransparentBC ): (isAlternate ? itemdelegate.hoveredAlternatedBC : itemdelegate.hoveredBC)) : (isTransaprent ? (isAlternate ? itemdelegate.normalAlternateTransparentBC : itemdelegate.normalTransparentBC ): (isAlternate ? itemdelegate.normalAlternateBC : itemdelegate.normalBC)) property var borderCheckedColor: !control.enabled ? (isTransaprent ? itemdelegate.disableCheckedTransparentBorderColor : itemdelegate.disableBorderCheckedColor) : //control.pressed ? (isTransaprent ? itemdelegate.clickedCheckedTransparentBorderColor : itemdelegate.clickBorderCheckedColor) : //control.hovered ? (isTransaprent ? itemdelegate.hoveredCheckedTransparentBorderColor : itemdelegate.hoverBorderCheckedColor) : (isTransaprent ? itemdelegate.normalCheckedTransparentBorderColor : itemdelegate.normalBorderCheckedColor) property var backCheckedColor: !control.enabled ? (isTransaprent ? itemdelegate.disableCheckedTransparentBC : itemdelegate.disableCheckedBC) : //control.pressed ? (isTransaprent ? itemdelegate.clickedCheckedTransparentBC : itemdelegate.clickedCheckedBC) : //control.hovered ? (isTransaprent ? itemdelegate.hoveredCheckedTransparentBC : itemdelegate.hoveredCheckedBC) : (isTransaprent ? itemdelegate.normalCheckedTransparentBC : itemdelegate.normalCheckedBC) ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } // 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: app.font // color: getStartColor(control.enabled ? itemdelegate.normalTextColor : itemdelegate.disableTextColor) // } contentItem: IconLabelContent { id: iconLabel controlRoot: control anchors.fill: control anchors.verticalCenter: control.verticalCenter leftSpace: control.mirrored ? control.indicator.width + control.spacing : control.leftPadding textColor: !control.enabled ? ((control.highlighted && control.checked) ? itemdelegate.disableHTextColor : itemdelegate.disableTextColor) : (control.highlighted && control.checked) ? itemdelegate.normalHTextColor : itemdelegate.normalTextColor //x: 0// control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 //anchors.centerIn: control implicitWidth: iconLabel.adjustWidth(control.leftPadding + control.rightPadding) + indicator.implicitWidth + control.spacing } background: Rectangle { anchors.fill: control radius: itemdelegate.radius border.width: itemdelegate.borderWidth border.color: getStartColor((control.highlighted && control.checked) ? borderHColor : control.checked ? borderCheckedColor : borderColor) // implicitWidth: 100 // implicitHeight: 40 // visible: control.down || (control.highlighted && control.checked) || control.visualFocus color: gradientRec.visible ? "transparent" : getStartColor((control.highlighted && control.checked) ? backHColor : control.checked ? backCheckedColor : backColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius border.width: parent.border.width border.color: parent.border.color gradient: Gradient { id:gradient GradientStop { position: 0.0; color: getStartColor((control.highlighted && control.checked) ? backHColor : control.checked ? backCheckedColor : backColor) } GradientStop { position: 1.0; color: getEndColor((control.highlighted && control.checked) ? backHColor : control.checked ? backCheckedColor : backColor)} } visible: !parseInterface.isSolidPattern((control.highlighted && control.checked) ? backHColor : control.checked ? backCheckedColor : backColor) } } StylePrivate.UKUIItemDelegate{ id: itemdelegate } StylePrivate.APPParameter{ id: app } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/RadioButton.qml0000664000175000017500000003042615154306200024661 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改:统一升级所有Qt模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.6 import QtQuick.Templates 6.2 as T // 替代原2.5 import org.ukui.qqc2style.private 1.0 as StylePrivate T.RadioButton { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + implicitIndicatorWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding, implicitIndicatorHeight + topPadding + bottomPadding) hoverEnabled: true palette: app.palette font: app.font property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property alias indicatorColor: indicatorRec.color property alias childrenColor: childrenRec.color property bool isHoveredExpanded: false //记录小圆是否处于 “hover 放大到 8px” 的状态 property var tansparentNormalColor: radiobutton.normalTransparentIndicatorColor property var normalColor: radiobutton.normalIndicatorColor property var borderColor: control.checked ? (!control.enabled ? radiobutton.checked_disableIndicatorBorderColor : control.pressed ? radiobutton.checked_clickIndicatorBorderColor : control.hovered ? radiobutton.checked_hoverIndicatorColor : radiobutton.checked_normalIndicatorBorderColor) : (!control.enabled ? radiobutton.disableIndicatorBorderColor : control.pressed ? radiobutton.clickIndicatorBorderColor : control.hovered ? radiobutton.hoverIndicatorBorderColor : radiobutton.normalIndicatorBorderColor) property var backColor: control.checked ? (!control.enabled ? radiobutton.checked_disableIndicatorColor : control.pressed ? radiobutton.checked_clickIndicatorColor : control.hovered ? radiobutton.checked_hoverIndicatorColor : radiobutton.checked_normalIndicatorColor) : isTransaprent ? (!control.enabled ? radiobutton.disableTransparentIndicatorColor : control.pressed ? radiobutton.clickTransparentIndicatorColor : control.hovered ? radiobutton.hoverTransparentIndicatorColor : tansparentNormalColor) : (!control.enabled ? radiobutton.disableIndicatorColor : control.pressed ? radiobutton.clickIndicatorColor : control.hovered ? radiobutton.hoverIndicatorColor : normalColor) property var childrenDtColor: !control.enabled ? radiobutton.checked_disableChildrenColor : control.pressed ? radiobutton.checked_clickChildrenColor: control.hovered ? radiobutton.checked_hoverChildrenColor: radiobutton.checked_normalChildrenColor ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } padding: 6 spacing: radiobutton.space // keep in sync with RadioDelegate.qml (shared RadioIndicator.qml was removed for performance reasons) indicator: Rectangle { id: indicatorRec width: radiobutton.indicatorWidth height: width 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 color: gradientRec.visible ? "transparent" : getStartColor(backColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(backColor) } GradientStop { position: 1.0; color: getEndColor(backColor)} } visible: !parseInterface.isSolidPattern(backColor) } Rectangle{ anchors.fill: parent radius: width / 2 border.width: radiobutton.borderWidth border.color: getStartColor((app.focusEnable && control.visualFocus) ? (control.checked ? borderColor : radiobutton.checked_normalIndicatorColor) : borderColor) color: "transparent" } Rectangle { id:childrenRec width: 8 height: width // anchors.centerIn: parent anchors.horizontalCenter: parent.horizontalCenter // 水平居中 anchors.verticalCenter: parent.verticalCenter // 垂直居中 radius: width / 2 color: gradientChildrenRec.visible ? "transparent" : getStartColor(childrenDtColor) visible: control.checked Rectangle{ id: gradientChildrenRec anchors.fill: parent radius: parent.radius border.width: parent.border.width border.color: parent.border.color gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(childrenDtColor) } GradientStop { position: 1.0; color: getEndColor(childrenDtColor)} } visible: !parseInterface.isSolidPattern(childrenDtColor) } } NumberAnimation { id: scaleAnim target: childrenRec property: "scale" from: 0.0 to: radiobutton.childrenWidth / 8 // 关键:计算基准大小对应的缩放比例 duration: 200 easing.type: Easing.InOutQuint } NumberAnimation { id: uncheckScaleAnim target: childrenRec property: "scale" from: radiobutton.childrenWidth / 8 // 从基准大小开始 to: 0.0 duration: 150 easing.type: Easing.InOutQuint onRunningChanged: { if (!running && !control.checked) { childrenRec.visible = false; control.isHoveredExpanded = false; // 重置状态 } } } ColorAnimation { id: transparentColorAnim target: control property: "tansparentNormalColor" from: radiobutton.checked_normalIndicatorColor to: radiobutton.normalTransparentIndicatorColor duration: 150 easing.type: Easing.InOutQuint running: false } ColorAnimation { id: colorAnim target: control property: "normalColor" from: radiobutton.checked_normalIndicatorColor to: radiobutton.normalIndicatorColor duration: 150 easing.type: Easing.InOutQuint running: false } NumberAnimation { id: hoverScaleAnim target: childrenRec property: "scale" duration: 100 easing.type: Easing.InOutQuint } } contentItem: Text { 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: control.font color: getStartColor(control.enabled ? radiobutton.normalTextColor : radiobutton.disableTextColor) } onHoveredChanged: { if (!control.enabled || !control.checked) { return; } const baseScale = radiobutton.childrenWidth / 8; const targetScale = 1.0; hoverScaleAnim.stop(); if (hovered) { // 鼠标移入:从基准大小放大到8px if (childrenRec.scale === baseScale) { // 仅当当前是基准大小时才放大 hoverScaleAnim.from = baseScale; hoverScaleAnim.to = targetScale; hoverScaleAnim.start(); control.isHoveredExpanded = true; // 标记为“已放大到8px” } } else { if (control.isHoveredExpanded) { hoverScaleAnim.from = targetScale; hoverScaleAnim.to = baseScale; hoverScaleAnim.start(); control.isHoveredExpanded = false; } } } function handleChildrenScale() { if (!control.enabled || !control.checked) { return; } const baseScale = radiobutton.childrenWidth / 8; const expandedScale = 1.0; hoverScaleAnim.stop(); // 新增:按下状态处理 if (control.pressed) { // 按下时立即缩小到基准大小 if (childrenRec.scale !== baseScale) { hoverScaleAnim.from = childrenRec.scale; hoverScaleAnim.to = baseScale; hoverScaleAnim.start(); control.isHoveredExpanded = false; } } else if (control.hovered) { // 松开后恢复为8px if (childrenRec.scale === baseScale) { hoverScaleAnim.from = baseScale; hoverScaleAnim.to = expandedScale; hoverScaleAnim.start(); control.isHoveredExpanded = true; } } else { // 非hover状态处理 if (control.isHoveredExpanded) { hoverScaleAnim.from = expandedScale; hoverScaleAnim.to = baseScale; hoverScaleAnim.start(); control.isHoveredExpanded = false; } } } // 新增:处理按下和松开事件 onPressedChanged: { // 按下时强制更新小圆圈大小 if (control.pressed && control.hovered && control.checked && control.enabled) { handleChildrenScale(); } // 松开时恢复 else if (!control.pressed && control.hovered && control.checked && control.enabled) { handleChildrenScale(); } } onCheckedChanged: { if (checked) { childrenRec.scale = 0.0; childrenRec.visible = true; scaleAnim.start(); control.isHoveredExpanded = false; } else { uncheckScaleAnim.start(); if(isTransaprent) transparentColorAnim.start() else colorAnim.start(); control.isHoveredExpanded = false; } } StylePrivate.UKUIRadioButton{ id: radiobutton } StylePrivate.APPParameter{ id: app } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/CheckBox.qml0000664000175000017500000003177115154306200024121 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块版本为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.6 import QtQuick.Templates 6.2 as T // 替代原2.5 import org.ukui.qqc2style.private 1.0 as StylePrivate // 保留,需确认Qt6适配性 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: checkbox.space hoverEnabled: true palette: app.palette font: app.font property var normalColor:checkbox.normalIndicatorColor property var tansparentNormalColor: checkbox.normalTransparentIndicatorColor property var tansparentNormalCheckColor: checkbox.checked_normalIndicatorColor property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } // 新增:判断是否有动画正在运行(涵盖所有相关动画) property bool isAnimating: scaleAnim.running || opacityAnim.running || uncheckScaleAnim.running || uncheckOpacityAnim.running || tansparentColorReturnAnim.running || tansparentColorAnim.running || normalColorAnim.running || normalColorReturnAnim.running property var borderColor: control.checked || (control.tristate == true && control.checkState === Qt.PartiallyChecked)? (!control.enabled ? checkbox.checked_disableIndicatorBorderColor : control.pressed ? checkbox.checked_clickIndicatorBorderColor : (!isAnimating && control.hovered) ? checkbox.checked_hoverIndicatorBorderColor : checkbox.checked_normalIndicatorBorderColor) : (!control.enabled ? checkbox.disableIndicatorBorderColor : control.pressed ? checkbox.clickIndicatorBorderColor : (!isAnimating && control.hovered) ? checkbox.hoverIndicatorBorderColor : checkbox.normalIndicatorBorderColor) property var checkBoxColor: control.checked || (control.tristate == true && control.checkState === Qt.PartiallyChecked) ? (!control.enabled ? checkbox.checked_disableIndicatorColor : control.pressed ? checkbox.checked_clickIndicatorColor : (!isAnimating && control.hovered) ? checkbox.checked_hoverIndicatorColor : tansparentNormalCheckColor) : isTransaprent ? (!control.enabled ? checkbox.disableTransparentIndicatorColor : control.pressed ? checkbox.clickTransparentIndicatorColor : (!isAnimating && control.hovered) ? checkbox.hoverTransparentIndicatorColor : tansparentNormalColor) : (!control.enabled ? checkbox.disableIndicatorColor : control.pressed ? checkbox.clickIndicatorColor : (!isAnimating && control.hovered) ? checkbox.hoverIndicatorColor : normalColor) ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } indicator: Item{ implicitWidth: checkbox.indicatorWidth implicitHeight: checkbox.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 Rectangle { anchors.fill: parent radius: checkbox.radius color: gradientRec.visible ? "transparent" : getStartColor(checkBoxColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { id:gradient GradientStop { position: 0.0; color: getStartColor(checkBoxColor) } GradientStop { position: 1.0; color: getEndColor(checkBoxColor)} } visible: !parseInterface.isSolidPattern(checkBoxColor) } Rectangle{ anchors.fill: parent radius: checkbox.radius border.width: checkbox.borderWidth border.color: getStartColor(borderColor) color: "transparent" } } Image { id: image anchors.centerIn: parent sourceSize.width: 16 sourceSize.height: 16 source: iconSource() visible: control.checkState === Qt.Checked || (control.checkState === Qt.Unchecked && uncheckScaleAnim.running) cache: false scale: 0.2 opacity: 0.0 transformOrigin: Item.Center } NumberAnimation { id: scaleAnim target: image property: "scale" from: 0.2 to: 1.0 duration: 240 easing.type: Easing.InOutCirc onRunningChanged: if (!running) control.update() } PropertyAnimation { id: opacityAnim target: image property: "opacity" from: 0.0 to: 1.0 duration: 100 easing.type: Easing.InOutQuart onRunningChanged: if (!running) control.update() } NumberAnimation { id: uncheckScaleAnim target: image property: "scale" from: 1.0 to: 0.2 duration: 240 easing.type: Easing.InOutCirc onRunningChanged: if (!running) control.update() } PropertyAnimation { id: uncheckOpacityAnim target: image property: "opacity" from: 1.0 to: 0.0 duration: 100 easing.type: Easing.InOutQuint onRunningChanged: if (!running) control.update() } Rectangle { anchors.centerIn: parent width: 9 height: 1 color: { getStartColor(!control.enabled ? checkbox.checked_disableChildrenColor : control.pressed ? checkbox.checked_clickChildrenColor: // 部分选中状态处理hover与动画的关系 (!isAnimating && control.hovered) ? checkbox.checked_hoverChildrenColor: checkbox.checked_normalChildrenColor) } visible: control.checkState === Qt.PartiallyChecked } } contentItem: Text { 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: control.font color: getStartColor(control.enabled ? checkbox.normalTextColor : checkbox.disableTextColor) } StylePrivate.APPParameter{ id: app onParametryChanged:{ image.source = iconSource() control.update(); } onIconThemeChanged: { image.source = "" image.source = iconSource() } } StylePrivate.UKUICheckBox{ id: checkbox } ColorAnimation { id: tansparentColorAnim target: control property: "tansparentNormalCheckColor" from:checkbox.normalTransparentIndicatorColor to: checkbox.checked_normalIndicatorColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: if (!running) control.update() } ColorAnimation { id: tansparentColorReturnAnim target: control property: "tansparentNormalColor" from: checkbox.checked_normalIndicatorColor to: checkbox.normalTransparentIndicatorColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: if (!running) control.update() } ColorAnimation { id: normalColorAnim target: control property: "tansparentNormalCheckColor" from:checkbox.normalIndicatorColor to: checkbox.checked_normalIndicatorColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: if (!running) control.update() } ColorAnimation { id: normalColorReturnAnim target: control property: "normalColor" from: checkbox.checked_normalIndicatorColor to: checkbox.normalIndicatorColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: if (!running) control.update() } onEnabledChanged: { image.source = iconSource(); control.update(); } property int prevCheckState: Qt.Unchecked Component.onCompleted: { prevCheckState = control.checkState; } onCheckStateChanged: { // console.log("状态转换:", prevCheckState, "→", control.checkState) if (prevCheckState === Qt.Unchecked && control.checkState === Qt.PartiallyChecked) { if(isTransaprent){ tansparentColorReturnAnim.stop(); tansparentColorAnim.start(); }else{ normalColorReturnAnim.stop(); normalColorAnim.start(); } scaleAnim.start(); opacityAnim.start(); } else if (prevCheckState === Qt.PartiallyChecked && control.checkState === Qt.Checked) { if(isTransaprent){ tansparentColorReturnAnim.stop(); tansparentColorAnim.stop(); tansparentNormalCheckColor = checkbox.checked_normalIndicatorColor; }else{ normalColorReturnAnim.stop(); normalColorAnim.stop(); normalColor = checkbox.checked_normalIndicatorColor; } scaleAnim.start(); opacityAnim.start(); } else if (prevCheckState === Qt.Checked && control.checkState === Qt.Unchecked) { if(isTransaprent){ tansparentColorAnim.stop(); tansparentColorReturnAnim.start(); }else{ normalColorAnim.stop(); normalColorReturnAnim.start(); } uncheckScaleAnim.start(); uncheckOpacityAnim.start(); } else if (prevCheckState === Qt.Unchecked && control.checkState === Qt.Checked) { if(isTransaprent){ tansparentColorReturnAnim.stop(); tansparentColorAnim.start(); }else{ normalColorReturnAnim.stop(); normalColorAnim.start(); } scaleAnim.start(); opacityAnim.start(); } prevCheckState = control.checkState; control.update(); } onCheckedChanged: { if (!control.tristate) { if (control.checked) { if(isTransaprent) tansparentColorAnim.start(); else normalColorAnim.start(); scaleAnim.start(); opacityAnim.start(); } else { if(isTransaprent) tansparentColorReturnAnim.start(); else normalColorReturnAnim.start(); uncheckScaleAnim.start(); uncheckOpacityAnim.start(); } } image.source = iconSource(); } function iconSource(){ // var model = (!control.enabled && control.checked) ? "highDisbale" : // !control.enabled ? "disenable" : // control.checked ? "highlight" : "normal" var model = "highlight" var icon = "object-select-symbolic"; if(!app.themeHasIcon(icon)) icon = "file:///usr/share/icons/ukui-icon-theme-default/scalable/actions/object-select-symbolic.svg" return "image://imageProvider/" + icon + "/" + model; } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/Label.qml0000664000175000017500000000520015154306200023436 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块(该模块在Qt6中被彻底移除,且当前代码未使用其内容) // import QtQuick.Controls.impl 2.12 (已删除) import QtQuick.Templates 6.2 as T // 替代原2.12 import org.ukui.qqc2style.private 1.0 as StylePrivate T.Label { id:control property var dtColor:{ if(control.hasOwnProperty("labelDTColor")) return control.labelDTColor else return "" } property var _windowLabel: { if(control.hasOwnProperty("windowLabel")) return control.windowLabel else return false } ParseInterface{ id: parseInterface } onDtColorChanged: { if(dtColor !== "") control.color = parseInterface.getDTColor(dtColor) } color: { if(dtColor !== ""){ return parseInterface.getDTColor(dtColor) } else return parseInterface.pStartColor(enabled ? (_windowLabel && !Qt.application.active) ? parseInterface.getDTColor("kfont-secondary-disable") : label.normalColor : label.disableColor) }//StylePrivate.UKUILable.normalColor linkColor: parseInterface.pStartColor(label.linkColor) font: app.font//appP.font palette: app.palette StylePrivate.UKUILabel{ id: label onParametryChanged:{ control.update(); } } StylePrivate.APPParameter{ id: app onParametryChanged: { if(control.hasOwnProperty("labelDTColor")) control.color = parseInterface.getDTColor(dtColor) } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/ScrollBar.qml0000664000175000017500000001173615154306200024315 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.14 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块 // import QtQuick.Controls.impl 2.12 (已删除) import QtQuick.Templates 6.2 as T // 替代原2.12 // 核心修改3:Qt6中WheelHandler移至QtQuick.Input模块,需新增导入 import QtQuick.Input 6.2 import org.ukui.qqc2style.private 1.0 as StylePrivate T.ScrollBar { id: control palette: app.palette font: app.font implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding) hoverEnabled: true padding: scrollbar.padding visible: control.policy !== ScrollBar.AlwaysOff property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property var itemColor: !control.enabled ? (isTransaprent ? scrollbar.disableTransparentColor : scrollbar.disableColor) : control.pressed ? (isTransaprent ? scrollbar.clickTransparentColor : scrollbar.clickColor) : control.hovered ? (isTransaprent ? scrollbar.hoverTransparentColor : scrollbar.hoverColor) : (isTransaprent ? scrollbar.normalTransparentColor : scrollbar.normalColor) ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } contentItem: Rectangle { // 区分横向/纵向:纵向改宽度,横向改高度 implicitWidth: control.orientation === Qt.Vertical ? (control.interactive ? (control.hovered || control.pressed ? 8 : 4) : 2) : 0 // 横向宽度由滚动区域决定 implicitHeight: control.orientation === Qt.Horizontal ? (control.interactive ? (control.hovered || control.pressed ? 8 : 4) : 2) : 0 // 纵向高度由滚动区域决定 radius: control.orientation === Qt.Vertical ? width / 2 : height / 2 // 圆角随动态尺寸变化 color: gradientRec.visible ? "transparent" : getStartColor(itemColor) // 根据方向设置动画:纵向动画宽度,横向动画高度 Behavior on implicitWidth { NumberAnimation { duration: 260 easing.type: Easing.OutExpo } } Behavior on implicitHeight { NumberAnimation { duration: 260 easing.type: Easing.OutExpo } } Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius // border.width: parent.border.width // border.color: parent.border.color gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(itemColor) } GradientStop { position: 1.0; color: getEndColor(itemColor)} } visible: !parseInterface.isSolidPattern(itemColor) } states: State { name: "active" when: /*control.policy === ScrollBar.AlwaysOn || */(control.active && (control.hovered || control.pressed) && control.size < 1.0) PropertyChanges { target: control.contentItem; implicitWidth:8; implicitHeight:8} } } StylePrivate.UKUIScrollBar{ id: scrollbar } StylePrivate.APPParameter{ id: app } WheelHandler{ onWheel: { var delta = event.angleDelta.y if(control.mirrored || event.inverted){ delta = -1 * delta; } if(delta < 0){ control.increase() } else if(delta > 0){ control.decrease() } } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/0000775000175000017500000000000015160516153023370 5ustar fengfengqt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/NormalBack.qml0000664000175000017500000002271115160516153026117 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ import QtQuick 6.2 import Qt5Compat.GraphicalEffects 1.0 import QtQuick.Controls 6.2 as Controls import QtQuick.Templates 6.2 as T import QtQuick.Window 6.2 import org.ukui.qqc2style.private 1.0 as StylePrivate Rectangle { id: popupwindow width: windowLabel.implicitWidth + 2 * tooltip.padding height: windowLabel.implicitHeight + 2 * tooltip.padding visible: true radius: tooltip.radius color: { // console.log("normalrec color:", getStartColor(isTransaprent ? tooltip.backTransparentColor : tooltip.backColor).r) return Qt.rgba(getStartColor(isTransaprent ? tooltip.backTransparentColor : tooltip.backColor).r, getStartColor(isTransaprent ? tooltip.backTransparentColor : tooltip.backColor).g, getStartColor(isTransaprent ? tooltip.backTransparentColor : tooltip.backColor).b, 1) } opacity: 1 property T.ToolTip controlRoot // margins: tooltip.margins //padding: tooltip.padding // flags: Qt.NoFocus Rectangle{ anchors.fill: parent color: "transparent" border.color: getStartColor(isTransaprent ? tooltip.backBorderTransparentColor : tooltip.backBorderColor) border.width: 1 radius: parent.radius } ParseInterface{ id: parseInterface } StylePrivate.APPParameter{ id: appP onParametryChanged: { // console.log("parametryyyyyyyy") // var c = getStartColor(isTransaprent ? tooltip.backTransparentColor : tooltip.backColor) // console.log("parametryyyyyyyy", c.r, c.g, c.b) } } StylePrivate.UKUIToolTip{ id: tooltip } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } function setControlRoot(control){ controlRoot = control } Connections{ target: controlRoot function onVisibleChanged() { popupwindow.visible = controlRoot.visible } function onXChanged(){ return popupwindow.x = Math.max(controlRoot.width - popupwindow.width, 0) } } Component.onCompleted: { // var c = getStartColor(isTransaprent ? tooltip.backTransparentColor : tooltip.backColor) // popupwindow.color = Qt.rgba(c.red, c.green, c.blue, 255) popupwindow.opacity = 1 if(controlRoot){ adjustSize() } } onVisibleChanged: { if(visible && controlRoot){ adjustSize(); } } // Rectangle{ // id: rec // visible: parent.visible // anchors.fill: parent // radius: tooltip.radius // color: getStartColor(isTransaprent ? tooltip.backTransparentColor : tooltip.backColor) // border.color: getStartColor(isTransaprent ? tooltip.backBorderTransparentColor : tooltip.backBorderColor) // opacity: 1 // border.width: 1 // } TextMetrics{ id: metrics font: windowLabel.font text: windowLabel.text } Controls.Label { id: windowLabel anchors.fill: parent anchors.leftMargin: tooltip.padding anchors.rightMargin: tooltip.padding anchors.topMargin: tooltip.padding anchors.bottomMargin: tooltip.padding anchors.centerIn: parent visible: parent.visible text: controlRoot ? controlRoot.text : "" wrapMode: controlRoot ? controlRoot.mode : Text.NoWrap font: controlRoot ? controlRoot.font : appP.font color: getStartColor(tooltip.textColor) textFormat: controlRoot ? controlRoot._textFormat : Qt.PlainText onTextChanged: { metrics.text = text controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) if(controlRoot._maxWidth != 0) if((metrics.width + + 2 * tooltip.padding) < controlRoot._maxWidth) popupwindow.width = metrics.width + + 2 * tooltip.padding else{ if(Window.width > 20) popupwindow.width = Math.min(controlRoot._maxWidth, Window.width - 20) else popupwindow.width = controlRoot._maxWidth } controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) adjustSize() } onWidthChanged: { adjustSize() if(controlRoot){ controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) if(controlRoot._maxWidth != 0 && (metrics.width + + 2 * tooltip.padding) < controlRoot._maxWidth){ popupwindow.width = metrics.width + + 2 * tooltip.padding } } } onHeightChanged: { adjustSize() if(controlRoot){ controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) } } Component.onCompleted: { if(controlRoot){ controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) } } } function setPosition() { var window = popupwindow.Window.window; if (!window) return; var contentItem = window.contentItem; var p = appP.posByCursor(popupwindow.width, popupwindow.height) var pointInContent = contentItem.mapFromGlobal(p.x, p.y); var pointInParent = popupwindow.parent.mapFromItem(contentItem, pointInContent.x, pointInContent.y); controlRoot.x = pointInParent.x; controlRoot.y = pointInParent.y; } function adjustSize(){ if(visible && controlRoot){ // var p = appP.posByCursor(popupwindow.width, popupwindow.height) // console.log("rec visible p", p.x, p.y) // console.log("rec visible p", popupwindow.mapFromGlobal(p.x, p.y)) // console.log("rec visible p", windowLabel.mapFromGlobal(p.x, p.y)) // p = popupwindow.mapFromGlobal(p.x, p.y) // console.log("rec visible p1", p.x, p.y) // controlRoot.x = p.x // controlRoot.y = p.y controlRoot.implicitWidth = popupwindow.width controlRoot.implicitHeight = popupwindow.height controlRoot.x = controlRoot.parent ? (parent.width - popupwindow.width)/2 : 0 controlRoot.y = -popupwindow.height -3 // console.log("rec visible controlRoot", controlRoot.parent, controlRoot.x, controlRoot.y) // var p = popupwindow.mapToGlobal(popupwindow.x, popupwindow.y) // var l = appP.posByCursor(popupwindow.width, popupwindow.height).x - (p.x) // console.log("lllllllllllllllllllllll", popupwindow.x, p.x, popupwindow.width, appP.posByCursor(popupwindow.width, popupwindow.height).x, l) // if(l > 10){ // popupwindow.x = l // } // setPosition() } let current = parent var window = Window while (current && current.parent) { current = current.parent } // 如果顶层对象是 Window 则返回 if (current && current.hasOwnProperty("window")) { window = current.window } if(window.width > 0 && controlRoot.x + popupwindow.width > window.width){ if(popupwindow.width > window.width && window.width > 20) popupwindow.width = window.width - 20 controlRoot.x = window.width - popupwindow.width } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/ParseInterface.qml0000664000175000017500000001417615154306201027001 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ import QtQuick 6.2 import org.ukui.qqc2style.private 1.0 as StylePrivate Item { StylePrivate.ParseColorInterface { id: pf } function pStartColor(dtColor) { return pf.startColor(dtColor) } function pEndColor(dtColor) { return pf.endColor(dtColor) } function isSolidPattern(dtColor) { return pf.isSolidPattern(dtColor) } function iconSource(controlRoot) { if((controlRoot.icon.source.toString() === "" && controlRoot.icon.name.toString() === "")){ return controlRoot.icon.source } var closeBtn = false; var windowBtn = false; var importBtn = false; if(controlRoot.hasOwnProperty("buttonType")){ closeBtn = (controlRoot.buttonType === "closeButton" || controlRoot.buttonType === "windowTitleBarCloseButton"); windowBtn = (controlRoot.buttonType === "windowButton" || controlRoot.buttonType === "windowTitleBarWindowButton"); importBtn = (controlRoot.buttonType === "importButton"); } var model = ""; var active = Qt.application.active if(controlRoot.hasOwnProperty("buttonType") && (controlRoot.buttonType === "windowTitleBarCloseButton" || controlRoot.buttonType === "windowTitleBarWindowButton")){ if(!active && !(controlRoot.hovered || controlRoot.pressed)){ if(appP.isDark) model = "/highDisbale" else model = "/disenable" } } /*if(!controlRoot.enabled && ) model = "/disenable" else */ if(!controlRoot.flat && (importBtn || controlRoot.highlighted || appP.isDark)) model = "/highlight" else if(active && ((controlRoot.flat && appP.isDark )|| ((closeBtn || (controlRoot.flat &&(importBtn || controlRoot.highlighted || appP.isDark))) && (controlRoot.pressed || controlRoot.hovered)))) { model = "/highlight" } else if(!controlRoot.enabled) model = "/disenable" else if(model === "" && controlRoot.enabled) model = "/normal" if(model == "/highlight" && !controlRoot.enabled) model = "/highDisbale" let s = controlRoot.icon.source.toString(); if(s === "") s = controlRoot.icon.name.toString(); var lastS =pf.endString(s, "/"); if(lastS === "disenable" || lastS === "highlight" || lastS === "normal" || lastS === "highDisbale") model = ""; //var prefix = /^image:///imageProvider///i; var prefixStr = "image://imageProvider/"; // var qrcStr = "qrc:/"; // console.log("start width...", s.slice(0, 5), s.slice(0, prefixStr.length)) if(s.slice(0, 5) === "qrc:/" || s.slice(0, 5) === "file:") { return prefixStr + s + model; } if(s.slice(0, prefixStr.length).toLowerCase() === prefixStr.toLowerCase()){ prefixStr = ""; } // console.log("buttoniconlabel...", prefixStr + s + model) return prefixStr + s + model; } function buttonIcon(controlRoot, iconName){ var closeBtn = false; var windowBtn = false; var importBtn = false; if(controlRoot.hasOwnProperty("buttonType")){ closeBtn = (controlRoot.buttonType === "closeButton"); windowBtn = (controlRoot.buttonType === "windowButton"); importBtn = (controlRoot.buttonType === "importButton"); } var model = ""; /*if(!controlRoot.enabled && ) model = "/disenable" else */ if(!controlRoot.flat && (importBtn || controlRoot.highlighted || appP.isDark)) model = "/highlight" else if((controlRoot.flat && appP.isDark )|| (closeBtn || (controlRoot.flat &&(importBtn || controlRoot.highlighted || appP.isDark))) &&(controlRoot.pressed || controlRoot.hovered)) { model = "/highlight" } else if(!controlRoot.enabled) model = "/disenable" else if(controlRoot.enabled) model = "/normal" if(model == "/highlight" && !controlRoot.enabled) model = "/highDisbale" let s = iconName var lastS =pf.endString(s, "/"); if(lastS === "disenable" || lastS === "highlight" || lastS === "normal" || lastS === "highDisbale") model = ""; //var prefix = /^image:///imageProvider///i; var prefixStr = "image://imageProvider/"; // var qrcStr = "qrc:/"; // console.log("start width...", s.slice(0, 5), s.slice(0, prefixStr.length)) if(s.slice(0, 5) === "qrc:/" || s.slice(0, 5) === "file:") { return prefixStr + s + model; } if(s.slice(0, prefixStr.length).toLowerCase() === prefixStr.toLowerCase()){ prefixStr = ""; } // console.log("buttoniconlabel...", prefixStr + s + model) return prefixStr + s + model; } function kyIconSource(controlRoot) { let s = controlRoot.icon.source.toString(); if(s === "") s = controlRoot.icon.name.toString(); return s } function getDTColor(dtColor){ return pf.getDtColor(dtColor); } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/qmldir0000664000175000017500000000030015154306201024566 0ustar fengfeng singleton MobileTextActionsToolBar 1.0 MobileTextActionsToolBar.qml DefaultListItemBackground 1.0 DefaultListItemBackground.qml MobileCursor 1.0 MobileCursor.qml FocusRect 1.0 FocusRect.qml qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/FocusRect.qml0000664000175000017500000000316415154306201025776 0ustar fengfeng/* * Copyright 2018 Kai Uwe Broulik * Copyright 2017 The Qt Company Ltd. * * 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. */ import QtQuick 6.2 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate StylePrivate.StyleItem { elementType: "focusrect" // those random numbers come from QQC1 desktop style anchors { top: parent.top bottom: parent.bottom topMargin: parent.topPadding - 1 bottomMargin: parent.bottomPadding - 1 } // this is explicitly not using left anchor for auto mirroring // since the label's leftPadding/rightPadding already accounts for that x: parent.leftPadding - 2 width: parent.implicitWidth - parent.leftPadding - parent.rightPadding + 3 visible: control.activeFocus } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/MobileCursor.qml0000664000175000017500000000531015154306201026501 0ustar fengfeng/* * Copyright (C) 2018 by Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ import QtQuick 6.2 import org.kde.kirigami 2.5 as Kirigami Item { id: root width: 1 //<-important that this is actually a single device pixel height: Kirigami.Units.gridUnit property Item target property bool selectionStartHandle: false visible: Kirigami.Settings.tabletMode && ((target.activeFocus && !selectionStartHandle) || target.selectedText.length > 0) Rectangle { width: Math.round(Kirigami.Units.devicePixelRatio * 3) anchors { horizontalCenter: parent.horizontalCenter top: parent.top bottom: parent.bottom } color: Qt.tint(Kirigami.Theme.highlightColor, Qt.rgba(1,1,1,0.4)) radius: width Rectangle { width: Math.round(Kirigami.Units.gridUnit/1.5) height: width visible: MobileTextActionsToolBar.shouldBeVisible anchors { horizontalCenter: parent.horizontalCenter verticalCenter: parent.bottom } radius: width color: Qt.tint(Kirigami.Theme.highlightColor, Qt.rgba(1,1,1,0.4)) } MouseArea { anchors { fill: parent margins: -Kirigami.Units.gridUnit } preventStealing: true onPositionChanged: { var pos = mapToItem(target, mouse.x, mouse.y); pos = target.positionAt(pos.x, pos.y); if (target.selectedText.length > 0) { if (selectionStartHandle) { target.select(Math.min(pos, target.selectionEnd - 1), target.selectionEnd); } else { target.select(target.selectionStart, Math.max(pos, target.selectionStart + 1)); } } else { target.cursorPosition = pos; } } } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/RadiusRectangle.qml0000664000175000017500000000762715154306201027165 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ import QtQuick 6.2 // 替换原2.6,版本号同步Qt 6主版本 import QtQuick.Templates 6.2 as T // 替换原2.5,保留别名T(原有T.xxx写法无需修改) import QtQuick.Controls 6.2 // 替换原2.0,Qt 6中QQC2整合到该模块,无2.x区分 import org.ukui.qqc2style.private 1.0 as StylePrivate // 第三方模块版本不变(需确保适配Qt 6) 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 var borderColor property var backColor property int borderWidth property alias canvas : customButtonCanvas ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } Canvas { id: customButtonCanvas width: control.width height: control.height anchors.centerIn: parent onPaint: { var ctx = getContext("2d"); ctx.reset(); var gradient = ctx.createLinearGradient(customButtonCanvas.x, customButtonCanvas.y, customButtonCanvas.width, customButtonCanvas.height) gradient.addColorStop(0, getStartColor(backColor)); gradient.addColorStop(1, getEndColor(backColor)); // 填充颜色 ctx.fillStyle = gradient; // 开始绘制路径 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.clip(); ctx.fill(); // 绘制边框 // ctx.strokeStyle = getStartColor(borderColor); // ctx.lineWidth = borderWidth; // ctx.stroke(); } // 鼠标点击事件(模拟按钮点击) // MouseArea { // anchors.fill: parent // onClicked: { // canvas.requestPaint() // } // } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/WindowBack.qml0000664000175000017500000001371715160516153026144 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ import QtQuick 6.2 // QtQuick 升级为Qt 6版本(最低6.2,推荐6.5+) import Qt5Compat.GraphicalEffects 1.0 import QtQuick.Controls 6.2 as Controls // QQC2整合到QtQuick.Controls 6.x,保留别名Controls import QtQuick.Templates 6.2 as T // Templates同步Qt 6版本,保留别名T import QtQuick.Window 6.2 // QtQuick.Window 版本同步,Qt 6中无需用2.15 import org.ukui.qqc2style.private 1.0 as StylePrivate // 第三方模块版本不变(需确保该模块适配Qt 6) Window { id: popupwindow width: windowLabel.implicitWidth + 2 * tooltip.padding height: windowLabel.implicitHeight + 2 * tooltip.padding visible: controlRoot.visible color: "transparent" property T.ToolTip controlRoot property alias handle: popHandle // margins: tooltip.margins //padding: tooltip.padding // flags: Qt.NoFocus ParseInterface{ id: parseInterface } StylePrivate.APPParameter{ id: appP } StylePrivate.UKUIToolTip{ id: tooltip } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } function setControlRoot(control){ controlRoot = control } onVisibleChanged: { if(visible){ var p = popHandle.posByCursor(popupwindow.width, popupwindow.height) if(popupwindow.x !== p.x) popupwindow.x = p.x if(popupwindow.y !== p.y) popupwindow.y = p.y } } StylePrivate.PopupHandle{ id: popHandle blur: true titlebarVisible: false anchors.fill: parent posFollwMouse: true visible: parent.visible radius: tooltip.radius windowStaysOnTopHint: true } Rectangle{ id: rec visible: parent.visible anchors.fill: parent // radius: tooltip.radius color: { var baccolor = getStartColor(isTransaprent ? tooltip.backTransparentColor : tooltip.backColor) return Qt.rgba(baccolor.r, baccolor.g, baccolor.b, (controlRoot ? controlRoot._opacity: 1.0)) } // border.color: getStartColor(isTransaprent ? tooltip.backBorderTransparentColor : tooltip.backBorderColor) // border.width: 1 } Controls.Label { id: windowLabel anchors.fill: rec anchors.leftMargin: tooltip.padding anchors.rightMargin: tooltip.padding anchors.topMargin: tooltip.padding anchors.bottomMargin: tooltip.padding anchors.centerIn: rec visible: rec.visible text: controlRoot ? controlRoot.text : "" wrapMode: controlRoot ? controlRoot.mode : Text.NoWrap font: controlRoot ? controlRoot.font : appP.font color: getStartColor(tooltip.textColor) textFormat: controlRoot ? controlRoot._textFormat : Qt.PlainText onTextChanged: { if(controlRoot) { controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) if(controlRoot._maxWidth != 0) if((windowLabel.implicitWidth + + 2 * tooltip.padding) < controlRoot._maxWidth) popupwindow.width = windowLabel.implicitWidth + + 2 * tooltip.padding else popupwindow.width = controlRoot._maxWidth // console.log("textchangeddd 111", popupwindow.width ) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) } } onContentWidthChanged: { if(controlRoot){ controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) if(controlRoot._maxWidth != 0 && (windowLabel.implicitWidth + + 2 * tooltip.padding) < controlRoot._maxWidth){ popupwindow.width = windowLabel.implicitWidth + + 2 * tooltip.padding } } } onContentHeightChanged: { if(controlRoot){ controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) } } Component.onCompleted: { if(controlRoot){ controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) } } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/NormalControlColor.qml0000664000175000017500000000756015154306201027675 0ustar fengfengimport QtQuick 6.2 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) //// } // } // StylePrivate.ParseColorInterface{ // id:pDTColor // } // StylePrivate.UKUIButton{ // id:uBtn // } property color controlStartColor// : StylePrivate.UKUIButton.normalBC property color controlEndColor: controlStartColor property color borderColor ParseInterface{ id: parseInterface } function changeColor(highlighted, enable, click, hover, focus){ var closeBtn = false; var windowBtn = false; var importBtn = false; if(controlRoot.hasOwnProperty("buttonType")){ closeBtn = (controlRoot.buttonType === "closeButton"); windowBtn = (controlRoot.buttonType === "windowButton"); importBtn = (controlRoot.buttonType === "importButton"); } if(highlighted || importBtn){ controlStartColor = !enable ? parseInterface.pStartColor(StylePrivate.UKUIButton.disableHBC) : click ? parseInterface.pStartColor(StylePrivate.UKUIButton.clickedHBC) : hover ? parseInterface.pStartColor(StylePrivate.UKUIButton.hoveredHBC) : parseInterface.pStartColor(StylePrivate.UKUIButton.normalHBC) controlEndColor = !enable ? parseInterface.pEndColor(StylePrivate.UKUIButton.disableHBC) : click ? parseInterface.pEndColor(StylePrivate.UKUIButton.clickedHBC) : hover ? parseInterface.pEndColor(StylePrivate.UKUIButton.hoveredHBC) : parseInterface.pEndColor(StylePrivate.UKUIButton.normalHBC) borderColor = !enable ? parseInterface.pStartColor(StylePrivate.UKUIButton.disableBorderHColor) : focus ? parseInterface.pStartColor(StylePrivate.UKUIButton.focusBorderColor) : click ? parseInterface.pStartColor(StylePrivate.UKUIButton.clickBorderHColor) : hover ? parseInterface.pStartColor(StylePrivate.UKUIButton.hoverBorderHColor) : parseInterface.pStartColor(StylePrivate.UKUIButton.normalBorderHColor) } else{ controlStartColor = !enable ? parseInterface.pStartColor(StylePrivate.UKUIButton.disableBC) : click ? parseInterface.pStartColor(StylePrivate.UKUIButton.clickedBC) : hover ? parseInterface.pStartColor(StylePrivate.UKUIButton.hoveredBC) : parseInterface.pStartColor(StylePrivate.UKUIButton.normalBC) controlEndColor = !enable ? parseInterface.pEndColor(StylePrivate.UKUIButton.disableBC) : click ? parseInterface.pEndColor(StylePrivate.UKUIButton.clickedBC) : hover ? parseInterface.pEndColor(StylePrivate.UKUIButton.hoveredBC) : parseInterface.pEndColor(StylePrivate.UKUIButton.normalBC) borderColor = !enable ? parseInterface.pStartColor(StylePrivate.UKUIButton.disableBorderColor) : focus ? parseInterface.pStartColor(StylePrivate.UKUIButton.focusBorderColor) : click ? parseInterface.pStartColor(StylePrivate.UKUIButton.clickBorderColor) : hover ? parseInterface.pStartColor(StylePrivate.UKUIButton.hoverBorderColor) : parseInterface.pStartColor(StylePrivate.UKUIButton.normalBorderColor) } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/IconLabelContent.qml0000664000175000017500000002456415154306201027273 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ import QtQuick 6.2 import QtQuick.Templates 6.2 as T import QtQuick.Layouts 6.2 import QtQuick.Controls 6.2 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 textColor: labelColor() property var space: { if(controlRoot.display === AbstractButton.TextOnly || controlRoot.display === AbstractButton.IconOnly) return 0 return (label.text != "" && imageVisible) ? btn.space : 0 } ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } function adjustWidth(margin){//margin表示边距 if(controlRoot.display !== AbstractButton.TextUnderIcon){ var textwidth = (label.text !== "" && controlRoot.display !== AbstractButton.IconOnly) ? label.implicitWidth : 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) return textwidth + imagewidth + space + margin + leftSpace } var textwidth1 = label1.text != "" ? label1.implicitWidth : 0 var imagewidth1 = imageVisible ? 0 : image1.implicitWidth return 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) return textheight + space + margin, imageheight + space + margin } var textheight1 = label1.text != "" ? label1.height : 0 var imageheight1 = !imageVisible ? 0 : image1.height var h = textheight1 + imageheight1 + space + margin // console.log("heigh0000000000....", controlRoot.text, textheight1, imageheight1, h, space, margin) return h } function labelColor(){ var closeBtn = false; var windowBtn = false; var importBtn = false; if(controlRoot.hasOwnProperty("buttonType")){ closeBtn = (controlRoot.buttonType === "closeButton"); windowBtn = (controlRoot.buttonType === "windowButton"); importBtn = (controlRoot.buttonType === "importButton"); } if(windowBtn){ // if(controlRoot.pressed) // labelColor = appP.highlightedTextColor // else if(controlRoot.hovered) // labelColor = appP.brightTextColor // else return (controlRoot.enabled ? btn.normalTextColor : btn.disableTextColor) } else if(closeBtn &&(controlRoot.pressed || controlRoot.hovered)){ return btn.highlightTextColor; } else if(importBtn){ if(controlRoot.flat) return (controlRoot.enabled ? btn.normalTextColor : btn.disableTextColor) else return (controlRoot.enabled ? btn.highlightTextColor : btn.highlightTextDisableColor) } else{ return (controlRoot.enabled ? btn.normalTextColor : btn.disableTextColor) } } function iconSource() { return parseInterface.iconSource(controlRoot) } property var iconWidth: 16 property var iconHeight: 16 StylePrivate.UKUIButton{ id: btn } StylePrivate.APPParameter{ id: appP onFontChanged:{ // controlRoot.width = adjustWidth(2 * btn.leftRightMargin) // controlRoot.height = adjustHeight(2 * btn.upDownMargin) } onIconThemeChanged: { image.source = "" image.source = iconSource() image1.source = "" image1.source = iconSource() } onParametryChanged: { image.source = iconSource() image1.source = iconSource() } } // 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: { return leftSpace; } anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter Image { id: image source: iconSource()//controlRoot.icon.source anchors.verticalCenter: parent.verticalCenter sourceSize.width: (controlRoot.display !== AbstractButton.TextOnly && source !== "") ? iconWidth : 0 sourceSize.height: (controlRoot.display !== AbstractButton.TextOnly && source !== "") ? iconHeight : 0 visible: controlRoot.display !== AbstractButton.TextOnly && source !== "" && status != Image.Null cache: false } Text { id:label text: controlRoot.text font: controlRoot.font color: getStartColor(textColor) visible: controlRoot.display !== AbstractButton.IconOnly && text !== "" elide: Text.ElideRight anchors.verticalCenter: parent.verticalCenter anchors.left: image.right anchors.leftMargin: (image.visible && image.status !== Image.Null) ? labelSpace : 0 anchors.right: parent.right } } 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); if(controlRoot.display !== AbstractButton.TextBesideIcon) return Math.max(textwidth1, imagewidth1) return textwidth1 + imagewidth1 + space } implicitHeight: { var textheight1 = label1.text != "" ? label1.height : 0 var imageheight1 = controlRoot.icon.source === "" ? 0 : image1.height if(display === AbstractButton.TextUnderIcon) return textheight1 + imageheight1 + space return Math.max(textheight1, imageheight1); } anchors.centerIn: parent Image { id: image1 source: iconSource()//controlRoot.icon.source anchors.horizontalCenter: parent.horizontalCenter sourceSize.width: (controlRoot.display !== AbstractButton.TextOnly && source !== "") ? iconWidth : 0 sourceSize.height: (controlRoot.display !== AbstractButton.TextOnly && source !== "") ? iconHeight : 0 visible: controlRoot.display !== AbstractButton.TextOnly && source !== "" /*&& status != Image.Null*/ cache: false } Text { id:label1 text: controlRoot.text font:controlRoot.font color: getStartColor(textColor) visible: controlRoot.display !== AbstractButton.IconOnly && text !== "" anchors.horizontalCenter: parent.horizontalCenter anchors.top: image1.bottom anchors.topMargin: space } } Component.onCompleted: { if(controlRoot.icon.width > 0 ) iconWidth = controlRoot.icon.width if(controlRoot.icon.height > 0 ) iconHeight = controlRoot.icon.height implicitWidth = adjustWidth(0); implicitHeight = adjustHeight(0); } onVisibleChanged: { implicitWidth = adjustWidth(0); implicitHeight = adjustHeight(0); } Connections { target: controlRoot // function onEnabledChanged(){ // image.source = iconSource() // image1.source = iconSource() // } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/ButtonIconLabelContent.qml0000664000175000017500000004220515154306201030457 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ import QtQuick 6.2 import QtQuick.Templates 6.2 as T import QtQuick.Layouts 6.2 import QtQuick.Controls 6.2 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: 4 // 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 } property var iconWidth: controlRoot.icon.width > 0 ? controlRoot.icon.width : 16 property var iconHeight: controlRoot.icon.height > 0 ? controlRoot.icon.height : 16 property var menuRightSpace: 0 property var menuLeftSpace: 10 onImageVisibleChanged: { adjust() } ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } function adjustWidth(margin){//margin表示边距 var menuImageWidth = menuImage.visible ? (menuImage.sourceSize.width + menuRightSpace + menuLeftSpace) : 0 if(controlRoot.display !== AbstractButton.TextUnderIcon){ var textwidth = (label.text !== "" && controlRoot.display !== AbstractButton.IconOnly) ? label.width : 0 var imagewidth = (!imageVisible) ? 0 : image.sourceSize.width if(controlRoot.display === AbstractButton.IconOnly || label.text === "") return imagewidth + margin + menuImageWidth; if(controlRoot.display !== AbstractButton.TextBesideIcon) return Math.max(textwidth + margin + menuImageWidth, imagewidth + margin + menuImageWidth, normalWidth) return Math.max(normalWidth, textwidth + imagewidth + space + margin + menuImageWidth) } var textwidth1 = label1.text != "" ? label1.width : 0 var imagewidth1 = imageVisible ? 0 : image1.sourceSize.width return Math.max(normalWidth, textwidth1 + imagewidth1 + space + margin + menuImageWidth) } 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) return h } function labelColor(){ if(controlRoot.hasOwnProperty("disableLabelColor") && !controlRoot.enabled) return controlRoot.disableLabelColor else if(controlRoot.hasOwnProperty("clickedLabelColor") && controlRoot.enabled) return controlRoot.clickedLabelColor else if(controlRoot.hasOwnProperty("hoverLabelColor") && controlRoot.enabled) return controlRoot.hoverLabelColor else if(controlRoot.hasOwnProperty("normalLabelColor") && controlRoot.enabled) return controlRoot.normalLabelColor var closeBtn = false; var windowBtn = false; var importBtn = false; if(controlRoot.hasOwnProperty("buttonType")){ closeBtn = (controlRoot.buttonType === "closeButton" || controlRoot.buttonType === "windowTitleBarCloseButton"); windowBtn = (controlRoot.buttonType === "windowButton" || controlRoot.buttonType === "windowTitleBarWindowButton"); importBtn = (controlRoot.buttonType === "importButton"); } if(windowBtn){ // if(controlRoot.pressed) // labelColor = appP.highlightedTextColor // else if(controlRoot.hovered) // labelColor = appP.brightTextColor // else return (controlRoot.enabled ? btn.normalTextColor : btn.disableTextColor) } else if(closeBtn &&(controlRoot.pressed || controlRoot.hovered)){ return btn.highlightTextColor; } else if(importBtn || controlRoot.highlighted){ if(controlRoot.flat) return (controlRoot.enabled ? (controlRoot.pressed || controlRoot.hovered) ? btn.highlightTextColor : btn.normalTextColor : btn.disableTextColor) else return (controlRoot.enabled ? btn.highlightTextColor : btn.highlightTextDisableColor) } else{ return (controlRoot.enabled ? btn.normalTextColor : btn.disableTextColor) } } function adjust() { root.implicitWidth = adjustWidth(0); root.implicitHeight = adjustHeight(0); controlRoot.implicitWidth = adjustWidth(2 * btn.leftRightMargin) controlRoot.implicitHeight = adjustHeight(2 * btn.upDownMargin) } StylePrivate.UKUIButton{ id: btn } StylePrivate.APPParameter{ id: appP onFontChanged:{ adjust() } onIconThemeChanged: { image.source = "" image.source = parseInterface.iconSource(controlRoot) image1.source = "" image1.source = parseInterface.iconSource(controlRoot) menuImage.source = "" menuImage.source = parseInterface.buttonIcon(controlRoot, "ukui-down-symbolic") menuImage1.source = "" menuImage1.source = parseInterface.buttonIcon(controlRoot, "ukui-down-symbolic") } onParametryChanged: { image.source = parseInterface.iconSource(controlRoot) image1.source = parseInterface.iconSource(controlRoot) menuImage.source = parseInterface.buttonIcon(controlRoot, "ukui-down-symbolic") menuImage1.source = parseInterface.buttonIcon(controlRoot, "ukui-down-symbolic") } } anchors.centerIn: controlRoot Item{ id:item visible: controlRoot.display !== AbstractButton.TextUnderIcon implicitWidth: { var menuImageWidth = menuImage.visible ? (menuImage.sourceSize.width + menuRightSpace + menuLeftSpace) : 0 var textwidth = (controlRoot.display !== AbstractButton.IconOnly && label.text !== "") ? label.width : 0 var imagewidth = imageVisible ? image.sourceSize.width : 0 if(controlRoot.display === AbstractButton.IconOnly || label.text === "") return imagewidth + menuImageWidth; if(controlRoot.display !== AbstractButton.TextBesideIcon) return Math.max(textwidth, imagewidth) + menuImageWidth; return Math.max( textwidth + imagewidth + space) + menuImageWidth; } 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: layout == "left" ? parent.left : undefined anchors.leftMargin: layout == "left" ? leftSpace : undefined anchors.horizontalCenter: layout !== "left" ? parent.horizontalCenter : undefined anchors.verticalCenter: parent.verticalCenter // StylePrivate.KyIcon{ // id: image // iconName: parseInterface.kyIconSource(controlRoot) // visible: controlRoot.display !== AbstractButton.TextOnly && iconName !== "" // width: (controlRoot.display !== AbstractButton.TextOnly && iconName !== "") ? iconWidth : 0 // height: (controlRoot.display !== AbstractButton.TextOnly && iconName !== "") ? iconHeight : 0 // anchors.verticalCenter: parent.verticalCenter // Rectangle{ // anchors.fill: parent // color: "#30000000" // } // } Image { id: image source: parseInterface.iconSource(controlRoot)//controlRoot.icon.source anchors.verticalCenter: parent.verticalCenter sourceSize.width: (controlRoot.display !== AbstractButton.TextOnly && parseInterface.iconSource(controlRoot) !== "") ? iconWidth : 0 sourceSize.height: (controlRoot.display !== AbstractButton.TextOnly && parseInterface.iconSource(controlRoot) !== "") ? iconHeight : 0 visible: controlRoot.display !== AbstractButton.TextOnly && source !== "" && status != Image.Null fillMode: Image.PreserveAspectFit cache: false onSourceChanged: { sourceSize.width = (controlRoot.display !== AbstractButton.TextOnly && source !== "") ? iconWidth : 0 sourceSize.height = (controlRoot.display !== AbstractButton.TextOnly && source !== "") ? iconHeight : 0 adjust() } Component.onCompleted: { source = parseInterface.iconSource(controlRoot) imageVisible = image.visible || image1.visible } } Text { id:label text: controlRoot.text font: controlRoot.font color: getStartColor(labelColor()) visible: controlRoot.display !== AbstractButton.IconOnly && text !== "" anchors.verticalCenter: parent.verticalCenter verticalAlignment: Text.AlignVCenter anchors.left: image.right anchors.leftMargin: (image.visible) ? labelSpace : 0 onTextChanged: { adjust() } onFontChanged: adjust() } Image { id: menuImage anchors.verticalCenter: parent.verticalCenter anchors.left: label.text != "" ? label.right : image.right anchors.leftMargin: menuLeftSpace sourceSize.width: iconWidth sourceSize.height: iconHeight fillMode: Image.PreserveAspectFit cache: false source: parseInterface.buttonIcon(controlRoot, "ukui-down-symbolic") visible: { if(controlRoot.hasOwnProperty("_menuToolButton")) return controlRoot._menuToolButton else return false } } } Item{ id:item1 visible: controlRoot.display === AbstractButton.TextUnderIcon implicitWidth: { var menuImageWidth = menuImage1.visible ? (menuImage1.sourceSize.width + menuRightSpace + menuLeftSpace) : 0 var textwidth1 = label1.text != "" ? label1.width : 0 var imagewidth1 = controlRoot.icon.source === "" ? 0 : image1.sourceSize.width if(controlRoot.display === AbstractButton.TextUnderIcon) return Math.max(textwidth1, imagewidth1, normalWidth) + menuImageWidth; if(controlRoot.display !== AbstractButton.TextBesideIcon) return Math.max(textwidth1, imagewidth1, normalWidth) + menuImageWidth return Math.max( textwidth1 + imagewidth1 + space, normalWidth) + menuImageWidth } 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: parseInterface.iconSource(controlRoot)//controlRoot.icon.source anchors.horizontalCenter: parent.horizontalCenter sourceSize.width: (controlRoot.display !== AbstractButton.TextOnly && source !== "") ? iconWidth : 0 sourceSize.height: (controlRoot.display !== AbstractButton.TextOnly && source !== "") ? iconHeight : 0 visible: controlRoot.display !== AbstractButton.TextOnly && source !== "" /*&& status != Image.Null*/ onSourceChanged: { sourceSize.width = (controlRoot.display !== AbstractButton.TextOnly && source !== "") ? iconWidth : 0 sourceSize.height = (controlRoot.display !== AbstractButton.TextOnly && source !== "") ? iconHeight : 0 adjust() } fillMode: Image.PreserveAspectFit cache: false Component.onCompleted: { source = parseInterface.iconSource(controlRoot) imageVisible = image.visible || image1.visible } } Text { id:label1 text: controlRoot.text font:controlRoot.font color: getStartColor(labelColor()) visible: controlRoot.display !== AbstractButton.IconOnly && text !== "" anchors.horizontalCenter: parent.horizontalCenter anchors.top: image1.bottom anchors.topMargin: space onTextChanged: { adjust() } onFontChanged: adjust() } Image { id: menuImage1 anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.rightMargin: menuRightSpace anchors.left: label1.right anchors.leftMargin: menuLeftSpace sourceSize.width: iconWidth sourceSize.height: iconHeight fillMode: Image.PreserveAspectFit cache: false source: parseInterface.buttonIcon(controlRoot, "ukui-down-symbolic") visible: { if(controlRoot.hasOwnProperty("_menuToolButton")) return controlRoot._menuToolButton else return false } } } Component.onCompleted: { // console.log("iconwidth:", iconWidth, iconHeight, controlRoot.icon.width, controlRoot.icon.height) if(controlRoot.icon.width > 0 && controlRoot.icon.width !== iconWidth){ iconWidth = controlRoot.icon.width } if(controlRoot.icon.height > 0 && controlRoot.icon.height !== iconHeight){ iconHeight = controlRoot.icon.height } adjust() } onVisibleChanged: { if(controlRoot.icon.width > 0 && controlRoot.icon.width !== iconWidth){ iconWidth = controlRoot.icon.width } if(controlRoot.icon.height > 0 && controlRoot.icon.height !== iconHeight){ iconHeight = controlRoot.icon.height } if(parseInterface.iconSource(controlRoot) != "") imageVisible = image.visible || image1.visible adjust() } Connections { target: controlRoot function onClicked() { updateImage() } function onHoveredChanged () { updateImage() } function onIconChanged(){ updateImage() } } function updateImage(){ if(controlRoot.icon.width > 0 && controlRoot.icon.width !== iconWidth){ iconWidth = controlRoot.icon.width } if(controlRoot.icon.height > 0 && controlRoot.icon.height !== iconHeight){ iconHeight = controlRoot.icon.height } image.source = parseInterface.iconSource(controlRoot) image1.source = parseInterface.iconSource(controlRoot) menuImage.source = parseInterface.buttonIcon(controlRoot, "ukui-down-symbolic") menuImage1.source = parseInterface.buttonIcon(controlRoot, "ukui-down-symbolic") if(parseInterface.iconSource(controlRoot) != "") imageVisible = image.visible || image1.visible } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/BackGroundRectangle.qml0000664000175000017500000003400115160516153027745 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ import QtQuick 6.2 import QtQuick.Templates 6.2 as T import QtQuick.Layouts 6.2 import QtQuick.Controls 6.2 import Qt5Compat.GraphicalEffects 1.0 import org.ukui.qqc2style.private 1.0 as StylePrivate Rectangle { id:root property T.AbstractButton controlRoot: root.parent property int _radius : 6 property bool useGradient: (controlStartColor !== controlEndColor) property color controlStartColor property color controlEndColor property color borderColor color: gradientRec.visible ? "transparent" :controlStartColor opacity: (controlRoot.flat && !controlRoot.pressed && !controlRoot.hovered) ? 0 : 1 radius: _radius // 可选:设置圆角半径 Rectangle { id: gradientRec anchors.fill: parent radius: _radius // 可选:设置圆角半径 gradient: Gradient { id:gradient GradientStop { position: 0.0; color: controlStartColor } GradientStop { position: 1.0; color: controlEndColor } } visible: useGradient } Rectangle{ anchors.fill: parent radius: parent.radius border.width: controlRoot.flat ? 0 : (controlRoot.focus ? btn.focusBorderWidth : btn.borderWidth) border.color: borderColor color: "transparent" } NormalControlColor{ id:ncColor } ParseInterface{ id: parseInterface } StylePrivate.UKUIButton { id: btn onParametryChanged:{ changeColor(controlRoot.highlighted, controlRoot.enabled, controlRoot.pressed, controlRoot.hovered, (app.focusEnable && controlRoot.focus)) //root.color = "red" root.update(); } //property alias lRMargin: leftRightMargin } StylePrivate.APPParameter{ id: app onParametryChanged:{ changeColor(controlRoot.highlighted, controlRoot.enabled, controlRoot.pressed, controlRoot.hovered, (app.focusEnable && controlRoot.focus)) //root.color = "blue" root.update(); } } function changeColor(highlighted, enable, click, hover, focus){ var closeBtn = false; var windowBtn = false; var importBtn = false; var transparent = true; if(controlRoot.hasOwnProperty("buttonType")){ closeBtn = (controlRoot.buttonType === "closeButton" || controlRoot.buttonType === "windowTitleBarCloseButton"); windowBtn = (controlRoot.buttonType === "windowButton" || controlRoot.buttonType === "windowTitleBarWindowButton"); importBtn = (controlRoot.buttonType === "importButton"); } if(controlRoot.hasOwnProperty("transparent")){ transparent = controlRoot.transparent; } if(highlighted || importBtn){ controlStartColor = !enable ? parseInterface.pStartColor(btn.disableHBC) : click ? parseInterface.pStartColor(btn.clickedHBC) : hover ? parseInterface.pStartColor(btn.hoveredHBC) : parseInterface.pStartColor(btn.normalHBC) controlEndColor = !enable ? parseInterface.pEndColor(btn.disableHBC) : click ? parseInterface.pEndColor(btn.clickedHBC) : hover ? parseInterface.pEndColor(btn.hoveredHBC) : parseInterface.pEndColor(btn.normalHBC) borderColor = !enable ? parseInterface.pStartColor(btn.disableBorderHColor) : focus ? parseInterface.pStartColor(btn.focusBorderColor) : click ? parseInterface.pStartColor(btn.clickBorderHColor) : hover ? parseInterface.pStartColor(btn.hoverBorderHColor) : parseInterface.pStartColor(btn.normalBorderHColor) } else if(closeBtn){ controlStartColor = !enable ? parseInterface.pStartColor(btn.disableCloseBC) : click ? parseInterface.pStartColor(btn.clickedCloseBC) : hover ? parseInterface.pStartColor(btn.hoveredCloseBC) : parseInterface.pStartColor(btn.normalCloseBC) controlEndColor = !enable ? parseInterface.pEndColor(btn.disableCloseBC) : click ? parseInterface.pEndColor(btn.clickedCloseBC) : hover ? parseInterface.pEndColor(btn.hoveredCloseBC) : parseInterface.pEndColor(btn.normalCloseBC) borderColor = !enable ? parseInterface.pStartColor(btn.disableBorderCloseColor) : click ? parseInterface.pStartColor(btn.clickBorderCloseColor) : focus ? parseInterface.pStartColor(btn.focusBorderColor) : hover ? parseInterface.pStartColor(btn.hoverBorderCloseColor) : parseInterface.pStartColor(btn.normalBorderCloseColor) } else if(windowBtn && !transparent){ controlStartColor = !enable ? parseInterface.pStartColor(btn.disableWindowBC) : click ? parseInterface.pStartColor(btn.clickedWindowBC) : hover ? parseInterface.pStartColor(btn.hoveredWindowBC) : parseInterface.pStartColor(btn.normalWindowBC) controlEndColor = !enable ? parseInterface.pEndColor(btn.disableWindowBC) : click ? parseInterface.pEndColor(btn.clickedWindowBC) : hover ? parseInterface.pEndColor(btn.hoveredWindowBC) : parseInterface.pEndColor(btn.normalWindowBC) borderColor = !enable ? parseInterface.pStartColor(btn.disableBorderWindowColor) : click ? parseInterface.pStartColor(btn.clickBorderWindowColor) : focus ? parseInterface.pStartColor(btn.focusBorderColor) : hover ? parseInterface.pStartColor(btn.hoverBorderWindowColor) : parseInterface.pStartColor(btn.normalBorderWindowColor) } else if(windowBtn && transparent){ controlStartColor = !enable ? parseInterface.pStartColor(btn.disableWindowTransparentBC) : click ? parseInterface.pStartColor(btn.clickedWindowTransparentBC) : hover ? parseInterface.pStartColor(btn.hoveredWindowTransparentBC) : parseInterface.pStartColor(btn.normalWindowTransparentBC) controlEndColor = !enable ? parseInterface.pEndColor(btn.disableWindowTransparentBC) : click ? parseInterface.pEndColor(btn.clickedWindowTransparentBC) : hover ? parseInterface.pEndColor(btn.hoveredWindowTransparentBC) : parseInterface.pEndColor(btn.normalWindowTransparentBC) borderColor = !enable ? parseInterface.pStartColor(btn.disableBorderWindowTransparentColor) : click ? parseInterface.pStartColor(btn.clickedBorderWindowTransparentColor) : focus ? parseInterface.pStartColor(btn.focusBorderColor) : hover ? parseInterface.pStartColor(btn.hoveredBorderWindowTransparentColor) : parseInterface.pStartColor(btn.normalBorderWindowTransparentColor) } else{ var disableStartColor = parseInterface.pStartColor(btn.disableBC); var disableEndColor = parseInterface.pEndColor(btn.disableBC); var clickStartColor = parseInterface.pStartColor(btn.clickedBC); var clickEndColor = parseInterface.pEndColor(btn.clickedBC); var normalStartColor = (controlRoot.flat ? "transparent" : parseInterface.pStartColor(btn.normalBC)); var normalEndColor = (controlRoot.flat ? "transparent" : parseInterface.pEndColor(btn.normalBC)); var hoverStartColor = parseInterface.pStartColor(btn.hoveredBC); var hoverEndColor = parseInterface.pEndColor(btn.hoveredBC); var disableBorderColor = parseInterface.pStartColor(btn.disableBorderColor); var focusBorderColor = parseInterface.pStartColor(btn.focusBorderColor ); var clickBorderColor = parseInterface.pStartColor(btn.clickBorderColor ); var hoverBorderColor = parseInterface.pStartColor(btn.hoverBorderColor ); var normalBorderColor = parseInterface.pStartColor(btn.normalBorderColor ); if(transparent){ disableStartColor = parseInterface.pStartColor(btn.disableTransparentBC); disableEndColor = parseInterface.pEndColor(btn.disableTransparentBC); clickStartColor = parseInterface.pStartColor(btn.clickedTransparentBC); clickEndColor = parseInterface.pEndColor(btn.clickedTransparentBC); normalStartColor = (controlRoot.flat ? "transparent" : parseInterface.pStartColor(btn.normalTransparentBC)); normalEndColor = (controlRoot.flat ? "transparent" : parseInterface.pEndColor(btn.normalTransparentBC)); hoverStartColor = parseInterface.pStartColor(btn.hoveredTransparentBC); hoverEndColor = parseInterface.pEndColor(btn.hoveredTransparentBC); disableBorderColor = parseInterface.pStartColor(btn.disableBorderTransparentBC); focusBorderColor = parseInterface.pStartColor(btn.focusBorderColor ); clickBorderColor = parseInterface.pStartColor(btn.clickedBorderTransparentBC ); hoverBorderColor = parseInterface.pStartColor(btn.hoveredBorderTransparentBC ); normalBorderColor = parseInterface.pStartColor(btn.normalBorderTransparentBC ); } if(controlRoot.hasOwnProperty("disableStartColor")) disableStartColor = controlRoot.disableStartColor if(controlRoot.hasOwnProperty("disableEndColor")) disableEndColor = controlRoot.disableEndColor if(controlRoot.hasOwnProperty("clickStartColor")) clickStartColor = controlRoot.clickStartColor if(controlRoot.hasOwnProperty("clickEndColor")) clickEndColor = controlRoot.clickEndColor if(controlRoot.hasOwnProperty("normalStartColor")) normalStartColor = controlRoot.normalStartColor if(controlRoot.hasOwnProperty("normalEndColor")) normalEndColor = controlRoot.normalEndColor if(controlRoot.hasOwnProperty("hoverStartColor")) hoverStartColor = controlRoot.hoverStartColor if(controlRoot.hasOwnProperty("hoverEndColor")) hoverEndColor = controlRoot.hoverEndColor if(controlRoot.hasOwnProperty("disableBorderColor")) disableBorderColor = controlRoot.disableBorderColor if(controlRoot.hasOwnProperty("focusBorderColor")) focusBorderColor = controlRoot.focusBorderColor if(controlRoot.hasOwnProperty("clickBorderColor")) clickBorderColor = controlRoot.clickBorderColor if(controlRoot.hasOwnProperty("hoverBorderColor")) hoverBorderColor = controlRoot.hoverBorderColor if(controlRoot.hasOwnProperty("normalBorderColor")) normalBorderColor = controlRoot.normalBorderColor controlStartColor = !enable ? disableStartColor : click ? clickStartColor : hover ? hoverStartColor : normalStartColor controlEndColor = !enable ? disableEndColor : click ? clickEndColor : hover ? hoverEndColor : normalEndColor borderColor = !enable ? disableBorderColor : focus ? focusBorderColor : click ? clickBorderColor : hover ? hoverBorderColor : normalBorderColor } } Component.onCompleted: { changeColor(controlRoot.highlighted, controlRoot.enabled, false, false, false); } Connections { target: controlRoot function onPressedChanged() { changeColor(controlRoot.highlighted, controlRoot.enabled, controlRoot.pressed, controlRoot.hovered, (app.focusEnable && controlRoot.focus)) } function onHoveredChanged() { // if(controlRoot.hovered) // grad.visible = true; // else // grad.visible = false; changeColor(controlRoot.highlighted, controlRoot.enabled, false, controlRoot.hovered, (app.focusEnable && controlRoot.focus)) } function onFocusChanged(){ changeColor(controlRoot.highlighted, controlRoot.enabled, controlRoot.pressed, controlRoot.hovered, (app.focusEnable && controlRoot.focus)) } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/MobileTextActionsToolBar.qml0000664000175000017500000000641615154306201030764 0ustar fengfeng/* * Copyright (C) 2018 by Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ pragma Singleton import QtQuick 6.2 import QtQuick.Layouts 6.2 import QtQuick.Window 6.2 import QtQuick.Controls 6.2 import org.kde.kirigami 2.5 as Kirigami Popup { id: root property Item controlRoot parent: controlRoot ? controlRoot.Window.contentItem : undefined modal: false focus: false closePolicy: Popup.NoAutoClose property bool shouldBeVisible: false x: { if (!controlRoot || !controlRoot.Window.contentItem) { return 0; } return Math.min(Math.max(0, controlRoot.mapToItem(root.parent, controlRoot.positionToRectangle(controlRoot.selectionStart).x, 0).x - root.width/2), controlRoot.Window.contentItem.width - root.width); } y: { if (!controlRoot || !controlRoot.Window.contentItem) { return 0; } var desiredY = controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionStart).y).y - root.height; if (desiredY >= 0) { return Math.min(desiredY, controlRoot.Window.contentItem.height - root.height); } else { return Math.min(Math.max(0, controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionEnd).y + Math.round(Kirigami.Units.gridUnit*1.5)).y), controlRoot.Window.contentItem.height - root.height); } } visible: controlRoot ? shouldBeVisible && Kirigami.Settings.tabletMode && (controlRoot.selectedText.length > 0 || controlRoot.canPaste) : false width: contentItem.implicitWidth + leftPadding + rightPadding contentItem: RowLayout { ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-cut" visible: controlRoot && controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) onClicked: { controlRoot.cut(); } } ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-copy" visible: controlRoot && controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) onClicked: { controlRoot.copy(); } } ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-paste" visible: controlRoot && controlRoot.canPaste onClicked: { controlRoot.paste(); } } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/private/DefaultListItemBackground.qml0000664000175000017500000000276415154306201031145 0ustar fengfeng/* * Copyright 2017 Marco Martin * Copyright 2017 The Qt Company Ltd. * * 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. */ import QtQuick 6.2 import org.kde.kirigami 2.4 as Kirigami Rectangle { id: background color: highlighted || (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor visible: controlRoot.ListView.view ? controlRoot.ListView.view.highlight === null : true Rectangle { anchors.fill: parent color: Kirigami.Theme.highlightColor opacity: controlRoot.hovered && !controlRoot.pressed ? 0.2 : 0 } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/Button.qml0000664000175000017500000000604315160516153023707 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:清理重复/冗余导入,统一升级为Qt6 LTS版本(6.2) // 移除:QtQuick.Controls 1.4(无用且Qt6已废弃1.x版本)、QtQuick 2.6(重复) import QtQuick 6.2 // 统一升级,替代原2.15/2.6 import QtQuick.Window 6.2 // 升级替代原2.12 import QtQuick.Layouts 6.2 // 升级替代原1.3(Qt6中Layouts版本同步6.x) import QtQuick.Controls 6.2 // 统一升级,替代原2.15(移除1.4) import Qt5Compat.GraphicalEffects 1.0 import QtQuick.Templates 6.2 as T // 升级替代原2.5 import org.ukui.qqc2style.private 1.0 as StylePrivate // 保留,需确认Qt6适配性 T.Button { id: controlRoot implicitWidth: { var contentwidth = implicitContentWidth + leftPadding + rightPadding return Math.max(implicitBackgroundWidth + leftInset + rightInset, contentwidth, btn.normalWidth) } implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding, btn.normalHeight) leftPadding: StylePrivate.UKUIButton.margin rightPadding: StylePrivate.UKUIButton.margin hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7? font: app.font palette: app.palette onEnabledChanged: { content.updateImage() } onPressedChanged: content.updateImage() property bool hasWindowActive: Qt.application.active onHasWindowActiveChanged:{ content.updateImage() } StylePrivate.UKUIButton{ id: btn // Component.onCompleted: console.log("UKUIButton 1122333", btn.normalHBC) } StylePrivate.APPParameter{ id: app } contentItem: ButtonIconLabelContent { id:content controlRoot: controlRoot anchors.centerIn: controlRoot //onWidthChanged: console.log(controlRoot.text, width) } background: BackGroundRectangle{ implicitHeight: controlRoot.implicitHeight implicitWidth: controlRoot.implicitWidth controlRoot: controlRoot _radius: btn.radius //Component.onCompleted: console.log("BackGroundRectangle radius", StylePrivate.UKUIButton.radius, StylePrivate.UKUIButton.normalBC) } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/TextField.qml0000664000175000017500000002135715154306200024322 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有impl模块 // import QtQuick.Controls.impl 2.12 import QtQuick.Templates 6.2 as T // 替代原2.12 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: textfield.leftRightPadding leftPadding: padding + 4 rightPadding: (cleanBtn.visible && eyeBtn.visible ? cleanBtn.width + eyeBtn.width + 8 : cleanBtn.visible ? cleanBtn.width + 8 : eyeBtn.visible ? eyeBtn.width + 8 : textfield.leftRightPadding) color: getStartColor(!control.enabled ? textfield.disableTextColor : textfield.normalTextColor) selectionColor: getStartColor(textfield.focusBorderColor) selectedTextColor: control.palette.highlightedText placeholderTextColor: getStartColor(!control.enabled ? textfield.placeHolderDisableTextColor : textfield.placeHolderNormalTextColor) verticalAlignment: TextInput.AlignVCenter font: app.font hoverEnabled: true selectByMouse: true palette: app.palette property var isPassMode:{ if(control.hasOwnProperty("passMode")) return control.passMode else return false } property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property var backColor: !control.enabled ? (isTransaprent ? textfield.disableTransparentBC : textfield.disableBC) : (control.activeFocus) ? (isTransaprent ? textfield.inputNormalTransparentBC : textfield.inputNormalBC) : click ? (isTransaprent ? textfield.clickedTransparentBC : textfield.clickedBC) : control.hovered ? (isTransaprent ? textfield.hoveredTransparentBC : textfield.hoveredBC) : (isTransaprent ? textfield.normalTransparentBC : textfield.normalBC) property var backBorderColor: !control.enabled ? textfield.disableBorderColor : (control.activeFocus) ? textfield.focusBorderColor : control.hovered ? textfield.hoverBorderColor : textfield.normalBorderColor // property bool hover: false property bool click: false property bool cleanVisible: false Component.onCompleted: { if(isPassMode) control.echoMode = TextInput.Password imageSource() } onEchoModeChanged: { // console.log("echomode changedee", control.echoMode) imageSource() } ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } PlaceholderText { id: placeholder x: control.leftPadding y: control.topPadding width: control.width - (control.leftPadding + control.rightPadding) height: control.height - (control.topPadding + control.bottomPadding) - (cleanBtn.visible && eyeBtn.visible ? cleanBtn.width + eyeBtn.width + 12 : cleanBtn.visible ? cleanBtn.width + 6 : eyeBtn.visible ? eyeBtn.width + 6 : 0) text: control.placeholderText font: control.font color: getStartColor(!control.enabled ? textfield.placeHolderDisableTextColor : textfield.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: textfield.radius implicitWidth: textfield.normalWidth implicitHeight: textfield.normalHeight color: gradientRec.visible ? "transparent" : getStartColor(backColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(backColor) } GradientStop { position: 1.0; color: getEndColor(backColor)} } visible: !parseInterface.isSolidPattern(backColor) } Rectangle{ anchors.fill: parent radius: parent.radius color: "transparent" border.width: (control.activeFocus) ? textfield.focusBorderWidth : textfield.borderWidth border.color: getStartColor(backBorderColor) } RoundButton{ id: cleanBtn width: 30 height: 30 anchors.right: eyeBtn.visible ? eyeBtn.left : parent.right anchors.verticalCenter: parent.verticalCenter anchors.rightMargin: eyeBtn.visible ? 0 : backrec.border.width flat: true visible: !control.readOnly && control.enabled && (control.text !== "") // icon.source: "window-close-symbolic" // onClicked: { // } onPressed: { control.clear() cleanVisible = false control.focus = true } } RoundButton{ id: eyeBtn // icon.source: "ukui-eye-hidden-symbolic" anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter anchors.rightMargin: (control.activeFocus) ? textfield.focusBorderWidth : textfield.borderWidth width: 30 height: 30 visible: control.enabled && isPassMode flat: true onPressed: { if(control.echoMode == TextInput.Normal) control.echoMode = TextInput.Password else control.echoMode = TextInput.Normal control.focus = true } } } StylePrivate.UKUITextFiled{ id: textfield } StylePrivate.APPParameter{ id: app onParametryChanged:{ eyeBtn.icon.source = "" cleanBtn.icon.source = "" imageSource(); } onIconThemeChanged: { eyeBtn.icon.source = "" cleanBtn.icon.source = "" imageSource(); } } onEnabledChanged: imageSource() function imageSource(){ // return "image://imageProvider/file:///usr/share/icons/ukui-icon-theme-default/scalable/actions/object-select-symbolic.svg/normal" var model = "normal" if(!control.enabled){ if(app.isDark) model = "highDisbale" else model = "disenable" } else if(app.isDark){ model = "highlight" } //console.log("control.echoMode...", control.echoMode === TextInput.Password) if(isPassMode){ if(control.echoMode === TextInput.Password) eyeBtn.icon.source = "ukui-eye-hidden-symbolic/" + model else eyeBtn.icon.source = "ukui-eye-display-symbolic/" + model } if(control.text !== "") cleanBtn.icon.source = "window-close-symbolic/" + model } onPressed: { click = true; } onTextChanged: { imageSource() if(control.text !== "") cleanVisible = true } onReleased: click = false } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/Switch.qml0000664000175000017500000002436315154306200023673 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.12 import QtQuick.Templates 6.2 as T // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块 // import QtQuick.Controls.impl 2.12 (已删除) import org.ukui.qqc2style.private 1.0 as StylePrivate T.Switch { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding, implicitIndicatorHeight + topPadding + bottomPadding) padding: ukuiSwitch.padding spacing: 6 hoverEnabled: true palette: app.palette font: app.font // 添加动画运行状态标志 property bool animationRunning: false property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property var normalColor:ukuiSwitch.normalColor property var tansparentNormalColor: ukuiSwitch.normalTransparentColor property var tansparentNormalCheckColor: ukuiSwitch.checkedNormalColor property var backColor: control.checked ? (!control.enabled ? ukuiSwitch.checkedDisableColor : control.pressed ? ukuiSwitch.checkedClickColor : // 动画运行时忽略hover状态 (animationRunning ? tansparentNormalCheckColor : control.hovered ? ukuiSwitch.checkedHoverColor : tansparentNormalCheckColor)) : (!control.enabled ? (isTransaprent ? ukuiSwitch.disableTransparentColor : ukuiSwitch.disableColor) : control.pressed ? (isTransaprent ? ukuiSwitch.clickTransparentColor : ukuiSwitch.clickColor) : // 动画运行时忽略hover状态 (animationRunning ? (isTransaprent ? tansparentNormalColor : normalColor) : control.hovered ? (isTransaprent ? ukuiSwitch.hoverTransparentColor : ukuiSwitch.hoverColor) : (isTransaprent ? tansparentNormalColor : normalColor)) ) property var borderColor: control.checked ? (!control.enabled ? ukuiSwitch.checkedDisableBorderColor : control.pressed ? ukuiSwitch.checkedClickBorderColor : // 动画运行时忽略hover状态 (animationRunning ? ukuiSwitch.checkedNormalBorderColor : control.hovered ? ukuiSwitch.checkedHoverBorderColor : ukuiSwitch.checkedNormalBorderColor)) : (!control.enabled ? (isTransaprent ? ukuiSwitch.disableTransparentBorderColor : ukuiSwitch.disableBorderColor) : control.pressed ? (isTransaprent ? ukuiSwitch.clickTransparentBorderColor : ukuiSwitch.clickBorderColor) : // 动画运行时忽略hover状态 (animationRunning ? (isTransaprent ? ukuiSwitch.normalTransparentBorderColor : ukuiSwitch.normalBorderColor) : control.hovered ? (isTransaprent ? ukuiSwitch.hoverTransparentBorderColor : ukuiSwitch.hoverBorderColor) : (isTransaprent ? ukuiSwitch.normalTransparentBorderColor : ukuiSwitch.normalBorderColor)) ) StylePrivate.UKUISwitch{ id: ukuiSwitch } StylePrivate.UKUILabel{ id: label } StylePrivate.APPParameter{ id: app } ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } indicator: Rectangle { implicitWidth: ukuiSwitch.recWidth implicitHeight: ukuiSwitch.recHeight 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: implicitHeight/2 color: gradientRec.visible ? "transparent" : getStartColor(backColor) ColorAnimation { id: tansparentColorAnim target: control property: "tansparentNormalCheckColor" from:ukuiSwitch.normalTransparentColor to: ukuiSwitch.checkedNormalColor duration: 200 easing.type: Easing.Linear running: false // 动画运行状态同步 onRunningChanged: { control.animationRunning = running; if (!running) control.update() } } ColorAnimation { id: tansparentColorReturnAnim target: control property: "tansparentNormalColor" from: ukuiSwitch.checkedNormalColor to: ukuiSwitch.normalTransparentColor duration: 200 easing.type: Easing.Linear running: false // 动画运行状态同步 onRunningChanged: { control.animationRunning = running; if (!running) control.update() } } ColorAnimation { id: normalColorAnim target: control property: "tansparentNormalCheckColor" from:ukuiSwitch.normalColor to: ukuiSwitch.checkedNormalColor duration: 200 easing.type: Easing.Linear running: false // 动画运行状态同步 onRunningChanged: { control.animationRunning = running; if (!running) control.update() } } ColorAnimation { id: normalColorReturnAnim target: control property: "normalColor" from: ukuiSwitch.checkedNormalColor to: ukuiSwitch.normalColor duration: 200 easing.type: Easing.Linear running: false // 动画运行状态同步 onRunningChanged: { control.animationRunning = running; if (!running) control.update() } } Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { id:gradient GradientStop { position: 0.0; color: getStartColor(backColor) } GradientStop { position: 1.0; color: getEndColor(backColor)} } visible: !parseInterface.isSolidPattern(backColor) } Rectangle{ anchors.fill: parent radius: parent.radius color: "transparent" border.color: getStartColor(borderColor) border.width: ukuiSwitch.borderWidth } Rectangle { x: Math.max(ukuiSwitch.indicatorLeftRightPadding, Math.min(parent.width - width - ukuiSwitch.indicatorLeftRightPadding, control.visualPosition * parent.width - (width / 2) - ukuiSwitch.indicatorLeftRightPadding)) anchors.verticalCenter: parent.verticalCenter width: ukuiSwitch.indicatorWidth height: ukuiSwitch.indicatorWidth radius: height/2 color: getStartColor(!control.enabled ? ukuiSwitch.disableIndicatorColor : ukuiSwitch.normalIndicatorColor) Behavior on x { enabled: !control.down NumberAnimation { duration: 260 easing.type: Easing.OutExpo } } } } contentItem: Text { 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: control.font color: parseInterface.pStartColor(enabled ? label.normalColor : label.disableColor) // color: control.palette.windowText } onCheckedChanged: { // 先停止所有可能正在运行的动画 tansparentColorAnim.stop() tansparentColorReturnAnim.stop() normalColorAnim.stop() normalColorReturnAnim.stop() // 根据开关状态和透明度属性选择对应的动画 if (checked) { // 开关打开状态 if (isTransaprent) { tansparentColorAnim.running = true } else { normalColorAnim.running = true } } else { // 开关关闭状态 if (isTransaprent) { tansparentColorReturnAnim.running = true } else { normalColorReturnAnim.running = true } } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/Menu.qml0000664000175000017500000004625615160516153023352 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改:统一升级所有Qt模块为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.7 import QtQuick.Window 6.2 // 替代原2.15 import QtQuick.Layouts 6.2 // 替代原1.2(Qt6中Layouts模块版本同步6.x) import Qt5Compat.GraphicalEffects 1.0 import QtQuick.Controls 6.2 // 替代原2.5 import QtQuick.Templates 6.2 as T // 替代原2.5 import org.ukui.qqc2style.private 1.0 as StylePrivate T.Menu { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding margins: 0 palette: app.palette property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property var _opacity:{ if(control.hasOwnProperty("backOpacity")) return control.backOpacity return app.menuTransparency } property var scrollbarWidth: 0 // leftPadding: menu.leftRightPadding // rightPadding: menu.leftRightPadding // topPadding: menu.topBottomPadding // bottomPadding: menu.topBottomPadding property var maxW: 0 onVisibleChanged: { if(visible) { if(parent){ console.log("maptoglobale...", parent.mapToGlobal(x, y), popupwindow.x, popupwindow.y) if( popupwindow.x !== parent.mapToGlobal(x, y).x) popupwindow.x = parent.mapToGlobal(x, y).x if( popupwindow.y !== parent.mapToGlobal(x, y).y) popupwindow.y = parent.mapToGlobal(x, y).y } } if( popupwindow.visible !== control.visible) popupwindow.visible = control.visible } onYChanged: { if(visible && parent) { // console.log("maptoglobale...", parent.mapToGlobal(x, y)) popupwindow.y = parent.mapToGlobal(x, y).y } } onXChanged: { if(visible && parent) { // console.log("maptoglobale...", parent.mapToGlobal(x, y)) popupwindow.x = parent.mapToGlobal(x, y).x } } onWidthChanged: { if(visible && control.width > 0 && control.width !== popupwindow.width) popupwindow.width = control.width } onHeightChanged: { if(visible && control.height > 0 && control.height !== popupwindow.height){ popupwindow.height = control.height } } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } background: Item{ StylePrivate.UKUIMenu{ id: menu } ParseInterface{ id: parseInterface } StylePrivate.APPParameter{ id: app } Window { id: popupwindow width: control1.implicitWidth height: control1.implicitHeight // blurControl: control // flags: Qt.ToolTip visible: control.visible color: "transparent" onWidthChanged: { var size = popHandle.getScreenSize(); var p = popHandle.getScreenPoint(); if(popupwindow.x + width >= size.width + p.x){ var _x = size.width + p.x - popupwindow.width if(_x > 0){ popupwindow.x = _x } } } onHeightChanged: { outScreen(); var size = popHandle.getScreenSize(); var p = popHandle.getScreenPoint(); if(popupwindow.y + height >= size.height + p.y){ var h = size.height + p.y - popupwindow.y if(h > 0){ height = h } } } StylePrivate.PopupHandle{ id: popHandle blur: true titlebarVisible: false anchors.fill: parent visible: parent.visible radius: menu.radius } onVisibleChanged: { if(visible){ if(control.width > 0 && control.width !== popupwindow.width) width = control.width if(control.height > 0 && control.height !== popupwindow.height) height = control.height if(width <= 0) width = 1 if(height <= 0) height = 1 } control1.visible = visible control.visible = visible } Component.onCompleted: { for(var i = 0; i < control.contentModel.count; i++) { control1.addItem(control.itemAt(i)); } } T.Menu { id: control1 visible: parent.visible palette: app.palette font: app.font margins: 0 leftPadding: menu.leftRightPadding rightPadding: menu.leftRightPadding topPadding: menu.topBottomPadding bottomPadding: menu.topBottomPadding contentData: control.contentData onImplicitWidthChanged: { implicitHeight = listview.contentHeight + topPadding + bottomPadding; popupwindow.width = implicitWidth } onImplicitHeightChanged: { implicitHeight = listview.contentHeight + topPadding + bottomPadding; popupwindow.height = implicitHeight } Component.onCompleted: { implicitHeight = listview.contentHeight + topPadding + bottomPadding; } onVisibleChanged: { popupwindow.visible = control1.visible menuItemChange() } Connections { target: control function onCountChanged(count) { if(control1 != null){ for(var j = 0; j < control.contentModel.count; j++) { control1.addItem(control.itemAt(j)); } menuItemChange() } } } delegate: MenuItem { id: menuitem Component.onCompleted: { if(control.hasOwnProperty("type") && menuitem.hasOwnProperty("type")){ menuitem.type = control.type } } } onCurrentIndexChanged: listview.currentIndex = currentIndex || 0 contentItem: ListView { id: listview implicitHeight: contentHeight model: control1.contentModel visible: parent.visible onImplicitHeightChanged: { control1.implicitHeight = listview.contentHeight + control1.topPadding + control1.bottomPadding } onVisibleChanged: { if(visible){ control1.implicitHeight = listview.contentHeight + control1.topPadding + control1.bottomPadding } } onContentHeightChanged: { implicitHeight = listview.contentHeight; control1.implicitHeight = listview.contentHeight + topPadding + bottomPadding; //console.log("listview content height changeddd", control.visible, control.height, listview.contentHeight) if(control.height > 0 && control.height < listview.contentHeight){ listview.clip = true scrollbar.visible = true vscrollbar.visible = true } } clip: outScreen() //Component.onCompleted: currentIndex = control1.currentIndex || 0 //todo why ApplicationWindow.window is null //currentIndex: control1.currentIndex || 0 keyNavigationEnabled: true keyNavigationWraps: true ScrollBar.vertical: ScrollBar {//会与menuitem重叠 所以宽度设为0 单独使背景里的scrollbar,在position改变时 listview滚动到下面的时候有点奇怪 id: vscrollbar active: visible visible: false width: 0 } property bool hasCheckables: false property bool hasIcons: false } Connections { target: control1.contentItem.contentItem function onChildrenChanged() { menuItemChange() } } background: Rectangle { id: backRec anchors.fill: parent radius: _opacity >= 1 ? menu.radius : 0 color: { if(gradientRec.visible) return "transparent" var baccolor = getStartColor(isTransaprent ? menu.normalTransparentBC : menu.normalBC) return Qt.rgba(baccolor.r, baccolor.g, baccolor.b, _opacity) } // border.color: getStartColor(isTransaprent ? menu.normalTransparentBorderColor : menu.normalBorderColor) // border.width: menu.border // layer.enabled: true // Component.onCompleted: console.log("menu back opacity...", opacity, menu.bcColorAlpha) ScrollBar { id: scrollbar active: visible orientation: Qt.Vertical visible: false anchors.top: parent.top anchors.topMargin: control1.topPadding anchors.right: parent.right height: listview.height position: listview.visibleArea.yPosition size: listview.visibleArea.heightRatio onPositionChanged: { if (active && listview.visibleArea.yPosition != position) { vscrollbar.position = position; } } onVisibleChanged:{ scrollbarWidth = scrollbar.width control1.implicitWidth = maxW + scrollbarWidth + control1.leftPadding + control1.rightPadding } } Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius // border.width: parent.border.width // border.color: parent.border.color gradient: Gradient { id:gradient GradientStop { position: 0.0; color: { var baccolor = getStartColor(isTransaprent ? menu.normalTransparentBC : menu.normalBC) return Qt.rgba(baccolor.r, baccolor.g, baccolor.b, _opacity) } } GradientStop { position: 1.0; color: { var baccolor = getEndColor(isTransaprent ? menu.normalTransparentBC : menu.normalBC) return Qt.rgba(baccolor.r, baccolor.g, baccolor.b, _opacity) } } } visible: !parseInterface.isSolidPattern(isTransaprent ? menu.normalTransparentBC : menu.normalBC) } } } } } delegate: MenuItem { } Shortcut{ sequence: "Escape" onActivated: control.visible = false } function menuItemChange() { var checkable = false; var hasChecked = false; var checkedHasImage = false var needIcon = false; var children = control1.contentItem.contentItem.children for (var i in children) { var child = control1.contentItem.contentItem.children[i]; if(child.checkable) hasChecked = true if (child.checkable && child.checked) { control1.contentItem.hasCheckables = true; checkable = true; if(child.icon.source.toString().trim() !== "" || child.icon.name.toString().trim() !== "") checkedHasImage = true } if ((child.icon && child.icon.name &&child.icon.name.toString().trim() !== "") || (child.icon && child.icon.source &&child.icon.source.toString().trim() !== "")) { control1.contentItem.hasIcons = true; needIcon = true; } } if(hasChecked){ for (var s in children) { if(!(children instanceof MenuSeparator)) { var childs = control1.contentItem.contentItem.children[s]; if(childs.hasOwnProperty("hasChecked")) childs.hasChecked = true } } } if(checkable){ for (var k in children) { if(!(children instanceof MenuSeparator)) { var childk = control1.contentItem.contentItem.children[k]; var hasImageStr = false if(childk && childk.icon && childk.icon.source && childk.icon.source.toString() !== "") hasImageStr = true if(!hasImageStr && childk && childk.icon && childk.icon.name && childk.icon.name.toString() !== "") hasImageStr = true var checked = childk.checkable && childk.checked if(childk.hasOwnProperty("itemLeftSpace")){ if(checked) childk.itemLeftSpace = 24 + childk.leftPadding; else{ if(checkedHasImage && !hasImageStr) childk.itemLeftSpace = 48 + childk.leftPadding; else if(checkedHasImage && hasImageStr) childk.itemLeftSpace = 24 + childk.leftPadding; else if(!checkedHasImage && !hasImageStr) childk.itemLeftSpace = 24 + childk.leftPadding; else if(!checkedHasImage && hasImageStr) childk.itemLeftSpace = childk.leftPadding; } } } } } else{ if(needIcon){ for (var j in control1.contentItem.contentItem.children) { var childj = control1.contentItem.contentItem.children[j]; var b = ((childj.icon && childj.icon.name && childj.icon.name.toString().trim() !== "") || (childj.icon && childj.icon.source && childj.icon.source.toString().trim() !== "")); if(childj.hasOwnProperty("itemLeftSpace")) childj.itemLeftSpace = childj.leftPadding + (b ? 0 : 24); } } else{ for (var m in control1.contentItem.contentItem.children) { var childm = control1.contentItem.contentItem.children[m]; if(childm.hasOwnProperty("itemLeftSpace")) childm.itemLeftSpace = 8//childm.leftPadding; } } } var maxWidth = 0; for (var l in control1.contentItem.contentItem.children) { if(!(control1.contentItem.contentItem.children[l] instanceof MenuSeparator)){ // if(control1.contentItem.contentItem.children[l].text) maxWidth = Math.max(maxWidth, control1.contentItem.contentItem.children[l].implicitWidth) } } for (var nn in control1.contentItem.contentItem.children) { if(!(control1.contentItem.contentItem.children[nn] instanceof MenuSeparator)){ control1.contentItem.contentItem.children[nn].implicitWidth = maxWidth; } } if(maxW === 0) maxW = maxWidth listview.implicitWidth = maxWidth; control1.implicitWidth = listview.implicitWidth + scrollbarWidth + control1.leftPadding + control1.rightPadding // console.log("children control1..", listview.implicitWidth, control1.implicitWidth , popupwindow.width) // control1.implicitWidth = Math.max(background ? background.implicitWidth : 0, // contentItem ? maxW + control1.leftPadding + control1.rightPadding : 0) } function outScreen(){ var size = popHandle.getScreenSize(); var p = popHandle.getScreenPoint(); if(popupwindow.y + popupwindow.height >= size.height + p.y){ var h = size.height + p.y - popupwindow.y if(h > 0){ listview.clip = true scrollbar.visible = true vscrollbar.visible = true return true } } if(popupwindow.x + popupwindow.width > size.width + p.x){ var x = size.width + p.x - popupwindow.width; if(x > 0) popupwindow.x = x; } return false } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/MenuSeparator.qml0000664000175000017500000000363715154306200025220 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块(该模块在Qt6中被彻底移除,且当前代码未使用其内容) // import QtQuick.Controls.impl 2.12 (已删除) import QtQuick.Templates 6.2 as T // 替代原2.12 import org.ukui.qqc2style.private 1.0 as StylePrivate T.MenuSeparator { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding) padding: 2 verticalPadding: padding + 4 contentItem: Rectangle { implicitWidth: 188 implicitHeight: 1 color: parseInterface.pStartColor(menuItem.menuSeparatorColor) } StylePrivate.UKUIMenuItem{ id: menuItem } ParseInterface{ id: parseInterface } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/ToolTip.qml0000664000175000017500000003125515160516153024031 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ import QtQuick 2.6 import Qt5Compat.GraphicalEffects 1.0 import QtQuick.Controls 2.5 as Controls import QtQuick.Templates 2.5 as T import QtQuick.Window 2.15 import org.ukui.qqc2style.private 1.0 as StylePrivate T.ToolTip { id: controlRoot palette: appP.palette font: appP.font x: parent ? Math.round((parent.width - implicitWidth) / 2) : 0 y: -implicitHeight - 3 // Always show the tooltip on top of everything else z: 999 implicitWidth: popupwindow.width // implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding margins: tooltip.margins padding: tooltip.padding // Timeout based on text length, from QTipLabel::restartExpireTimer timeout: 4000 delay: Qt.styleHints.mousePressAndHoldInterval property bool loaderSuc: false property bool showWindow: { if(controlRoot.hasOwnProperty("backOpacity") && controlRoot.backOpacity >= 1) return false return true;//appP.showToolTipWindow() } property var internalComponent: null property var _opacity:{ if(controlRoot.hasOwnProperty("backOpacity")) return controlRoot.backOpacity return appP.menuTransparency } property var mode:{ if(controlRoot.hasOwnProperty("wrapMode")){ //console.log("mode:", controlRoot.wrapMode) return controlRoot.wrapMode } return Text.NoWrap } property var _maxWidth:{ if(controlRoot.hasOwnProperty("maxWidth")) return controlRoot.maxWidth return 0 } property var _textFormat:{ if(controlRoot.hasOwnProperty("textFormat")) return controlRoot.textFormat return Qt.PlainText } closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent property var isTransaprent:{ if(controlRoot.hasOwnProperty("transparent")) return controlRoot.transparent else return true } ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } StylePrivate.APPParameter{ id: appP } StylePrivate.UKUIToolTip{ id: tooltip } onVisibleChanged: { if(visible){ var p = popHandle.posByCursor(popupwindow.width, popupwindow.height) if(popupwindow.x !== p.x || popupwindow.y !== p.y){ popupwindow.setGeometry(p.x, p.y, popupwindow.width, popupwindow.height) popupwindow.visible = false popupwindow.visible = true } } popupwindow.visible = controlRoot.visible } contentItem: Item{ Window { id: popupwindow width: Math.max(1, (controlRoot._maxWidth != 0 && controlRoot.text != "") ? Math.min(controlRoot._maxWidth, Math.ceil(windowLabel.implicitWidth) + 2 * tooltip.padding) : (Math.ceil(windowLabel.implicitWidth) + 2 * tooltip.padding)) height: Math.max(1, windowLabel.implicitHeight + 2 * tooltip.padding) visible: controlRoot.visible color: "transparent" onWidthChanged: { if(visible){ var p = popHandle.posByCursor(popupwindow.width, popupwindow.height) if(popupwindow.x !== p.x || popupwindow.y !== p.y){ popupwindow.setGeometry(p.x, p.y, popupwindow.width, popupwindow.height) } } } onHeightChanged: { if(visible){ var p = popHandle.posByCursor(popupwindow.width, popupwindow.height) if(popupwindow.x !== p.x || popupwindow.y !== p.y){ popupwindow.setGeometry(p.x, p.y, popupwindow.width, popupwindow.height) } } } StylePrivate.PopupHandle{ id: popHandle blur: true titlebarVisible: false anchors.fill: parent posFollwMouse: true visible: popupwindow.visible radius: tooltip.radius windowStaysOnTopHint: true } Rectangle{ id: rec visible: popupwindow.visible anchors.fill: parent // radius: tooltip.radius color: { var baccolor = getStartColor(isTransaprent ? tooltip.backTransparentColor : tooltip.backColor) return Qt.rgba(baccolor.r, baccolor.g, baccolor.b, (controlRoot ? controlRoot._opacity: 1.0)) } // border.color: getStartColor(isTransaprent ? tooltip.backBorderTransparentColor : tooltip.backBorderColor) // border.width: 1 } Text { id: windowLabel anchors.fill: rec anchors.leftMargin: tooltip.padding anchors.rightMargin: tooltip.padding anchors.topMargin: tooltip.padding anchors.bottomMargin: tooltip.padding anchors.centerIn: rec visible: popupwindow.visible text: controlRoot.text wrapMode: controlRoot ? controlRoot.mode : Text.NoWrap font: controlRoot ? controlRoot.font : appP.font color: getStartColor(tooltip.textColor) textFormat: controlRoot ? controlRoot._textFormat : Qt.PlainText onTextChanged: { if(controlRoot) { if(controlRoot._maxWidth !== 0) if((Math.ceil(windowLabel.implicitWidth) + + 2 * tooltip.padding) < controlRoot._maxWidth) popupwindow.width = Math.ceil(windowLabel.implicitWidth) + + 2 * tooltip.padding else popupwindow.width = controlRoot._maxWidth popupwindow.height = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) controlRoot.implicitWidth = Math.max(Math.ceil(windowLabel.implicitWidth) + 2 * tooltip.padding, 1) } } onContentWidthChanged: { if(controlRoot) { if(controlRoot._maxWidth !== 0) if((windowLabel.implicitWidth + + 2 * tooltip.padding) < controlRoot._maxWidth) popupwindow.width = windowLabel.implicitWidth + + 2 * tooltip.padding else popupwindow.width = controlRoot._maxWidth popupwindow.height = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) } } onContentHeightChanged: { if(controlRoot) { if(controlRoot._maxWidth !== 0) if((Math.ceil(windowLabel.implicitWidth) + + 2 * tooltip.padding) < controlRoot._maxWidth) popupwindow.width = Math.ceil(windowLabel.implicitWidth) + + 2 * tooltip.padding else popupwindow.width = controlRoot._maxWidth popupwindow.height = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) controlRoot.implicitWidth = Math.max(Math.ceil(windowLabel.implicitWidth) + 2 * tooltip.padding, 1) } } Component.onCompleted: { if(controlRoot) { if(controlRoot._maxWidth !== 0) if((Math.ceil(windowLabel.implicitWidth) + + 2 * tooltip.padding) < controlRoot._maxWidth) popupwindow.width = Math.ceil(windowLabel.implicitWidth) + + 2 * tooltip.padding else popupwindow.width = controlRoot._maxWidth popupwindow.height = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) controlRoot.implicitWidth = Math.max(Math.ceil(windowLabel.implicitWidth) + 2 * tooltip.padding, 1) } } } } } /* contentItem: Item{ anchors.fill: parent visible: !showWindow && controlRoot.visible Label { TextMetrics{ id: metrics font: windowLabel.font text: windowLabel.text //onTextChanged: console.log("width...", width) } visible: !showWindow && controlRoot.visible id: windowLabel anchors.leftMargin: tooltip.padding anchors.rightMargin: tooltip.padding anchors.topMargin: tooltip.padding anchors.bottomMargin: tooltip.padding anchors.fill: parent anchors.centerIn: parent text: controlRoot.text wrapMode: controlRoot.mode font: controlRoot.font color: getStartColor(tooltip.textColor) onVisibleChanged: console.log("visible changeeddd", visible, width, height) onTextChanged: { metrics.text = text controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) // console.log("textchangeddd",popupwindow.width , controlRoot.width, metrics.width + + 2 * tooltip.padding) if(controlRoot.width != 0) if((metrics.width + + 2 * tooltip.padding) < controlRoot.width) backRec.width = metrics.width + + 2 * tooltip.padding else backRec.width = controlRoot.width // console.log("textchangeddd 111", popupwindow.width ) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) //console.log("textchangedddd", controlRoot.implicitHeight, windowLabel.implicitHeight) } onWidthChanged: { if(controlRoot){ controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) if(controlRoot.width != 0 && (metrics.width + + 2 * tooltip.padding) < controlRoot.width){ backRec.width = metrics.width + + 2 * tooltip.padding } } } onHeightChanged: { if(controlRoot){ controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) } } Component.onCompleted: { console.log("windowwww lab", text, visible, !showWindow, controlRoot.visible) if(controlRoot){ controlRoot.implicitWidth = Math.max(windowLabel.implicitWidth + 2 * tooltip.padding, 1) controlRoot.implicitHeight = Math.max(windowLabel.implicitHeight+ 2 * tooltip.padding, 1) } } } } background: Rectangle{ id: backRec visible: !showWindow && controlRoot.visible anchors.fill: parent radius: tooltip.radius color: getStartColor(isTransaprent ? tooltip.backTransparentColor : tooltip.backColor) border.color: getStartColor(isTransaprent ? tooltip.backBorderTransparentColor : tooltip.backBorderColor) opacity: controlRoot._opacity border.width: 1 } */ } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/Slider.qml0000664000175000017500000004547715160516153023674 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.14 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块 // import QtQuick.Controls.impl 2.12 (已删除) import Qt5Compat.GraphicalEffects 1.0 import QtQuick.Templates 6.2 as T // 替代原2.12 // 核心修改3:Qt6中WheelHandler移至QtQuick.Input模块,需新增导入 import QtQuick.Input 6.2 import org.ukui.qqc2style.private 1.0 as StylePrivate T.Slider { id: control implicitWidth: control.horizontal ? (implicitBackgroundWidth + leftInset + rightInset) : Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitHandleWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, (touchSlider ? slider.touchHandleHeight : slider.handleHeight) + topPadding + bottomPadding) padding: slider.padding hoverEnabled: true palette: app.palette stepSize: 0.1 property var touchSlider : control.hasOwnProperty("sliderType") ? (control.sliderType === "touchSlider" ? true : false): false // property var handleColor: !control.enabled ? slider.disableHandleColor : handleClick ? slider.clickHandleColor : // handleHover ?slider.hoverHandleColor : slider.normalHandleColor // property var handleBorderColor: !control.enabled ? slider.disableHandleBorderColor : handleClick ? slider.clickHandleBorderColor : // handleHover ? slider.hoverHandleBorderColor : slider.normalHandleBorderColor // property bool handleClick: control.handle.pressed // property bool handleHover: control.handle.hovered ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } //opacity: control.enabled ? 1 : 0.45 handle: Item{ x: touchSlider ? (control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - slider.touchHandleWidth) : (control.availableWidth - width) / 2)) : (control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)) y: touchSlider ? (control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - 15))) : (control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))) // implicitWidth: touchSlider ? (control.horizontal ? (15 + control.visualPosition * (control.availableWidth - /*slider.touchHandleWidth*/15) < slider.touchHandleWidth ? // (15 + control.visualPosition * (control.availableWidth - /*slider.touchHandleWidth*/15)) : slider.touchHandleWidth) : slider.touchHandleHeight) : // ((pressed || hovered) ? slider.handleHoverHeight : slider.handleHeight) // implicitHeight: touchSlider ? (control.horizontal ? slider.touchHandleHeight : // (15 + (1-control.visualPosition) * (control.availableHeight - 15) < slider.touchHandleWidth ? // (15 + (1-control.visualPosition) * (control.availableHeight - 15)) : slider.touchHandleWidth)) : // ((pressed || hovered) ? slider.handleHoverHeight : slider.handleHeight) property real normalWidth: touchSlider ? (control.horizontal ? (15 + control.visualPosition * (control.availableWidth - 15) < slider.touchHandleWidth ? (15 + control.visualPosition * (control.availableWidth - 15)) : slider.touchHandleWidth) : slider.touchHandleHeight) : slider.handleHeight property real normalHeight: touchSlider ? (control.horizontal ? slider.touchHandleHeight : (15 + (1-control.visualPosition) * (control.availableHeight - 15) < slider.touchHandleWidth ? (15 + (1-control.visualPosition) * (control.availableHeight - 15)) : slider.touchHandleWidth)) : slider.handleHeight implicitWidth: normalWidth implicitHeight: normalHeight property bool hovered: handleRec.hovered || mouseArea.containsMouse MouseArea { id: mouseArea anchors.fill: parent hoverEnabled: true propagateComposedEvents: true onPressed: mouse.accepted = false } Rectangle{ anchors.fill: handleRec visible: !touchSlider && !control.enabled color: getStartColor(slider.touchHandleBaseColor) radius: handleRec.radius } Rectangle { id: handleRec opacity: control.enabled ? 1 : 0.45 anchors.fill: parent // x: touchSlider ? (control.leftPadding + (control.horizontal ? // control.visualPosition * (control.availableWidth - slider.touchHandleWidth) : (control.availableWidth - width) / 2)) : // (control.leftPadding + (control.horizontal ? // control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)) // y: touchSlider ? (control.topPadding + (control.horizontal ? // (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - 15))) : // (control.topPadding + (control.horizontal ? // (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))) // implicitWidth: touchSlider ? (control.horizontal ? (15 + control.visualPosition * (control.availableWidth - /*slider.touchHandleWidth*/15) < slider.touchHandleWidth ? // (15 + control.visualPosition * (control.availableWidth - /*slider.touchHandleWidth*/15)) : slider.touchHandleWidth) : slider.touchHandleHeight) : // ((pressed || hovered) ? slider.handleHoverHeight : slider.handleHeight) // implicitHeight: touchSlider ? (control.horizontal ? slider.touchHandleHeight : // (15 + (1-control.visualPosition) * (control.availableHeight - 15) < slider.touchHandleWidth ? // (15 + (1-control.visualPosition) * (control.availableHeight - 15)) : slider.touchHandleWidth)) : // ((pressed || hovered) ? slider.handleHoverHeight : slider.handleHeight) radius: touchSlider ? 20 : width / 2 color: touchSlider ? (gradientHandleRec.visible ? "transparent" : getStartColor(!control.enabled ? /*slider.disableGrooveColor*/"transparent" : slider.normalGrooveColor)) : (gradientHandleRec.visible ? "transparent" : getStartColor(!control.enabled ? slider.disableHandleColor : pressed ? slider.clickHandleColor : hovered ? slider.hoverHandleColor : slider.normalHandleColor)) border.width: touchSlider ? 0 : slider.handleBorderWidth border.color: getStartColor(!control.enabled ? slider.disableHandleBorderColor : pressed ? slider.clickHandleBorderColor : hovered ? slider.hoverHandleBorderColor : slider.normalHandleBorderColor) scale: 1.0 states: [ State { name: "HOVERED" when: !touchSlider && !control.pressed && control.hovered PropertyChanges { target: handleRec; scale: 1.125 } }, State { name: "PRESSED" when: !touchSlider && control.pressed PropertyChanges { target: handleRec scale: 1.0 border.width: slider.handleBorderWidth * 1.25 } } ] transitions: [ Transition { from: "*"; to: "HOVERED" reversible: true ParallelAnimation { NumberAnimation { property: "scale"; duration: 100; easing.type: Easing.InOutSine } } }, Transition { from: "*"; to: "PRESSED" reversible: true ParallelAnimation { NumberAnimation { property: "scale"; duration: 100; easing.type: Easing.InOutSine } NumberAnimation { property: "border.width"; duration: 100; easing.type: Easing.Linear } } } ] Rectangle{ id: gradientHandleRec anchors.fill: parent radius: parent.radius border.width: parent.border.width border.color: parent.border.color gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(!control.enabled ? slider.disableHandleColor : pressed ? slider.clickHandleColor : hovered ?slider.hoverHandleColor : slider.normalHandleColor) } GradientStop { position: 1.0; color: getEndColor(!control.enabled ? slider.disableHandleColor : pressed ? slider.clickHandleColor : hovered ?slider.hoverHandleColor : slider.normalHandleColor)} } visible: !parseInterface.isSolidPattern(!control.enabled ? slider.disableHandleColor : pressed ? slider.clickHandleColor : hovered ?slider.hoverHandleColor : slider.normalHandleColor) } Rectangle{ anchors.right: control.horizontal ? parent.right : undefined anchors.rightMargin: control.horizontal ? 6 : undefined anchors.horizontalCenter: control.horizontal ? undefined : parent.horizontalCenter anchors.top: control.horizontal ? undefined : parent.top anchors.topMargin: control.horizontal ? undefined : 6 anchors.verticalCenter: control.horizontal ? parent.verticalCenter : undefined visible: touchSlider width: control.horizontal ? 3 : 6 height: control.horizontal ? 6: 3 color: slider.touchHandleColor } } } background: Item{ id: item implicitWidth: control.horizontal ? (slider.normalWidth + (touchSlider ? 15 : 0)) : slider.normalHeight implicitHeight: control.horizontal ? slider.normalHeight : (slider.normalWidth + (touchSlider ? 0 : 24)) Rectangle { width: item.width height: item.height anchors.centerIn: parent //border.color: getStartColor(slider.focusBorderColor) //border.width: control.activeFocus ? slider.focusBorderWidth : 0 scale: control.horizontal && control.mirrored ? -1 : 1 color: "transparent" opacity: control.enabled ? 1: 0.45 Rectangle{ id: unGroove x: touchSlider ? (control.horizontal ? 0 : ((item.width - width) / 2)) : (control.horizontal ? handle.x + handle.width /2 : ((item.width - width) / 2)) y: touchSlider ? (control.horizontal ? ((item.height - height) / 2) : 0) : (control.horizontal ? ((item.height - height) / 2) : (0)) width: touchSlider ? (control.horizontal ? parent.width : slider.touchGrooveHeight) : (control.horizontal ? (item.width - handle.width/2 - handle.x) : slider.grooveHeight) height: touchSlider ? (control.horizontal ? slider.touchGrooveHeight : parent.height) : (control.horizontal ? slider.grooveHeight : (handle .y + handle.height / 2)) radius: touchSlider ? 20 : (control.horizontal ? height/2 : width/2) border.width: slider.grooveBorderWidth border.color: getStartColor(!control.enabled ? slider.disableUnGrooveBorderColor : slider.normalUnGrooveBorderColor) color: gradientUNGrooveRec.visible ? "transparent" : getStartColor(isTransaprent ? (!control.enabled ? slider.disableTransparentUnGrooveColor : slider.normalTransparentUnGrooveColor) : (!control.enabled ? slider.disableUnGrooveColor : slider.normalUnGrooveColor)) Rectangle{ id: gradientUNGrooveRec anchors.fill: parent radius: parent.radius border.width: parent.border.width border.color: parent.border.color gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(!control.enabled ? slider.disableUnGrooveColor : slider.normalUnGrooveColor) } GradientStop { position: 1.0; color: getEndColor(!control.enabled ? slider.disableUnGrooveColor : slider.normalUnGrooveColor)} } visible: !parseInterface.isSolidPattern(!control.enabled ? slider.disableUnGrooveColor : slider.normalUnGrooveColor) } } Rectangle{ id:groove width: touchSlider ? (control.horizontal ? handle.x + handle.width - x : slider.touchGrooveHeight) : (control.horizontal ? handle.x + handle.width : slider.grooveHeight) height: touchSlider ? (control.horizontal ? slider.touchGrooveHeight : (parent.height - handle.y)/*((control.position * parent.height) < slider.touchHandleWidth ? handle.height : (parent.height - handle.y))*/) : (control.horizontal ? slider.grooveHeight : (parent.height - handle.y - handle.height/2)) radius: touchSlider ? 20 : (control.horizontal ? height/2 : width/2) x: touchSlider ? (control.horizontal ? 0 : ((item.width - width) / 2)) : (control.horizontal ? 0 : ((item.width - width) / 2)) y: touchSlider ? (control.horizontal ? ((item.height - height) / 2) : handle.y) : (control.horizontal ? ((item.height - height) / 2) : (handle.y + handle.height/2)) border.width: slider.grooveBorderWidth border.color: getStartColor(!control.enabled ? slider.disableGrooveBorderColor : slider.normalGrooveBorderColor) color: gradientGrooveRec.visible ? "transparent" : getStartColor(!control.enabled ? slider.disableGrooveColor : slider.normalGrooveColor) Rectangle{ id: gradientGrooveRec anchors.fill: parent radius: parent.radius border.width: parent.border.width border.color: parent.border.color gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(!control.enabled ? slider.disableGrooveColor : slider.normalGrooveColor) } GradientStop { position: 1.0; color: getEndColor(!control.enabled ? slider.disableGrooveColor : slider.normalGrooveColor)} } visible: !parseInterface.isSolidPattern(!control.enabled ? slider.disableGrooveColor : slider.normalGrooveColor) } // Rectangle{ // anchors.right: parent.right // width: handle.width // height: handle.height // radius: handle.height/2 // } } // 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: slider.grooveHeight // height: slider.grooveHeight // radius: slider.grooveHeight / 2 // color: !control.enabled ? slider.disableHandleColor : slider.normalHandleColor // border.width: slider.handleBorderWidth // border.color: !control.enabled ? slider.disableHandleBorderColor : slider.normalHandleBorderColor // } } } StylePrivate.UKUISlider{ id: slider } StylePrivate.APPParameter{ id: app } onFocusChanged: console.log("slider focus changedddddddddddddddddddddddddddddddd", focus) Keys.onPressed: { switch(event.key){ case Qt.Key_PageUp: control.value = Math.min(control.value + 10 * control.stepSize, control.to) break; case Qt.Key_PageDown: control.value = Math.max(control.value - 10 * control.stepSize, control.from) break; case Qt.Key_Down: control.decrease() break; case Qt.Key_Up: control.increase() break; case Qt.Key_Home: control.value = control.from break; case Qt.Key_End: control.value = control.to break; } } WheelHandler{ onWheel: { var delta = event.angleDelta.y if(control.mirrored || event.inverted){ delta = -1 * delta; } if(delta > 0){ //var r = Math.floor(control.value + Math.random() * 10) control.value = Math.round(Math.min(control.value + 10 * Math.random() * delta/120, control.to)) } else if(delta < 0){ control.value = Math.round(Math.max(control.value + 10 * Math.random() * delta/120, control.from)) } } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/ApplicationWindow.qml0000664000175000017500000000321515154306200026056 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改:Qt5的2.12升级为Qt6的LTS版本(推荐6.2/6.5/6.8) import QtQuick 6.2 import QtQuick.Window 6.2 import QtQuick.Controls 6.2 // 核心修改:删除Qt6已移除的impl模块 // import QtQuick.Controls.impl 2.12 (已删除) import QtQuick.Templates 6.2 as T // UKUI私有模块版本号不变,需确保该模块已适配Qt6 import org.ukui.qqc2style.private 1.0 as StylePrivate T.ApplicationWindow { id: window color: app.windowColor palette: app.palette overlay.modal: Rectangle { color: Color.transparent(window.palette.shadow, 0.5) } overlay.modeless: Rectangle { color: Color.transparent(window.palette.shadow, 0.12) } StylePrivate.APPParameter{ id: app onParametryChanged: { window.update() } onPaletteChanged: { window.update() } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/CheckDelegate.qml0000664000175000017500000003602715154306200025102 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块版本为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.12 import QtQuick.Templates 6.2 as T // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有模块(当前代码未使用该模块任何内容) // import QtQuick.Controls.impl 2.12 (已删除) import org.ukui.qqc2style.private 1.0 as StylePrivate // 保留,需确认Qt6适配性 T.CheckDelegate { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + implicitIndicatorWidth + spacing + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding, implicitIndicatorHeight + topPadding + bottomPadding) padding: 6//checkbox.upDownMargin leftPadding: 6//checkbox.leftRightMargin icon.width: app.iconWidth icon.height: app.iconWidth icon.color: control.palette.text hoverEnabled: true font: app.font spacing: checkbox.space palette: app.palette property var normalColor:checkbox.normalIndicatorColor property var tansparentNormalColor: checkbox.normalTransparentIndicatorColor property var tansparentNormalCheckColor: checkbox.checked_normalIndicatorColor property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } // 新增:判断是否有动画正在运行(涵盖所有相关动画) property bool isAnimating: scaleAnim.running || opacityAnim.running || uncheckScaleAnim.running || uncheckOpacityAnim.running || tansparentColorReturnAnim.running || tansparentColorAnim.running || normalColorAnim.running || normalColorReturnAnim.running property var borderColor: control.checked || (control.tristate == true && control.checkState === Qt.PartiallyChecked)? (!control.enabled ? checkbox.checked_disableIndicatorBorderColor : control.pressed ? checkbox.checked_clickIndicatorBorderColor : (!isAnimating && control.hovered) ? checkbox.checked_hoverIndicatorBorderColor : checkbox.checked_normalIndicatorBorderColor) : (!control.enabled ? checkbox.disableIndicatorBorderColor : control.pressed ? checkbox.clickIndicatorBorderColor : (!isAnimating && control.hovered) ? checkbox.hoverIndicatorBorderColor : checkbox.normalIndicatorBorderColor) property var checkBoxColor: control.checked || (control.tristate == true && control.checkState === Qt.PartiallyChecked) ? (!control.enabled ? checkbox.checked_disableIndicatorColor : control.pressed ? checkbox.checked_clickIndicatorColor : (!isAnimating && control.hovered) ? checkbox.checked_hoverIndicatorColor : tansparentNormalCheckColor) : isTransaprent ? (!control.enabled ? checkbox.disableTransparentIndicatorColor : control.pressed ? checkbox.clickTransparentIndicatorColor : (!isAnimating && control.hovered) ? checkbox.hoverTransparentIndicatorColor : tansparentNormalColor) : (!control.enabled ? checkbox.disableIndicatorColor : control.pressed ? checkbox.clickIndicatorColor : (!isAnimating && control.hovered) ? checkbox.hoverIndicatorColor : normalColor) ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } StylePrivate.APPParameter{ id: app onParametryChanged:{ control.update(); } onIconThemeChanged: { image.source = "" image.source = iconSource() } } StylePrivate.UKUICheckBox{ id: checkbox } onWidthChanged: { indicator.update() contentItem.update() control.update() } // contentItem: IconLabel { // leftPadding: control.mirrored ? control.indicator.width + control.spacing : control.leftPadding // rightPadding: !control.mirrored ? control.indicator.width + control.spacing : control.rightPadding // //x: control.text ? (control.mirrored ? control.leftPadding :control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 // 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: app.font // color: getStartColor(control.enabled ? checkbox.normalTextColor : checkbox.disableTextColor) // Rectangle{ // anchors.fill: parent // color: "red" // } // } contentItem: IconLabelContent { id: iconLabel controlRoot: control anchors.left: control.left anchors.right: control.right anchors.leftMargin: control.mirrored ? control.indicator.width + control.spacing : control.leftPadding anchors.rightMargin: !control.mirrored ? control.indicator.width + control.spacing : control.rightPadding //leftSpace: control.mirrored ? control.indicator.width + control.spacing : control.leftPadding //x: 0// control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 //anchors.centerIn: control implicitWidth: iconLabel.adjustWidth(control.leftPadding + control.rightPadding) } // keep in sync with CheckDelegate.qml (shared CheckIndicator.qml was removed for performance reasons) indicator: Item{ implicitWidth: checkbox.indicatorWidth implicitHeight: checkbox.indicatorWidth x: control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : 0 y: control.topPadding + (control.availableHeight - height) / 2 Rectangle { anchors.fill: parent radius: checkbox.radius color: gradientRec.visible ? "transparent" : getStartColor(checkBoxColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { id:gradient GradientStop { position: 0.0; color: getStartColor(checkBoxColor) } GradientStop { position: 1.0; color: getEndColor(checkBoxColor)} } visible: !parseInterface.isSolidPattern(checkBoxColor) } Rectangle{ anchors.fill: parent radius: checkbox.radius border.width: checkbox.borderWidth border.color: getStartColor(borderColor) color: "transparent" } } Image { id: image anchors.centerIn: parent sourceSize.width: 16 sourceSize.height: 16 source: iconSource() visible: control.checkState === Qt.Checked || (control.checkState === Qt.Unchecked && uncheckScaleAnim.running) cache: false scale: 0.2 opacity: 0.0 transformOrigin: Item.Center } NumberAnimation { id: scaleAnim target: image property: "scale" from: 0.2 to: 1.0 duration: 240 easing.type: Easing.InOutCirc onRunningChanged: if (!running) control.update() } PropertyAnimation { id: opacityAnim target: image property: "opacity" from: 0.0 to: 1.0 duration: 100 easing.type: Easing.InOutQuart onRunningChanged: if (!running) control.update() } NumberAnimation { id: uncheckScaleAnim target: image property: "scale" from: 1.0 to: 0.2 duration: 240 easing.type: Easing.InOutCirc onRunningChanged: if (!running) control.update() } PropertyAnimation { id: uncheckOpacityAnim target: image property: "opacity" from: 1.0 to: 0.0 duration: 100 easing.type: Easing.InOutQuint onRunningChanged: if (!running) control.update() } Rectangle { anchors.centerIn: parent width: 9 height: 1 color: { getStartColor(!control.enabled ? checkbox.checked_disableChildrenColor : control.pressed ? checkbox.checked_clickChildrenColor: // 部分选中状态处理hover与动画的关系 (!isAnimating && control.hovered) ? checkbox.checked_hoverChildrenColor: checkbox.checked_normalChildrenColor) } visible: control.checkState === Qt.PartiallyChecked } } background: Item { anchors.fill: parent // visible: control.down || control.highlighted // color: control.down ? control.palette.midlight : control.palette.light } ColorAnimation { id: tansparentColorAnim target: control property: "tansparentNormalCheckColor" from:checkbox.normalTransparentIndicatorColor to: checkbox.checked_normalIndicatorColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: if (!running) control.update() } ColorAnimation { id: tansparentColorReturnAnim target: control property: "tansparentNormalColor" from: checkbox.checked_normalIndicatorColor to: checkbox.normalTransparentIndicatorColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: if (!running) control.update() } ColorAnimation { id: normalColorAnim target: control property: "normalColor" from:checkbox.normalIndicatorColor to: checkbox.checked_normalIndicatorColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: if (!running) control.update() } ColorAnimation { id: normalColorReturnAnim target: control property: "normalColor" from: checkbox.checked_normalIndicatorColor to: checkbox.normalIndicatorColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: if (!running) control.update() } onEnabledChanged: { image.source = iconSource(); control.update(); } property int prevCheckState: Qt.Unchecked Component.onCompleted: { prevCheckState = control.checkState; } onCheckStateChanged: { // console.log("状态转换:", prevCheckState, "→", control.checkState) if (prevCheckState === Qt.Unchecked && control.checkState === Qt.PartiallyChecked) { if(isTransaprent){ tansparentColorReturnAnim.stop(); tansparentColorAnim.start(); }else{ normalColorReturnAnim.stop(); normalColorAnim.start(); } scaleAnim.start(); opacityAnim.start(); } else if (prevCheckState === Qt.PartiallyChecked && control.checkState === Qt.Checked) { if(isTransaprent){ tansparentColorReturnAnim.stop(); tansparentColorAnim.stop(); tansparentNormalCheckColor = checkbox.checked_normalIndicatorColor; }else{ normalColorReturnAnim.stop(); normalColorAnim.stop(); normalColor = checkbox.checked_normalIndicatorColor; } scaleAnim.start(); opacityAnim.start(); } else if (prevCheckState === Qt.Checked && control.checkState === Qt.Unchecked) { if(isTransaprent){ tansparentColorAnim.stop(); tansparentColorReturnAnim.start(); }else{ normalColorAnim.stop(); normalColorReturnAnim.start(); } uncheckScaleAnim.start(); uncheckOpacityAnim.start(); } else if (prevCheckState === Qt.Unchecked && control.checkState === Qt.Checked) { if(isTransaprent){ tansparentColorReturnAnim.stop(); tansparentColorAnim.start(); }else{ normalColorReturnAnim.stop(); normalColorAnim.start(); } scaleAnim.start(); opacityAnim.start(); } prevCheckState = control.checkState; control.update(); } onCheckedChanged: { if (!control.tristate) { if (control.checked) { if(isTransaprent) tansparentColorAnim.start(); else normalColorAnim.start(); scaleAnim.start(); opacityAnim.start(); } else { if(isTransaprent) tansparentColorReturnAnim.start(); else normalColorReturnAnim.start(); uncheckScaleAnim.start(); uncheckOpacityAnim.start(); } } image.source = iconSource(); } function iconSource(){ // var model = (!control.enabled && control.checked) ? "highDisbale" : // !control.enabled ? "disenable" : // control.checked ? "highlight" : "normal" var model = "highlight" var icon = "object-select-symbolic"; if(!app.themeHasIcon(icon)) icon = "file:///usr/share/icons/ukui-icon-theme-default/scalable/actions/object-select-symbolic.svg" return "image://imageProvider/" + icon + "/" + model; } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/TabBar.qml0000664000175000017500000000451215154306200023557 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.12 import QtQuick.Templates 6.2 as T // 替代原2.12 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 palette: app.palette ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } 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 anchors.fill: control color: "transparent" } StylePrivate.UKUITabBar{ id: tabbar } StylePrivate.APPParameter{ id: app } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/RoundButton.qml0000664000175000017500000000432615154306200024712 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改:统一升级所有Qt模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.6 import QtQuick.Templates 6.2 as T // 替代原2.5 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, 36) } implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding, 36) leftPadding: StylePrivate.UKUIButton.margin rightPadding: StylePrivate.UKUIButton.margin hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7? font: app.font radius: height/2 palette: app.palette NormalControlColor{ id:ncColor } StylePrivate.APPParameter{ id: app } onEnabledChanged: { content.updateImage() } onPressedChanged: content.updateImage() contentItem: ButtonIconLabelContent { id: content controlRoot: controlRoot anchors.centerIn: controlRoot // onWidthChanged: console.log(controlRoot.text, width) } background: BackGroundRectangle{ controlRoot: controlRoot _radius: controlRoot.radius anchors.fill: parent } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/SwitchDelegate.qml0000664000175000017500000002363515154306200025327 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.12 import QtQuick.Templates 6.2 as T // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块 // import QtQuick.Controls.impl 2.12 (已删除) import org.ukui.qqc2style.private 1.0 as StylePrivate T.SwitchDelegate { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + implicitIndicatorWidth + spacing + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding, implicitIndicatorHeight + topPadding + bottomPadding) padding: ukuiSwitch.padding spacing: 8 hoverEnabled: true font: app.font palette: app.palette // 添加动画运行状态标志 property bool animationRunning: false // 动效相关颜色属性 property var normalColor: ukuiSwitch.normalColor property var tansparentNormalColor: ukuiSwitch.normalTransparentColor property var tansparentNormalCheckColor: ukuiSwitch.checkedNormalColor property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property var backColor: control.checked ? (!control.enabled ? ukuiSwitch.checkedDisableColor : control.pressed ? ukuiSwitch.checkedClickColor : // 动画运行时忽略hover (animationRunning ? tansparentNormalCheckColor : control.hovered ? ukuiSwitch.checkedHoverColor : tansparentNormalCheckColor)) : (!control.enabled ? (isTransaprent ? ukuiSwitch.disableTransparentColor : ukuiSwitch.disableColor) : control.pressed ? (isTransaprent ? ukuiSwitch.clickTransparentColor : ukuiSwitch.clickColor) : // 动画运行时忽略hover (animationRunning ? (isTransaprent ? tansparentNormalColor : normalColor) : control.hovered ? (isTransaprent ? ukuiSwitch.hoverTransparentColor : ukuiSwitch.hoverColor) : (isTransaprent ? tansparentNormalColor : normalColor)) ) property var borderColor: control.checked ? (!control.enabled ? ukuiSwitch.checkedDisableBorderColor : control.pressed ? ukuiSwitch.checkedClickBorderColor : // 动画运行时忽略hover (animationRunning ? ukuiSwitch.checkedNormalBorderColor : control.hovered ? ukuiSwitch.checkedHoverBorderColor : ukuiSwitch.checkedNormalBorderColor)) : (!control.enabled ? (isTransaprent ? ukuiSwitch.disableTransparentBorderColor : ukuiSwitch.disableBorderColor) : control.pressed ? (isTransaprent ? ukuiSwitch.clickTransparentBorderColor : ukuiSwitch.clickBorderColor) : // 动画运行时忽略hover (animationRunning ? (isTransaprent ? ukuiSwitch.normalTransparentBorderColor : ukuiSwitch.normalBorderColor) : control.hovered ? (isTransaprent ? ukuiSwitch.hoverTransparentBorderColor : ukuiSwitch.hoverBorderColor) : (isTransaprent ? ukuiSwitch.normalTransparentBorderColor : ukuiSwitch.normalBorderColor)) ) StylePrivate.UKUISwitch { id: ukuiSwitch } StylePrivate.UKUILabel { id: label } StylePrivate.APPParameter{ id: app } ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } indicator: Rectangle { implicitWidth: ukuiSwitch.recWidth implicitHeight: ukuiSwitch.recHeight x: control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 radius: implicitHeight/2 color: gradientRec.visible ? "transparent" : getStartColor(backColor) ColorAnimation { id: tansparentColorAnim target: control property: "tansparentNormalCheckColor" from: ukuiSwitch.normalTransparentColor to: ukuiSwitch.checkedNormalColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: { control.animationRunning = running; if (!running) control.update() } } ColorAnimation { id: tansparentColorReturnAnim target: control property: "tansparentNormalColor" from: ukuiSwitch.checkedNormalColor to: ukuiSwitch.normalTransparentColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: { control.animationRunning = running; if (!running) control.update() } } ColorAnimation { id: normalColorAnim target: control property: "tansparentNormalCheckColor" from: ukuiSwitch.normalColor to: ukuiSwitch.checkedNormalColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: { control.animationRunning = running; if (!running) control.update() } } ColorAnimation { id: normalColorReturnAnim target: control property: "normalColor" from: ukuiSwitch.checkedNormalColor to: ukuiSwitch.normalColor duration: 200 easing.type: Easing.Linear running: false onRunningChanged: { control.animationRunning = running; if (!running) control.update() } } Rectangle { id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(backColor) } GradientStop { position: 1.0; color: getEndColor(backColor) } } visible: !parseInterface.isSolidPattern(backColor) } Rectangle{ anchors.fill: parent radius: parent.radius color: "transparent" border.color: getStartColor(borderColor) border.width: ukuiSwitch.borderWidth } Rectangle { x: Math.max(ukuiSwitch.indicatorLeftRightPadding, Math.min(parent.width - width - ukuiSwitch.indicatorLeftRightPadding, control.visualPosition * parent.width - (width / 2) - ukuiSwitch.indicatorLeftRightPadding)) anchors.verticalCenter: parent.verticalCenter width: ukuiSwitch.indicatorWidth height: ukuiSwitch.indicatorWidth radius: height/2 color: getStartColor(!control.enabled ? ukuiSwitch.disableIndicatorColor : ukuiSwitch.normalIndicatorColor) Behavior on x { enabled: !control.down NumberAnimation { duration: 260 easing.type: Easing.OutExpo } } } } contentItem: IconLabelContent { id: iconLabel anchors.left: control.left anchors.right: control.right anchors.leftMargin: control.mirrored ? control.indicator.width + control.spacing : control.leftPadding anchors.rightMargin: !control.mirrored ? control.indicator.width + control.spacing : control.rightPadding controlRoot: control implicitWidth: iconLabel.adjustWidth(control.leftPadding + control.rightPadding) } background: Item { anchors.fill: parent } onCheckedChanged: { tansparentColorAnim.stop() tansparentColorReturnAnim.stop() normalColorAnim.stop() normalColorReturnAnim.stop() if (checked) { isTransaprent ? tansparentColorAnim.start() : normalColorAnim.start() } else { isTransaprent ? tansparentColorReturnAnim.start() : normalColorReturnAnim.start() } } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/Popup.qml0000664000175000017500000001035515160516153023540 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改:统一升级所有Qt模块为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.6 import Qt5Compat.GraphicalEffects 1.0 import QtQuick.Templates 6.2 as T // 替代原2.5 import org.ukui.qqc2style.private 1.0 as StylePrivate T.Popup { id: control palette: app.palette font: app.font implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0) contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) padding: popup.padding clip: false property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } // StylePrivate.APPParameter{ // id: appP // } // StylePrivate.UKUIPopup{ // id: popup // } // ParseInterface{ // id: parseInterface // } // function getStartColor(dtcolor) // { // return parseInterface.pStartColor(dtcolor) // } // function getEndColor(dtcolor) // { // return parseInterface.pEndColor(dtcolor) // } enter: Transition { NumberAnimation { property: "opacity" from: 0 to: 1 easing.type: Easing.InOutQuad duration: 250 } } exit: Transition { NumberAnimation { property: "opacity" from: 1 to: 0 easing.type: Easing.InOutQuad duration: 250 } } contentItem: Item { } background: Rectangle { radius: popup.radius color: gradientRec.visible ? "transparent" : StylePrivate.ParseColorInterface.startColor(isTransaprent ? popup.transparentBC : popup.backColor) border.color: StylePrivate.ParseColorInterface.startColor(isTransaprent ? popup.transparentBorderColor : popup.backBorderColor) layer.enabled: true Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius border.width: parent.border.width border.color: parent.border.color gradient: Gradient { id:gradient GradientStop { position: 0.0; color: StylePrivate.ParseColorInterface.startColor(isTransaprent ? popup.transparentBC : popup.backColor) } GradientStop { position: 1.0; color: StylePrivate.ParseColorInterface.endColor(isTransaprent ? popup.transparentBC : popup.backColor)} } visible: !StylePrivate.ParseColorInterface.isSolidPattern(isTransaprent ? popup.transparentBC : popup.backColor) } layer.effect: DropShadow { transparentBorder: true radius: popup.radius samples: 16 horizontalOffset: 0 verticalOffset: 0 width: background.width + 8 height: background.height + 8 color: StylePrivate.ParseColorInterface.startColor(popup.shadowColor) } } StylePrivate.UKUIPopup{ id: popup } StylePrivate.APPParameter{ id: app } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/TabButton.qml0000664000175000017500000001337315154306200024333 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.6 import QtQml.Models 6.2 // 替代原2.1(Qt6中该模块版本同步6.x) import QtQuick.Controls 6.2 // 替代原2.5 import org.ukui.qqc2style.private 1.0 as StylePrivate import QtQuick.Templates 6.2 as T // 替代原2.5 T.TabButton { id: controlRoot implicitWidth: { var contentwidth = buttonIconLabel.adjustWidth(0) + leftPadding + rightPadding return Math.max(implicitBackgroundWidth + leftInset + rightInset, contentwidth) } implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding) // leftPadding: btn.margin // rightPadding: btn.margin hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7? font: app.font palette: app.palette property var isTransaprent:{ if(controlRoot.hasOwnProperty("transparent")) return controlRoot.transparent else return true } property var backColor: controlRoot.checked ? (isTransaprent ? tabbutton.checkedTransparentColor : tabbutton.checkedColor) : controlRoot.pressed ? (isTransaprent ? tabbutton.clickedTransparentColor : tabbutton.clickedColor) : controlRoot.hovered ? (isTransaprent ? tabbutton.hoverTransparentColor : tabbutton.hoverColor) : (isTransaprent ? tabbutton.normalTransparentColor : tabbutton.normalColor) // property var backcolor: checked ? "blue" : pressed ? "green" : hovered ? "red" : "yellow" ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } contentItem: ButtonIconLabelContent { id: buttonIconLabel controlRoot: controlRoot anchors.centerIn: controlRoot layout: "left" leftSpace: 10 // labelColor: tabbutton.normalTextColor // onWidthChanged: console.log(controlRoot.text, width) } background: Canvas{ id: canvas anchors.fill: parent onPaint: { var radius = 12; var ctx = getContext("2d"); ctx.reset(); // 重置画布状态 var gradient = ctx.createLinearGradient(canvas.x, canvas.y, canvas.width, canvas.height) gradient.addColorStop(0, getStartColor(backColor)); gradient.addColorStop(1, getEndColor(backColor)); ctx.fillStyle = gradient; 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(); if(getStartColor(tabbutton.focusBorderColor).alpha >= 0.0 && app.focusEnable){ ctx.lineWidth = tabbutton.borderWidth; ctx.strokenStyle = getStartColor(tabbutton.focusBorderColor); ctx.stroke(); } } } onPressedChanged: { canvas.requestPaint() } onHoveredChanged: { canvas.requestPaint() } onCheckedChanged: { canvas.requestPaint() } StylePrivate.UKUITabButton{ id: tabbutton } StylePrivate.APPParameter{ id: app onParametryChanged: canvas.requestPaint() } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/ToolButton.qml0000664000175000017500000000476215154306200024544 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.6 import QtQuick.Templates 6.2 as T // 替代原2.5 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, btn.normalWidth) } implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding, btn.normalHeight) leftPadding: btn.leftRightMargin rightPadding: btn.leftRightMargin hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7? property var _menuToolButton:{ if(controlRoot.hasOwnProperty("hasMenu")) return controlRoot.hasMenu else return false } font: appP.font palette: appP.palette NormalControlColor{ id:ncColor } StylePrivate.UKUIButton{ id: btn } StylePrivate.APPParameter{ id: appP } onEnabledChanged: { content.updateImage() } property bool hasWindowActive: Qt.application.active onHasWindowActiveChanged:{ content.updateImage() } onPressedChanged: content.updateImage() contentItem: ButtonIconLabelContent { id: content controlRoot: controlRoot anchors.centerIn: controlRoot // onWidthChanged: console.log(controlRoot.text, width) } background: BackGroundRectangle{ controlRoot: controlRoot _radius: btn.radius }} qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/BusyIndicator.qml0000664000175000017500000000546215154306200025210 0ustar fengfeng/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. /* * 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 . * * Authors: Jing Tan * */ // 核心修改1:Qt5的2.12升级为Qt6 LTS版本(推荐6.2/6.5/6.8) import QtQuick 6.2 import QtQuick.Controls 6.2 // 核心修改2:删除Qt6已移除的impl私有模块(当前代码未使用该模块任何内容) // import QtQuick.Controls.impl 2.12 (已删除) import QtQuick.Templates 6.2 as T // UKUI私有模块版本号不变,需确保该模块已适配Qt6 import org.ukui.qqc2style.private 1.0 as StylePrivate T.BusyIndicator { id: controlRoot implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding hoverEnabled: true property var index: 0 property var iconWidth: controlRoot.width > 0 ? controlRoot.width : 16 property var iconHeight: controlRoot.height > 0 ? controlRoot.height : 16 onIndexChanged: { image.source = iconSource() controlRoot.update(); // console.log("index changeddd", index) } NumberAnimation{ id: animation target: controlRoot property: "index" from: 0 to: 7 duration: 1000 // 动画时长(毫秒) loops: Animation.Infinite running: controlRoot.running } contentItem: Image { id: image source: iconSource() sourceSize.width: iconWidth sourceSize.height: iconHeight opacity: controlRoot.running ? 1 : 0 smooth: true anchors.fill: controlRoot } StylePrivate.APPParameter{ id: app // onParametryChanged:{ // image.source = iconSource() // controlRoot.update(); // } } function iconSource(){ if(app.isDark) return "image://imageProvider/ukui-loading-" + Math.round(index).toString() + "-symbolic/highlight" else return "image://imageProvider/ukui-loading-" + Math.round(index).toString() + "-symbolic" } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/HorizontalHeaderView.qml0000664000175000017500000000532315154306200026522 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改:将所有Qt核心模块版本从2.15升级为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.15 import QtQuick.Controls 6.2 // 替代原2.15 import QtQuick.Templates 6.2 as T // 替代原2.15 import org.ukui.qqc2style.private 1.0 as StylePrivate // 保留,需确认Qt6适配性 T.HorizontalHeaderView { id: control implicitWidth: syncView ? syncView.width : 0 implicitHeight: Math.max(contentHeight, headerview.normalHeight) delegate: Item { // Qt6: add cellPadding (and font etc) as public API in headerview readonly property real cellPadding: 8 implicitWidth: text.implicitWidth + (cellPadding * 2) implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2)) Text { id: text text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData width: parent.width height: parent.height horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: getStartColor(headerview.normalTextColor) } Rectangle{ anchors.right: parent.right width: headerview.lineWidth anchors.verticalCenter: parent.verticalCenter height: 14 color: headerview.lineColor visible: index !== control.model.count - 1 } } StylePrivate.APPParameter{ id: appP } StylePrivate.UKUIHeaderView{ id: headerview } ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/ComboBox.qml0000664000175000017500000004202215160516153024141 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级所有Qt核心模块为Qt6 LTS版本(6.2,也可选择6.5/6.8) import QtQuick 6.2 // 替代原2.15 import QtQuick.Window 6.2 // 替代原2.15 import QtQuick.Controls 6.2 // 替代原2.15 import Qt5Compat.GraphicalEffects 1.0 // 核心修改2:删除Qt6已移除的私有模块(当前代码未使用该模块任何内容) // import QtQuick.Controls.impl 2.15 (已删除) import QtQuick.Templates 6.2 as T // 替代原2.15 import org.ukui.qqc2style.private 1.0 as StylePrivate // 保留,需确认Qt6适配性 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: combobox.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 palette: app.palette font: app.font ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property var scrollbarWidth : 0 property var backColor: !isTransaprent ? (!control.enabled ? combobox.disableBC : ((control.pressed || pop.visible) ? combobox.clickedBC : (control.hovered ? combobox.hoveredBC : combobox.normalBC))) : (!control.enabled ? combobox.disableTransparentBC : ((control.pressed || pop.visible)? combobox.clickedTransparentBC : (control.hovered ? combobox.hoveredTransparentBC : combobox.normalTransparentBC))) property var borderColor: !isTransaprent ? (!control.enabled ? combobox.disableBorderColor : ((app.focusEnable && control.focus) ? combobox.focusBorderColor : (control.pressed ? combobox.clickedBorderColor : (control.hovered ? combobox.hoveredBorderColor : combobox.normalBorderColor)))) : (!control.enabled ? combobox.disableTransparentBorderColor : ((app.focusEnable && control.focus) ? combobox.focusBorderColor : (control.pressed ? combobox.clickedTransparentBorderColor : (control.hovered ? combobox.hoveredTransparentBorderColor : combobox.normalTransparentBorderColor)))) delegate: MenuItem { id: menuitem width: control.width - 2 * control.leftPadding - scrollbarWidth text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData icon.name: (control.iconNameRole && model[control.iconNameRole] !== undefined) ? model[control.iconNameRole] : null highlighted: control.highlightedIndex === index hoverEnabled: control.hoverEnabled autoExclusive: true checked: control.currentIndex === index Component.onCompleted: { // console.log("delegate menuitem......", control.width, control.leftPadding, control.rightPadding, scrollbarWidth) if(menuitem.hasOwnProperty("itemHasChecked")){ itemHasChecked = true } } } contentItem: T.TextField { id: 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: control.font color: getStartColor(!control.enabled ? combobox.disableTextColor : combobox.normalTextColor) selectionColor: control.palette.highlight selectedTextColor: control.palette.highlightedText verticalAlignment: Text.AlignVCenter } indicator: Image { id: indicatorImage x: control.mirrored ? control.padding : control.width - width - control.padding y: control.topPadding + (control.availableHeight - height) / 2 z: 10 sourceSize.width: app.iconWidth sourceSize.height: app.iconWidth source: iconSource() cache: false MouseArea{ anchors.fill: parent onClicked: { pop.visible = !pop.visible; } } } background: Rectangle { id: bRec implicitWidth: combobox.normalWidth implicitHeight: combobox.normalHeight radius: combobox.radius color: gradientRec.visible ? "transparent" : getStartColor(backColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { id:gradient GradientStop { position: 0.0; color: getStartColor(backColor) } GradientStop { position: 1.0; color: getEndColor(backColor)} } visible: !parseInterface.isSolidPattern(backColor) } Rectangle{ anchors.fill: parent radius: parent.radius color: "transparent" border.color: getStartColor(borderColor) border.width: (app.focusEnable && control.focus) ? combobox.focusBorderWidth : combobox.borderWidth; } } popup: T.Popup { id: pop y: control.height width: control.width topMargin: 6 bottomMargin: 6 closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent onVisibleChanged: { if(visible && parent) { var p = mapToGlobal(x, y) if(popupwindow.x !== p.x || popupwindow.y !== p.y){ popupwindow.hide() popupwindow.x = p.x popupwindow.y = p.y } popupwindow.show() listview.model = control.delegateModel listview.currentIndex = control.currentIndex } else if(!visible && popupwindow.visible){ popupwindow.hide() listview.model = "" } indicatorImage.source = "" indicatorImage.source = iconSource() } onYChanged: { if(visible && parent) { var p = mapToGlobal(x, y) if(popupwindow.x !== p.x || popupwindow.y !== p.y){ popupwindow.x = p.x popupwindow.y = p.y } } } onXChanged: { if(visible && parent) { var p = mapToGlobal(x, y) if(popupwindow.x !== p.x || popupwindow.y !== p.y){ popupwindow.x = p.x popupwindow.y = p.y } } } background: Item{ Window { id: popupwindow // flags: Qt.ToolTip visible: pop.visible color: "transparent" width: listview.implicitWidth +scrollbarWidth + 2 * combobox.upDownMargin height: listview.contentHeight + 2 * combobox.upDownMargin onHeightChanged: { outScreen(); var size = popHandle.getScreenSize(); var p = popHandle.getScreenPoint(); if(popupwindow.y + height >= size.height + p.y){ var h = size.height + p.y - popupwindow.y if(h > 0){ height = h listview.implicitHeight = h } } } StylePrivate.PopupHandle{ id: popHandle blur: true titlebarVisible: false anchors.fill: parent visible: parent.visible radius: ukuiPopup.radius } Rectangle{ id: popRec width: parent.width height: parent.height visible: true // radius: ukuiPopup.radius color: { var baccolor = getStartColor(ukuiPopup.backColor) return Qt.rgba(baccolor.r, baccolor.g, baccolor.b, isTransaprent ? app.menuTransparency : 1.0) } //border.color: StylePrivate.ParseColorInterface.startColor(ukuiPopup.backBorderColor) //opacity: app.menuTransparency // layer.enabled: true ScrollBar { id: scrollbar active: visible orientation: Qt.Vertical visible: false // visible: popHandle.outScreen anchors.top: parent.top anchors.topMargin: pop.topPadding anchors.right: parent.right height: listview.height position: listview.visibleArea.yPosition size: listview.visibleArea.heightRatio onPositionChanged: { if (listview.visibleArea.yPosition != position || vscrollbar.position !== position) { vscrollbar.position = position; } } onVisibleChanged:{ if(visible) scrollbarWidth = scrollbar.width else scrollbarWidth = 0 // listview.implicitWidth = listview.contentHeight + scrollbarWidth } } // layer.effect: DropShadow { // transparentBorder: true // radius: ukuiPopup.radius // samples: 16 // horizontalOffset: 0 // verticalOffset: 0 // width: popRec.width + 8 // height: popRec.height + 8 // color: StylePrivate.ParseColorInterface.startColor(ukuiPopup.shadowColor) // } } ListView { id: listview // clip: popHandle.outScreen implicitHeight: contentHeight implicitWidth: control.width - 2 * control.leftPadding - scrollbarWidth // model: control.delegateModel currentIndex: control.highlightedIndex highlightMoveDuration: 0 // interactive: popHandle.outScreen anchors.top: popRec.top anchors.topMargin: combobox.upDownMargin anchors.left: popRec.left anchors.leftMargin: combobox.upDownMargin visible: parent.visible clip: outScreen() onVisibleChanged: { if(visible){ listview.implicitHeight = listview.contentHeight } } onModelChanged: { listview.implicitHeight = listview.contentHeight popupwindow.height = listview.contentHeight + 2 * combobox.upDownMargin } onContentHeightChanged: { listview.implicitHeight = listview.contentHeight popupwindow.height = listview.contentHeight + 2 * combobox.upDownMargin } ScrollBar.vertical: ScrollBar { id: vscrollbar active: visible visible: false width: 0 } onCurrentIndexChanged: { var children = listview.contentItem.children for (var i = 0; i < control.count; i++) { if(i === listview.currentIndex){ // if(listview.currentIndex !== control.currentIndex){ if(listview.itemAtIndex(i) !== null && listview.itemAtIndex(i).hasOwnProperty("isKeyBorderSelect") && !listview.itemAtIndex(i).isKeyBorderSelect) listview.itemAtIndex(i).isKeyBorderSelect = true // } } else if(listview.itemAtIndex(i) !== undefined && listview.itemAtIndex(i) !== null){ if(listview.itemAtIndex(i).hasOwnProperty("isKeyBorderSelect") && listview.itemAtIndex(i).isKeyBorderSelect) listview.itemAtIndex(i).isKeyBorderSelect = false } } if(listview.currentIndex >= 0) listview.positionViewAtIndex(listview.currentIndex, ListView.Top) } } Shortcut{ sequence: "Escape" onActivated: pop.visible = false } } } } StylePrivate.UKUIPopup{ id: ukuiPopup } StylePrivate.UKUIComboBox{ id: combobox } StylePrivate.APPParameter{ id: app onParametryChanged:{ indicatorImage.source = "" indicatorImage.source = iconSource() control.update(); } onIconThemeChanged: { indicatorImage.source = "" indicatorImage.source = iconSource() } } onEnabledChanged: { indicatorImage.source = "" indicatorImage.source = iconSource() } function outScreen(){ var size = popHandle.getScreenSize(); var p = popHandle.getScreenPoint(); if(popupwindow.y + popupwindow.height >= size.height + p.y){ var h = size.height + p.y - popupwindow.y if(h > 0){ listview.clip = true scrollbar.visible = true vscrollbar.visible = true return true } } listview.clip = false scrollbar.visible = false vscrollbar.visible = false return false } function iconSource(){ var icon = "ukui-down-symbolic"; if(!pop.visible){ if(!app.themeHasIcon(icon)) icon = "file:///usr/share/icons/ukui-icon-theme-default/scalable/actions/ukui-down-symbolic.svg" } else{ icon = "ukui-up-symbolic" if(!app.themeHasIcon(icon)) icon = "file:///usr/share/icons/ukui-icon-theme-default/scalable/actions/ukui-up-symbolic.svg" } var model = "normal" if(!control.enabled){ if(app.isDark) model = "highDisbale" else model = "disenable" } else if(app.isDark){ model = "highlight" } return "image://imageProvider/" + icon + "/" + model; } } qt6-ukui-platformtheme/ukui-qqc2-style/org.ukui.style/SpinBox.qml0000664000175000017500000002502015154306200024003 0ustar fengfeng/* * 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 . * * Authors: Jing Tan * */ // 核心修改1:升级Qt核心模块为Qt6 LTS版本(6.2,稳定性最优) import QtQuick 6.2 // 替代原2.12 import QtQuick.Controls 6.2 // 替代原2.12 // 核心修改2:删除Qt6已移除的私有实现模块 // import QtQuick.Controls.impl 2.12 (已删除) import QtQuick.Templates 6.2 as T // 替代原2.12 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: implicitContentHeight + topPadding + bottomPadding//Math.max(implicitContentHeight + topPadding + bottomPadding, // implicitBackgroundHeight, // up.implicitIndicatorHeight + down.implicitIndicatorHeight) padding: spinbox.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: app.font palette: app.palette property var isTransaprent:{ if(control.hasOwnProperty("transparent")) return control.transparent else return true } property bool upHover: control.up.hovered property bool upClick: control.up.pressed property bool downHover: control.down.hovered property bool downClick: control.down.pressed property bool controlPress: false property var backColor: !isTransaprent ? (!control.enabled ? spinbox.disableColor : ((control.pressed || control.activeFocus)? spinbox.clickColor : (control.hovered ? spinbox.hoverColor : spinbox.normalColor))) : (!control.enabled ? spinbox.disableTransparentBC : ((control.pressed || control.activeFocus)? spinbox.clickedTransparentBC : (control.hovered ? spinbox.hoveredTransparentBC : spinbox.normalTransparentBC))) property var borderColor: !isTransaprent ? (!control.enabled ? spinbox.disableBorderColor : ((control.activeFocus) ? spinbox.clickBorderColor : (control.pressed ? spinbox.clickBorderColor : (control.hovered ? spinbox.hoverBorderColor : spinbox.normalBorderColor)))) : (!control.enabled ? spinbox.disableTransparentBorderColor : ((control.activeFocus) ? spinbox.clickedTransparentBorderColor : (control.pressed ? spinbox.clickedTransparentBorderColor : (control.hovered ? spinbox.hoveredTransparentBorderColor : spinbox.normalTransparentBorderColor)))) ParseInterface{ id: parseInterface } function getStartColor(dtcolor) { return parseInterface.pStartColor(dtcolor) } function getEndColor(dtcolor) { return parseInterface.pEndColor(dtcolor) } onUpHoverChanged:{ upRadiusRec.canvas.requestPaint(); } onUpClickChanged:{ upRadiusRec.canvas.requestPaint(); } onDownHoverChanged:{ downRadiusRec.canvas.requestPaint(); } onDownClickChanged:{ downRadiusRec.canvas.requestPaint(); } onValueChanged: { upImage.source = upIconSource() downImage.source = downIconSource() control.update(); } onEnabledChanged: { upImage.source = upIconSource() downImage.source = downIconSource() control.update(); } 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: getStartColor(!control.enabled ? spinbox.disableTextColor : spinbox.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: spinbox.btnNormalWidth //implicitHeight: control.height/2.0 anchors.right: control.right anchors.rightMargin: borderRec.border.color.a > 0 ? borderRec.border.width : 0 anchors.top: parent.top anchors.topMargin: borderRec.border.color.a > 0 ? borderRec.border.width : 0 anchors.bottom: control.verticalCenter leftTopRadius: spinbox.radius rightTopRadius: spinbox.radius leftBottomRadius: 0 rightBottomRadius: 0 backColor: isTransaprent ? ((!upRadiusRec.enabled || !control.enabled) ? spinbox.btnDisableTransparentColor : control.up.pressed ? spinbox.btnClickTransparentColor : control.up.hovered ? spinbox.btnHoverTransparentColor : spinbox.btnNormalTransparentColor) : ((!upRadiusRec.enabled || !control.enabled) ? spinbox.btnDisableColor : control.up.pressed ? spinbox.btnClickColor : control.up.hovered ? spinbox.btnHoverColor : spinbox.btnNormalColor) Image { id: upImage anchors.centerIn: parent sourceSize.width: 16 sourceSize.height: 16 source: upIconSource() cache: false } } down.indicator: RadiusRectangle { id: downRadiusRec z:3 implicitWidth: spinbox.btnNormalWidth //implicitHeight: control.height/2.0 anchors.top: control.verticalCenter anchors.right: control.right anchors.rightMargin: borderRec.border.color.a > 0 ? borderRec.border.width : 0 anchors.bottom: parent.bottom anchors.bottomMargin: borderRec.border.color.a > 0 ? borderRec.border.width : 0 leftTopRadius: 0 rightTopRadius: 0 leftBottomRadius: spinbox.radius rightBottomRadius: spinbox.radius backColor: isTransaprent ? ((!upRadiusRec.enabled || !control.enabled) ? spinbox.btnDisableTransparentColor : control.down.pressed ? spinbox.btnClickTransparentColor : control.down.hovered ? spinbox.btnHoverTransparentColor : spinbox.btnNormalTransparentColor) : ((!upRadiusRec.enabled || !control.enabled) ? spinbox.btnDisableColor : control.down.pressed ? spinbox.btnClickColor : control.down.hovered ? spinbox.btnHoverColor : spinbox.btnNormalColor) Image { id: downImage anchors.centerIn: parent sourceSize.width: 16 sourceSize.height: 16 source: downIconSource() cache: false } } background: Rectangle { implicitWidth: spinbox.normalWidth implicitHeight: spinbox.normalHeight radius: spinbox.radius color: !parseInterface.isSolidPattern(backColor) ? "transparent" : getStartColor(backColor) Rectangle{ id: gradientRec anchors.fill: parent radius: parent.radius gradient: Gradient { GradientStop { position: 0.0; color: getStartColor(backColor) } GradientStop { position: 1.0; color: getEndColor(backColor)} } visible: !parseInterface.isSolidPattern(backColor) } Rectangle{ id: borderRec anchors.fill: parent radius: parent.radius border.width: (control.activeFocus) ? spinbox.focusBorderWidth : spinbox.normalBorderWidth border.color: getStartColor(borderColor) color: "transparent" } // MouseArea{ // id: mouseArea // anchors.fill: parent // onPressed: controlPress = true // onReleased: controlPress = false // } } StylePrivate.UKUISpinBox{ id: spinbox } StylePrivate.APPParameter{ id: app onParametryChanged:{ upImage.source = upIconSource() downImage.source = downIconSource() control.update(); } onIconThemeChanged: { upImage.source = "" upImage.source = upIconSource() downImage.source = "" downImage.source = downIconSource() } } function upIconSource(){ var model = ((!upRadiusRec.enabled || !control.enabled) && app.isDark) ? "highDisbale" : (!upRadiusRec.enabled || !control.enabled) ? "disenable" : (app.isDark) ? "highlight" : "normal" var icon = "ukui-up-symbolic"; if(!app.themeHasIcon(icon)) icon = "file:///usr/share/icons/ukui-icon-theme-default/scalable/actions/ukui-up-symbolic.svg" return "image://imageProvider/" + icon + "/" + model; } function downIconSource(){ var model = ((!downRadiusRec.enabled || !control.enabled) && app.isDark) ? "highDisbale" : (!downRadiusRec.enabled || !control.enabled) ? "disenable" : (app.isDark) ? "highlight" : "normal" var icon = "ukui-down-symbolic"; if(!app.themeHasIcon(icon)) icon = "file:///usr/share/icons/ukui-icon-theme-default/scalable/actions/ukui-down-symbolic.svg" return "image://imageProvider/" + icon + "/" + model; } } qt6-ukui-platformtheme/CMakeLists.txt0000664000175000017500000000116015154306200016564 0ustar fengfengcmake_minimum_required(VERSION 3.16) project(qt6-ukui) add_subdirectory(ukui-styles) add_subdirectory(libqt6-ukui-style) # add_subdirectory(qt5-ukui-filedialog) add_subdirectory(qt6-ukui-platformtheme) # add_subdirectory(ukui-qqc2-style) # add_subdirectory(ukui-qml-style-helper) # add_subdirectory(test) # # 检查环境变量 PLATFORMTHEME_SKIP_TEST # if(NOT "$ENV{PLATFORMTHEME_SKIP_TEST}" STREQUAL "1") # add_subdirectory(test) # # 启用测试功能 # enable_testing() # # 添加测试用例 # add_test(NAME TestSettings COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test/auto-test/test-settings) # endif() qt6-ukui-platformtheme/CONTRIBUTING.md0000664000175000017500000000673215154306200016267 0ustar fengfeng# How to contribute ## language ### [zh_CN](CONTRIBUTING_zh_CN.md) ## As an user UKUI style effects almost whole qt's applications in UKUI Desktop Environment. Such as button's rounded radius and color, tab page's switch animations, menu's transparency and blur effects, etc. We hope users point out the inconsistencies and lackes of details. That will help us make targeted improvements. However, ukui-style can not take over all works of application's displaying. One application might have it own style, even in UKUI. And there also might be some adjustment for applications which using ukui-style. It is hard to distinguish wether it is fully ukui-styled application for user. Anyway, if you found out a problem about visual senses or bugs. You can emit a issue to us. Whatever here or at projects which have problems. ## As a developer If you are familiar with Qt5 QPA platformtheme and QStyle, you will know the structure of this project quickly. This project is similar to some other platformtheme project, such as qt5-gtk2-platformtheme, qt5ct, kde, etc. By the platformtheme and style plugins of this project, we build our own desktop environment theme, that means not only our own applications, but also other qt's applications will seemed as UKUI style in our DE, too. Platformtheme will completely resove the problem that developers have to cost much time for tuning style to attach UKUI's desgin. We hope developers spend more their time in business logic and functions, and also can ensure the styled unity even in other platform, such as KDE. To archive that goal, it's hard to rely on me alone. Developers also need to understand how to develop an application in a standard, and how to comply with standards and expand the application. By doing that you will find its significance in long term. For now, Although I have put almost all my energy into the development of this project, It still progresses very slowly. There are many troubles that want volunteers' help to resolve. ### Platform Theme Level As other platform themes have done, we also want to provide all the features about a platform. - Platform Dialogs, such as filechooser dialogs. - Platform Configs, such as font. - Platform Extensions, such as global menu. Gtk's applcations theme is also a problem, we have to consider providing a way to uniform the applications' styles between Qt and Gtk. ### Styles Level A nice looking style is always complex, such as breeze and oxygen. For making our own style, we have to spend a lot of time for UI designing and details maintaining. As a developer, we need change the desgin to codes. There could be roughly divided into 2 parts. - Tuning of control's painting, such as button, menu's round radius. System or control's palette. - Combing animations with controls, such as tab switching with sliding, button hovering with fading. You first need to understand how QStyle and style plugins work, how they draw a control and let control animated. ### Animations Frameworks Level Animation Frameworks is usually based on Qt's Animations Frameworks. It aims to: - Make widgets and view items animated, and let the state changing more smoothly and cool. Note that even though Animations Frameworks is relatively independent with platform. But it will have great influence on the theme or style. ## Active communication If you were intersted to contribute, I would also be pleasure to help you understand this project for my best. Starting with an issue or e-mail is good. Yue Lan, qt6-ukui-platformtheme/libqt6-ukui-style/0000775000175000017500000000000015154306200017340 5ustar fengfengqt6-ukui-platformtheme/libqt6-ukui-style/effects/0000775000175000017500000000000015154306200020757 5ustar fengfengqt6-ukui-platformtheme/libqt6-ukui-style/effects/highlight-effect.cpp0000664000175000017500000005211215154306200024665 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "highlight-effect.h" #include #include #include #include #include #include #include #include #include #define ColorDifference 15 QColor HighLightEffect::symbolic_color = QColor(26, 26, 26); void HighLightEffect::setSkipEffect(QWidget *w, bool skip) { w->setProperty("skipHighlightIconEffect", skip); } bool HighLightEffect::isPixmapPureColor(const QPixmap &pixmap) { if (pixmap.isNull()) { qWarning("pixmap is null!"); return false; } QImage image = pixmap.toImage(); QVector vector; int total_red = 0; int total_green = 0; int total_blue = 0; bool pure = true; for (int y = 0; y < image.height(); ++y) { for (int x = 0; x < image.width(); ++x) { if (image.pixelColor(x, y).alphaF() > 0.3) { QColor color = image.pixelColor(x, y); vector << color; total_red += color.red(); total_green += color.green(); total_blue += color.blue(); int dr = qAbs(color.red() - symbolic_color.red()); int dg = qAbs(color.green() - symbolic_color.green()); int db = qAbs(color.blue() - symbolic_color.blue()); if (dr > ColorDifference || dg > ColorDifference || db > ColorDifference) pure = false; } } } if (pure) return true; qreal squareRoot_red = 0; qreal squareRoot_green = 0; qreal squareRoot_blue = 0; qreal average_red = total_red / vector.count(); qreal average_green = total_green / vector.count(); qreal average_blue = total_blue / vector.count(); for (QColor color : vector) { squareRoot_red += (color.red() - average_red) * (color.red() - average_red); squareRoot_green += (color.green() - average_green) * (color.green() - average_green); squareRoot_blue += (color.blue() - average_blue) * (color.blue() - average_blue); } qreal arithmeticSquareRoot_red = qSqrt(squareRoot_red / vector.count()); qreal arithmeticSquareRoot_green = qSqrt(squareRoot_green / vector.count()); qreal arithmeticSquareRoot_blue = qSqrt(squareRoot_blue / vector.count()); return arithmeticSquareRoot_red < 2.0 && arithmeticSquareRoot_green < 2.0 && arithmeticSquareRoot_blue < 2.0; } bool HighLightEffect::isSymbolicColor(const QPixmap &pixmap) { if (pixmap.isNull()) { qWarning("pixmap is null!"); return false; } QImage image = pixmap.toImage(); bool pure = true; for (int y = 0; y < image.height(); ++y) { for (int x = 0; x < image.width(); ++x) { if (image.pixelColor(x, y).alphaF() > 0.3) { QColor color = image.pixelColor(x, y); //default symbolic color (26, 26, 26) int dr = qAbs(color.red() - symbolic_color.red()); int dg = qAbs(color.green() - symbolic_color.green()); int db = qAbs(color.blue() - symbolic_color.blue()); if (dr > ColorDifference || dg > ColorDifference || db > ColorDifference) pure = false; } } } return pure; } bool HighLightEffect::setMenuIconHighlightEffect(QMenu *menu, HighLightMode hlmode, EffectMode mode) { if (!menu) return false; menu->setProperty("useIconHighlightEffect", hlmode); menu->setProperty("iconHighlightEffectMode", mode); return true; } bool HighLightEffect::setViewItemIconHighlightEffect(QAbstractItemView *view, HighLightMode hlmode, EffectMode mode) { if (!view) return false; view->viewport()->setProperty("useIconHighlightEffect", hlmode); view->viewport()->setProperty("iconHighlightEffectMode", mode); return true; } HighLightEffect::HighLightMode HighLightEffect::isWidgetIconUseHighlightEffect(const QWidget *w) { if (w) { if (w->property("useIconHighlightEffect").isValid()) return HighLightMode(w->property("useIconHighlightEffect").toInt()); } return HighLightEffect::skipHighlight; } void HighLightEffect::setSymoblicColor(const QColor &color) { qApp->setProperty("symbolicColor", color); symbolic_color = color; } void HighLightEffect::setWidgetIconFillSymbolicColor(QWidget *widget, bool fill) { widget->setProperty("fillIconSymbolicColor", fill); } const QColor HighLightEffect::getCurrentSymbolicColor() { QIcon symbolic = QIcon::fromTheme("window-new-symbolic"); QPixmap pix = symbolic.pixmap(QSize(16, 16)); QImage img = pix.toImage(); for (int x = 0; x < img.width(); x++) { for (int y = 0; y < img.height(); y++) { QColor color = img.pixelColor(x, y); if (color.alpha() > 0) { symbolic_color = color; return color; } } } return symbolic_color; } const QColor HighLightEffect::defaultStyleDark(const QStyleOption *option) { auto windowText = qApp->palette().color(QPalette::Active, QPalette::WindowText); float h, s, v; if (option) { windowText = option->palette.color(QPalette::Active, QPalette::WindowText); } windowText.getHsvF(&h, &s, &v); return QColor::fromHsvF(h, s, v); } QPixmap HighLightEffect::generatePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, bool force, EffectMode mode) { if (pixmap.isNull()) return pixmap; // if (!(option->state & QStyle::State_Enabled)) // return pixmap; // if (widget && !widget->isEnabled()) // return pixmap; QPixmap target = pixmap; bool isPurePixmap = isPixmapPureColor(pixmap); if (force) { if (!isPurePixmap) return pixmap; QPainter p(&target); p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); if (option->state & QStyle::State_MouseOver || option->state & QStyle::State_Selected || option->state & QStyle::State_On || option->state & QStyle::State_Sunken) { p.fillRect(target.rect(), option->palette.highlightedText()); } else { p.fillRect(target.rect(), mode ? option->palette.text() : defaultStyleDark(option)); } return target; } if (!widget) { return pixmap; } if (widget->property("skipHighlightIconEffect").isValid()) { bool skipEffect = widget->property("skipHighlightIconEffect").toBool(); if (skipEffect) return pixmap; } if (widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } HighLightMode hlmode = isWidgetIconUseHighlightEffect(widget); if (hlmode == skipHighlight) { return pixmap; } else if (hlmode == HighlightEffect) { bool fillIconSymbolicColor = false; if (widget->property("fillIconSymbolicColor").isValid()) { fillIconSymbolicColor = widget->property("fillIconSymbolicColor").toBool(); } bool isEnable = option->state.testFlag(QStyle::State_Enabled); bool overOrDown = option->state.testFlag(QStyle::State_MouseOver) || option->state.testFlag(QStyle::State_Sunken) || option->state.testFlag(QStyle::State_On) || option->state.testFlag(QStyle::State_Selected); if (qobject_cast(widget)) { if (!option->state.testFlag(QStyle::State_Selected)) overOrDown = false; } if (isEnable && overOrDown) { if (fillIconSymbolicColor) { target = filledSymbolicColoredPixmap(pixmap, option->palette.highlightedText().color()); } if (!isPurePixmap) return target; QPainter p(&target); p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), option->palette.highlightedText()); return target; } else { QPixmap target = pixmap; if (fillIconSymbolicColor) { target = filledSymbolicColoredPixmap(pixmap, option->palette.highlightedText().color()); } if (!isPurePixmap) return target; QPainter p(&target); p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), mode ? option->palette.text() : defaultStyleDark(option)); return target; } } else if (hlmode == ordinaryHighLight) { return ordinaryGeneratePixmap(pixmap, option, widget, mode); } else if (hlmode == hoverHighLight) { return hoverGeneratePixmap(pixmap, option, widget); } else if (hlmode == defaultHighLight) { return bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget, mode); } else if (hlmode == filledSymbolicColorHighLight) { if (isPurePixmap) { return bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget, mode); } else { return filledSymbolicColoredGeneratePixmap(pixmap, option, widget, mode); } } else if (hlmode == ForceHighlight) { return forceGeneratePixmap(pixmap, option, widget, mode); }else { return pixmap; } return pixmap; } QPixmap HighLightEffect::ordinaryGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, EffectMode mode) { if (pixmap.isNull()) return pixmap; if (!isPixmapPureColor(pixmap)) return pixmap; if (widget && !widget->property("isLineEditHighLighting").isValid()) { if (!isSymbolicColor(pixmap)) { return pixmap; } } if (widget && widget->inherits("QLineEdit")) { const_cast(widget)->setProperty("isLineEditHighLighting",true); } QPixmap target = pixmap; QColor color; if (widget && widget->property("setIconHighlightEffectDefaultColor").isValid() && widget->property("setIconHighlightEffectDefaultColor").canConvert()) { color = widget->property("setIconHighlightEffectDefaultColor").value(); } if (widget && widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } QPainter p(&target); p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); if (widget && widget->inherits("QLineEdit")) { p.fillRect(target.rect(), color.isValid() ? color : defaultStyleDark(option)); } else { p.fillRect(target.rect(), color.isValid() ? color : (mode ? option->palette.text() : defaultStyleDark(option))); } return target; } QPixmap HighLightEffect::hoverGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, EffectMode mode) { if (pixmap.isNull()) return pixmap; if (!isPixmapPureColor(pixmap)) return pixmap; if (!isSymbolicColor(pixmap)) return pixmap; QPixmap target = pixmap; QColor color; if (widget && widget->property("setIconHighlightEffectHoverColor").isValid() && widget->property("setIconHighlightEffectHoverColor").canConvert()) { color = widget->property("setIconHighlightEffectHoverColor").value(); } if (widget && widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } bool overOrDown = option->state.testFlag(QStyle::State_MouseOver) || option->state.testFlag(QStyle::State_Sunken) || option->state.testFlag(QStyle::State_On) || option->state.testFlag(QStyle::State_Selected); if (qobject_cast(widget)) { if (!option->state.testFlag(QStyle::State_Selected)) overOrDown = false; } QPainter p(&target); if (overOrDown) { p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), color.isValid() ? color : option->palette.highlightedText()); } return target; } QPixmap HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, EffectMode mode) { if (pixmap.isNull()) return pixmap; if (!isPixmapPureColor(pixmap)) return pixmap; if (!isSymbolicColor(pixmap)) return pixmap; QPixmap target = pixmap; QColor defaultColor, hoverColor; if(qApp && qApp->property("highlightedtext-active").isValid()){ if(qApp->property("highlightedtext-active").canConvert()){ hoverColor = qApp->property("highlightedtext-active").value().color(); } } if (widget && widget->property("setIconHighlightEffectDefaultColor").isValid() && widget->property("setIconHighlightEffectDefaultColor").canConvert()) { defaultColor = widget->property("setIconHighlightEffectDefaultColor").value(); } if (widget && widget->property("setIconHighlightEffectHoverColor").isValid() && widget->property("setIconHighlightEffectHoverColor").canConvert()) { hoverColor = widget->property("setIconHighlightEffectHoverColor").value(); } if (widget && widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } bool overOrDown = option->state.testFlag(QStyle::State_MouseOver) || option->state.testFlag(QStyle::State_Sunken) || option->state.testFlag(QStyle::State_On) || option->state.testFlag(QStyle::State_Selected); if (qobject_cast(widget)) { if (!option->state.testFlag(QStyle::State_Selected)) overOrDown = false; } else if (option->styleObject && option->styleObject->inherits("QQuickStyleItem1")) { // 修复qml菜单高亮状态异常问题 overOrDown = option->state.testFlag(QStyle::State_MouseOver) || option->state.testFlag(QStyle::State_Sunken) || option->state.testFlag(QStyle::State_Selected); } QPainter p(&target); if (overOrDown) { p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), hoverColor.isValid() ? hoverColor : option->palette.highlightedText()); } else { p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), defaultColor.isValid() ? defaultColor : (mode ? option->palette.text() : defaultStyleDark(option))); } return target; } QPixmap HighLightEffect::filledSymbolicColoredGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, EffectMode mode) { if (pixmap.isNull()) return pixmap; if (isPixmapPureColor(pixmap)) return bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget, mode); QPixmap target = pixmap; QColor defaultColor, hoverColor; if (widget && widget->property("setIconHighlightEffectDefaultColor").isValid() && widget->property("setIconHighlightEffectDefaultColor").canConvert()) { defaultColor = widget->property("setIconHighlightEffectDefaultColor").value(); } if (widget && widget->property("setIconHighlightEffectHoverColor").isValid() && widget->property("setIconHighlightEffectHoverColor").canConvert()) { hoverColor = widget->property("setIconHighlightEffectHoverColor").value(); } if (widget && widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } bool isEnable = option->state.testFlag(QStyle::State_Enabled); bool overOrDown = option->state.testFlag(QStyle::State_MouseOver) || option->state.testFlag(QStyle::State_Sunken) || option->state.testFlag(QStyle::State_On) || option->state.testFlag(QStyle::State_Selected); if (qobject_cast(widget)) { if (!option->state.testFlag(QStyle::State_Selected)) overOrDown = false; } if (isEnable && overOrDown) { return filledSymbolicColoredPixmap(target, hoverColor.isValid() ? hoverColor : option->palette.color(QPalette::HighlightedText)); } else { return filledSymbolicColoredPixmap(target, defaultColor.isValid() ? defaultColor : (mode ? option->palette.color(QPalette::Text) : defaultStyleDark(option))); } return target; } QPixmap HighLightEffect::forceGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget, EffectMode mode) { if (pixmap.isNull()) return pixmap; QPixmap target = pixmap; QColor defaultColor, hoverColor; if (widget && widget->property("setIconHighlightEffectDefaultColor").isValid() && widget->property("setIconHighlightEffectDefaultColor").canConvert()) { defaultColor = widget->property("setIconHighlightEffectDefaultColor").value(); } if (widget && widget->property("setIconHighlightEffectHoverColor").isValid() && widget->property("setIconHighlightEffectHoverColor").canConvert()) { hoverColor = widget->property("setIconHighlightEffectHoverColor").value(); } if (widget && widget->property("iconHighlightEffectMode").isValid()) { mode = EffectMode(widget->property("iconHighlightEffectMode").toBool()); } bool isEnable = option->state.testFlag(QStyle::State_Enabled); bool overOrDown = option->state.testFlag(QStyle::State_MouseOver) || option->state.testFlag(QStyle::State_Sunken) || option->state.testFlag(QStyle::State_On) || option->state.testFlag(QStyle::State_Selected); if (qobject_cast(widget)) { if (!option->state.testFlag(QStyle::State_Selected)) overOrDown = false; } if (isPixmapPureColor(pixmap)){ QPainter p(&target); if (overOrDown) { p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), hoverColor.isValid() ? hoverColor : QColor(Qt::white)); } else { p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(target.rect(), defaultColor.isValid() ? defaultColor : QColor(Qt::white)); } return target; } else{ if (isEnable && overOrDown) { return filledSymbolicColoredPixmap(target, hoverColor.isValid() ? hoverColor : QColor(Qt::white)); } else { return filledSymbolicColoredPixmap(target, defaultColor.isValid() ? defaultColor : QColor(Qt::white)); } return target; } } HighLightEffect::HighLightEffect(QObject *parent) : QObject(parent) { } QPixmap HighLightEffect::filledSymbolicColoredPixmap(const QPixmap &source, const QColor &baseColor) { if (source.isNull()) return source; QImage img = source.toImage(); for (int x = 0; x < img.width(); x++) { for (int y = 0; y < img.height(); y++) { auto color = img.pixelColor(x, y); if (color.alpha() > 0.3) { if (qAbs(color.red() - symbolic_color.red()) < ColorDifference && qAbs(color.green() - symbolic_color.green()) < ColorDifference && qAbs(color.blue() - symbolic_color.blue()) < ColorDifference) { color.setRed(baseColor.red()); color.setGreen(baseColor.green()); color.setBlue(baseColor.blue()); img.setPixelColor(x, y, color); } } } } return QPixmap::fromImage(img); } qt6-ukui-platformtheme/libqt6-ukui-style/effects/highlight-effect.h0000664000175000017500000000714015154306200024333 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef HIGHLIGHTEFFECT_H #define HIGHLIGHTEFFECT_H #include #include class QAbstractItemView; class QMenu; class HighLightEffect : public QObject { Q_OBJECT public: enum HighLightMode { skipHighlight = 0x0, HighlightEffect = 0x1, ordinaryHighLight = 0x2, hoverHighLight = 0x4, defaultHighLight = 0x8, filledSymbolicColorHighLight = 0x10, ForceHighlight = 0x12 }; enum EffectMode { HighlightOnly = 0x0, BothDefaultAndHighlit = 0x1 }; Q_ENUM(EffectMode) /*! * \brief setSkipEffect * \param w * \param skip * \details * in ukui-style, some widget such as menu will be set use highlight * icon effect automaticlly, * but we might not want to compose a special pure color image. * This function is use to skip the effect. */ static QColor symbolic_color; static void setSkipEffect(QWidget *w, bool skip = true); static bool isPixmapPureColor(const QPixmap &pixmap); static bool isSymbolicColor(const QPixmap &pixmap); static bool setMenuIconHighlightEffect(QMenu *menu, HighLightMode hlmode = skipHighlight, EffectMode mode = HighlightOnly); static bool setViewItemIconHighlightEffect(QAbstractItemView *view, HighLightMode hlmode = skipHighlight, EffectMode mode = HighlightOnly); static HighLightMode isWidgetIconUseHighlightEffect(const QWidget *w); static void setSymoblicColor(const QColor &color); static void setWidgetIconFillSymbolicColor(QWidget *widget, bool fill); static const QColor getCurrentSymbolicColor(); static const QColor defaultStyleDark(const QStyleOption *option); static QPixmap generatePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, bool force = false, EffectMode mode = HighlightOnly); static QPixmap ordinaryGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly); static QPixmap hoverGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly); static QPixmap bothOrdinaryAndHoverGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly); static QPixmap filledSymbolicColoredGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly); static QPixmap forceGeneratePixmap(const QPixmap &pixmap, const QStyleOption *option, const QWidget *widget = nullptr, EffectMode mode = HighlightOnly); private: explicit HighLightEffect(QObject *parent = nullptr); static QPixmap filledSymbolicColoredPixmap(const QPixmap &source, const QColor &baseColor); }; #endif // HIGHLIGHTEFFECT_H qt6-ukui-platformtheme/libqt6-ukui-style/animations/0000775000175000017500000000000015154306200021502 5ustar fengfengqt6-ukui-platformtheme/libqt6-ukui-style/animations/animation-helper.cpp0000664000175000017500000000245415154306200025447 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "animation-helper.h" #include #include "animator-iface.h" AnimationHelper::AnimationHelper(QObject *parent) : QObject(parent) { m_animators = new QMultiHash(); } AnimationHelper::~AnimationHelper() { for(auto item = m_animators->begin(); item != m_animators->end(); item++){ if(item.value()){ delete item.value(); item.value() = nullptr; } } if(m_animators){ delete m_animators; m_animators = nullptr; } } qt6-ukui-platformtheme/libqt6-ukui-style/animations/animator-plugin-iface.h0000664000175000017500000000562515154306200026036 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef ANIMATORPLUGINIFACE_H #define ANIMATORPLUGINIFACE_H #include class UKUIAnimatorPluginIface { public: enum AnimatorPluginType { TabWidget, StackedWidget, PushButton, ItemView, ScrollBar, MenuBar, Menu, Other }; virtual ~UKUIAnimatorPluginIface() {} /*! * \brief id * \return unique plugin's id. * \details * You have to define a unique id for your animator plugin. */ virtual const QString id() = 0; /*! * \brief brief * \return a brief of animator. */ virtual const QString brief() = 0; /*! * \brief pluginType * \return animator type for indicating what kinds of widget to bind with. */ virtual AnimatorPluginType pluginType() = 0; /*! * \brief inhertKey * \return * \details * When a style polish a widget, ukui animation frameworks will bind the animator * to the widget. This value is the keyword for judgeing if the widget should be bound * with animator. For example, return this value with "QWidget", then all the widgets * will be bound. */ virtual const QString inhertKey() = 0; /*! * \brief excludeKeys * \return * \details * In contrast to inhertKey(), this list is a "blacklist" of * widgets should not be bound with the animator. */ virtual const QStringList excludeKeys() = 0; /*! * \brief isParallel * \return * \details * Indicate if the animator which plugin created is compatible with other * animators. * * \note * This variable has no practical effect, * but we hope that the animations acting on the same control * can be parallelized, although it is difficult to achieve. * * If you note the animator is not parallelized, other animator * might be invalid. For example, the default tabwidget slide animator * will hijack the paint event of current tabwidget's tab. This might * let other animator can not do a paint in current tab. */ virtual bool isParallel() = 0; }; #endif // ANIMATORPLUGINIFACE_H qt6-ukui-platformtheme/libqt6-ukui-style/animations/animator-iface.h0000664000175000017500000000463215154306200024537 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef ANIMATORIFACE_H #define ANIMATORIFACE_H #include "animator-plugin-iface.h" #include class QWidget; class AnimatorIface { public: virtual ~AnimatorIface() {} virtual bool bindWidget(QWidget *w) {return false;} virtual bool unboundWidget() {return false;} virtual QWidget *boundedWidget() {return nullptr;} virtual QVariant value(const QString &property) {return QVariant();} virtual bool setAnimatorStartValue(const QString &property, const QVariant &value) {return false;} virtual bool setAnimatorEndValue(const QString &property, const QVariant &value) {return false;} virtual QVariant animatorStartValue(const QString &property) {return QVariant();} virtual QVariant animatorEndValue(const QString &property) {return QVariant();} virtual bool setAnimatorDuration(const QString &property, int duration) {return false;} virtual void setAnimatorDirectionForward(const QString &property = nullptr, bool forward = true) {} virtual bool isRunning(const QString &property = nullptr) {return false;} virtual void startAnimator(const QString &property = nullptr) {} virtual void stopAnimator(const QString &property = nullptr) {} virtual int currentAnimatorTime(const QString &property = nullptr) {return 0;} virtual void setAnimatorCurrentTime(const QString &property = nullptr, const int msecs = 0) {} virtual int totalAnimationDuration(const QString &property = nullptr) {return 0;} virtual void setExtraProperty(const QString &property, const QVariant &value){} virtual QVariant getExtraProperty(const QString &property) {return QVariant();} }; #endif // ANIMATORIFACE_H qt6-ukui-platformtheme/libqt6-ukui-style/animations/animation-helper.h0000664000175000017500000000262615154306200025115 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef ANIMATIONHELPER_H #define ANIMATIONHELPER_H #include class QWidget; class AnimatorIface; class AnimationHelper : public QObject { Q_OBJECT public: explicit AnimationHelper(QObject *parent = nullptr); virtual ~AnimationHelper(); signals: public slots: virtual bool registerWidget(QWidget *) {return false;} virtual bool unregisterWidget(QWidget *) {return false;} protected: /*! * \brief m_animators * \deprecated * You should not use this member in newly-written code. */ QMultiHash *m_animators = nullptr; }; #endif // ANIMATIONHELPER_H qt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/0000775000175000017500000000000015154306200023454 5ustar fengfengqt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/ukui-tabwidget-animator-iface.h0000664000175000017500000000440715154306200031434 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef UKUITABWIDGETANIMATORIFACE_H #define UKUITABWIDGETANIMATORIFACE_H #include #include "../animator-iface.h" /*! * \brief The UKUITabWidgetAnimatorIface class * \details * This class define the interface for doing a QTabWidget's animation. * a tabwidget animator should bind only one tabwidget with bindTabWidget(), * and can be unbounded with unboundTabWidget(). * * Animator is created by AnimatorPlugin, which is another interface's implement * of UKUI style animation's frameworks. * * \see UKUITabWidgetAnimatorPluginIface */ class UKUITabWidgetAnimatorIface : public AnimatorIface { public: virtual ~UKUITabWidgetAnimatorIface() {} virtual bool bindWidget(QWidget *w) { return bindTabWidget(qobject_cast(w)); } virtual bool unboundWidget() { return unboundTabWidget(); } /*! * \brief bindTabWidget * \param w widget should be bound. * \return true if successed. * \details * this method is used for binding a animator instance for a tab widget. * You have to implement this function in your own implement class. */ virtual bool bindTabWidget(QTabWidget *w) = 0; /*! * \brief unboundTabWidget * \return true if successed. * \details * this method is used to unbound the animator instance and tab widget. * You have to implement this function in your own implement class. */ virtual bool unboundTabWidget() = 0; }; #endif // UKUITABWIDGETANIMATORIFACE_H qt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/ukui-tabwidget-animator-plugin-iface.h0000664000175000017500000000421015154306200032720 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef UKUITABWIDGETANIMATORPLUGINIFACE_H #define UKUITABWIDGETANIMATORPLUGINIFACE_H #include #include "../animator-plugin-iface.h" #include "ukui-tabwidget-animator-iface.h" #define UKUITabWidgetAnimatorPluginInterface_iid "org.ukui.style.animatons.TabWidgetPluginInterface" /*! * \brief The UKUITabWidgetAnimatorPluginIface class * \details * This class is used to create a tabwidget animator instace. * * UKUI Animation's frameworks is desgined to be extensiable. * And this interface is an entry of plugin. * * \see UKUITabWidgetAnimatorIface */ class UKUITabWidgetAnimatorPluginIface : public UKUIAnimatorPluginIface { public: virtual ~UKUITabWidgetAnimatorPluginIface() {} /*! * \brief key * \return * A key word of plugin, such as "slide". */ virtual const QString key() = 0; /*! * \brief description * \return * A description for animator. For example, "Animator for do a horizon slide * for tab widget." */ virtual const QString description() = 0; /*! * \brief createAnimator * \return * an animator instance, for example a UKUI::TabWidget::DefaultSlideAnimator. */ virtual UKUITabWidgetAnimatorIface *createAnimator() = 0; }; Q_DECLARE_INTERFACE(UKUITabWidgetAnimatorPluginIface, UKUITabWidgetAnimatorPluginInterface_iid) #endif // UKUITABWIDGETANIMATORPLUGINIFACE_H ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator.hqt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator.0000664000175000017500000000701615154306200032736 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef UKUITABWIDGETDEFAULTSLIDEANIMATOR_H #define UKUITABWIDGETDEFAULTSLIDEANIMATOR_H #include #include #include #include "ukui-tabwidget-animator-iface.h" #include namespace UKUI { namespace TabWidget { /*! * \brief The DefaultSlideAnimator class * \details * This class is an implement of UKUITabWidgetAnimatorIface. */ class DefaultSlideAnimator : public QVariantAnimation, public UKUITabWidgetAnimatorIface { Q_OBJECT public: explicit DefaultSlideAnimator(QObject *parent = nullptr); ~DefaultSlideAnimator(); bool bindTabWidget(QTabWidget *w); bool unboundTabWidget(); QWidget *boundedWidget() {return m_bound_widget;} bool eventFilter(QObject *obj, QEvent *e); protected: void watchSubPage(QWidget *w); bool filterTabWidget(QObject *obj, QEvent *e); bool filterStackedWidget(QObject *obj, QEvent *e); bool filterSubPage(QObject *obj, QEvent *e); bool filterTmpPage(QObject *obj, QEvent *e); void clearPixmap(); private: QTabWidget *m_bound_widget = nullptr; QStackedWidget *m_stack = nullptr; QList m_children; QPixmap m_previous_pixmap; QPixmap m_next_pixmap; /*! * \brief m_tmp_page * \note * insert a tmp tab page into tab widget directly is dangerous, * because a custom tab widget's page may be desgined different * with normal tab page, such as peony-qt's directory view. * In that case, it might lead program crashed when * application call a custom page but get a tmp page. * * for those reasons, i use a temporary widgets bound to the * stacked widget with qt's parent&child mechanism. * It can float on the top layer or hide on the lower layer of stack, * but it does not belong to the elements in the stack (no index), * which can avoid the above problems. * * However, this way might be incompatible with other animations. * Because it uses a new widget for painting, not relate with orignal * page. Another conflict is the oxygen's fade animation might force * raise current tab page when it finished. That might cause a incompleted * slide animation if slide duration is longer than fade's. */ QWidget *m_tmp_page = nullptr; /*! * \brief m_tab_resizing * \details * If a went to a resize event, the animation should handle * widget's relayout after resized. * This bool varient is used to help judege if animator's pixmaps * and template widget' states should be updated. */ bool m_tab_resizing = false; int pervIndex = -1; bool left_right = true; bool horizontal = false; QWidget *previous_widget = nullptr; }; } } #endif // UKUITABWIDGETDEFAULTSLIDEANIMATOR_H ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-factory.hqt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-0000664000175000017500000000410015154306200032724 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef UKUITABWIDGETDEFAULTSLIDEANIMATORFACTORY_H #define UKUITABWIDGETDEFAULTSLIDEANIMATORFACTORY_H #include #include "ukui-tabwidget-animator-plugin-iface.h" namespace UKUI { namespace TabWidget { /*! * \brief The DefaultSlideAnimatorFactory class * \details * This class is an internal plugin. It provides a default tabwidget * switch animation for QTabWidget and its drived class. * * \note * Note that it used in ukui-style, but you can also use its api in other * desktop environment. */ class DefaultSlideAnimatorFactory : public QObject, public UKUITabWidgetAnimatorPluginIface { Q_OBJECT public: explicit DefaultSlideAnimatorFactory(QObject *parent = nullptr); ~DefaultSlideAnimatorFactory(){} const QString id() {return tr("Default Slide");} const QString brief() {return tr("Let tab widget switch with a slide animation.");} const QString key() {return "tab_slide";} const QString description() {return brief();} AnimatorPluginType pluginType() {return TabWidget;} const QString inhertKey() {return "QTabWidget";} const QStringList excludeKeys() {return QStringList()<<"Peony::DirectoryWidget";} bool isParallel() {return false;} UKUITabWidgetAnimatorIface *createAnimator(); }; } } #endif // UKUITABWIDGETDEFAULTSLIDEANIMATORFACTORY_H ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootqt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-factory.cppqt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator-0000664000175000017500000000217015154306200032731 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "ukui-tabwidget-default-slide-animator-factory.h" #include "ukui-tabwidget-default-slide-animator.h" using namespace UKUI::TabWidget; DefaultSlideAnimatorFactory::DefaultSlideAnimatorFactory(QObject *parent) : QObject(parent) { } UKUITabWidgetAnimatorIface *DefaultSlideAnimatorFactory::createAnimator() { return new DefaultSlideAnimator; } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootqt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator.cppqt6-ukui-platformtheme/libqt6-ukui-style/animations/tabwidget/ukui-tabwidget-default-slide-animator.0000664000175000017500000003722315154306200032741 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "ukui-tabwidget-default-slide-animator.h" #include #include #include #include #include #include #include #include #include #include using namespace UKUI::TabWidget; /*! * \brief DefaultSlideAnimator::DefaultSlideAnimator * \param parent * \details * This class define a slide animator for tab widget sliding animation. * Animator based on QVariantAnimation, paint on a tmp widgets when running. * The content of widget is based on animation's current value and 2 pixmap * grabbed at appropriate times. * * \note * Once an animator have bound a tab widget, it have to unbound current widget at first. * Then it can bind another tab widget again. */ DefaultSlideAnimator::DefaultSlideAnimator(QObject *parent) : QVariantAnimation (parent) { setDuration(200); setEasingCurve(QEasingCurve::OutQuad); setStartValue(0.0); setEndValue(1.0); } DefaultSlideAnimator::~DefaultSlideAnimator() { // if(m_bound_widget){ // m_bound_widget->deleteLater(); // m_bound_widget = nullptr; // } // if(m_stack){ // m_stack->deleteLater(); // m_stack = nullptr; // } if(m_tmp_page){ m_tmp_page->deleteLater(); m_tmp_page = nullptr; } } /*! * \brief DefaultSlideAnimator::bindTabWidget * \param w A QTabWidget instance, most passed in QStyle::polish(). * \return result if Tab widget be bound \c true for binding successed. * \details * When do a tab widget binding, animator will create a tmp child page for tab widget's * stack widget. Then it will watched their event waiting for preparing and doing a animation. */ bool DefaultSlideAnimator::bindTabWidget(QTabWidget *w) { if (w) { m_bound_widget = w; //watch tab widget w->installEventFilter(this); m_tmp_page = new QWidget; //watch tmp page; m_tmp_page->installEventFilter(this); for (auto child : w->children()) { if (child->objectName() == "qt_tabwidget_stackedwidget") { auto stack = qobject_cast(child); m_stack = stack; //watch stack widget m_tmp_page->setParent(m_stack); m_tmp_page->resize(m_stack->size()); m_stack->installEventFilter(this); break; } } for (int i = 0; i < w->count(); i++) { //watch sub page watchSubPage(w->widget(i)); } m_tmp_page->setAttribute(Qt::WA_TranslucentBackground, m_bound_widget->testAttribute(Qt::WA_TranslucentBackground)); previous_widget = m_bound_widget->currentWidget(); pervIndex = m_bound_widget->currentIndex(); connect(w, &QTabWidget::currentChanged, this, [=](int index){ this->stop(); m_tmp_page->hide(); if(!w->isVisible()){ return ; } if (m_bound_widget->currentWidget() && m_bound_widget->currentWidget() != previous_widget) { left_right = m_bound_widget->currentIndex() > pervIndex; pervIndex = m_bound_widget->currentIndex(); /* * This way not suitable for 4k */ //m_next_pixmap = m_bound_widget->grab(QRect(m_bound_widget->rect().x(), m_bound_widget->tabBar()->height(), //m_bound_widget->currentWidget()->width(), m_bound_widget->currentWidget()->height())); QPixmap pixmap(m_stack->size()); pixmap.fill(QColor(Qt::transparent)); /* * This way some widget such as QFrame. * QPalette::Window was used to draw the background during the screenshot, * but QWidget itself did not draw the entire area with others during the screenshot, * resulting in some areas in the screenshot that the background drawn by QPalette::Window was different from the actual drawing. */ //m_bound_widget->currentWidget()->render(&pixmap, QPoint(), m_bound_widget->currentWidget()->rect()); /* * This way by modifying the way of QPalette, get the same screenshot as the actual state */ //QPalette palette, palette_save; //palette = palette_save = m_bound_widget->currentWidget()->palette(); //palette.setBrush(QPalette::Window, palette.brush(QPalette::Base)); //m_bound_widget->currentWidget()->setPalette(palette); //m_bound_widget->currentWidget()->render(&pixmap, QPoint(), m_bound_widget->currentWidget()->rect()); //m_bound_widget->currentWidget()->setPalette(palette_save); m_bound_widget->render(&pixmap, QPoint(), m_stack->geometry()); m_next_pixmap = pixmap; if (qobject_cast(previous_widget)) { QPixmap previous_pixmap(m_stack->size()); previous_pixmap.fill(QColor(Qt::transparent)); QPalette palette = m_bound_widget->palette(); QPalette palette_save = previous_widget->palette(); /* * This use QPalette::Base to replace QPalette::Window, Mabey have unknow bug. */ if (!m_bound_widget->testAttribute(Qt::WA_TranslucentBackground)) { previous_widget->render(&previous_pixmap); } palette.setBrush(QPalette::Window, palette.brush(QPalette::Base)); previous_widget->setPalette(palette); previous_widget->render(&previous_pixmap); previous_widget->setPalette(palette_save); m_previous_pixmap = previous_pixmap; switch (w->tabBar()->shape()) { case QTabBar::RoundedNorth: case QTabBar::TriangularNorth: case QTabBar::RoundedSouth: case QTabBar::TriangularSouth: horizontal = false; break; case QTabBar::RoundedWest: case QTabBar::TriangularWest: case QTabBar::RoundedEast: case QTabBar::TriangularEast: horizontal = true; break; default: break; } this->start(); m_tmp_page->raise(); m_tmp_page->show(); } } previous_widget = m_bound_widget->currentWidget(); }); connect(this, &QVariantAnimation::valueChanged, m_tmp_page, [=]() { m_tmp_page->repaint(); }); connect(this, &QVariantAnimation::finished, m_tmp_page, [=]() { m_tmp_page->repaint(); }); return true; } return false; } bool DefaultSlideAnimator::unboundTabWidget() { clearPixmap(); if (m_bound_widget) { disconnect(m_bound_widget, &QTabWidget::currentChanged, this, nullptr); for (auto w : m_bound_widget->children()) { w->removeEventFilter(this); } m_tmp_page->removeEventFilter(this); m_tmp_page->deleteLater(); m_tmp_page = nullptr; previous_widget = nullptr; m_bound_widget = nullptr; this->deleteLater(); return true; } return false; } bool DefaultSlideAnimator::eventFilter(QObject *obj, QEvent *e) { if (obj == m_tmp_page) { return filterTmpPage(obj, e); } if (obj == m_stack) { return filterStackedWidget(obj, e); } if (obj == m_bound_widget) { return filterTabWidget(obj, e); } return filterSubPage(obj, e); } void DefaultSlideAnimator::watchSubPage(QWidget *w) { if (w) w->installEventFilter(this); } bool DefaultSlideAnimator::filterTabWidget(QObject *obj, QEvent *e) { if (e->type() == QEvent::Close) { this->unboundTabWidget(); } return false; } bool DefaultSlideAnimator::filterStackedWidget(QObject *obj, QEvent *e) { switch (e->type()) { case QEvent::ChildAdded: case QEvent::ChildRemoved: { if (obj->objectName() == "qt_tabwidget_stackedwidget") { QChildEvent *ce = static_cast(e); if (!ce->child()->isWidgetType()) return false; if (ce->added()) { ce->child()->installEventFilter(this); } else { ce->child()->removeEventFilter(this); } } return false; } case QEvent::Resize: m_tab_resizing = true; return false; case QEvent::LayoutRequest: { /// there a 2 case we need excute these codes. /// 1. when stacked widget created and shown, it first do resize, then do a layout request. /// 2. after stacked widget resize. /// /// This event is very suitable for the above two situations, /// both in terms of efficiency and trigger time. if (m_tab_resizing) { m_tmp_page->resize(m_stack->size()); if(m_next_pixmap.isNull()) pervIndex = m_bound_widget->currentIndex(); } m_tab_resizing = false; return false; } default: break; } return false; } bool DefaultSlideAnimator::filterSubPage(QObject *obj, QEvent *e) { switch (e->type()) { case QEvent::Show: { return false; } case QEvent::Hide: { /* * This way not suitable for 4k and multi-screen crash(Todo: get the screen change event, get the corresponding screen, * call the grabWindow method of QScreen to get the picture, * but the picture needs to be processed by 4k and orientation size) */ //if (m_bound_widget->currentWidget()) { //QScreen *screen = QGuiApplication::primaryScreen(); //m_previous_pixmap = screen->grabWindow(m_bound_widget->winId(), // m_bound_widget->tabBar()->x() + 2, // m_bound_widget->tabBar()->height(), // m_bound_widget->currentWidget()->width(), // m_bound_widget->currentWidget()->height()); //} this->stop(); return false; } case QEvent::Resize: { this->stop(); return false; } default: return false; } } bool DefaultSlideAnimator::filterTmpPage(QObject *obj, QEvent *e) { switch (e->type()) { case QEvent::Show: { return false; } case QEvent::Paint: { QWidget *w = qobject_cast(obj); if (this->state() == QAbstractAnimation::Running) { QPainter p(w); auto value = this->currentValue().toDouble(); p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); p.setCompositionMode(QPainter::CompositionMode_Source); //do a horizon slide. auto prevSrcRect = QRectF(m_previous_pixmap.rect()); auto prevTargetRect = QRectF(m_previous_pixmap.rect()); auto nextSrcRect = QRectF(m_next_pixmap.rect()); auto nextTargetRect = QRectF(m_next_pixmap.rect()); if (left_right) { if (horizontal) { prevSrcRect.setY(m_previous_pixmap.height() * value); prevSrcRect.setHeight(m_previous_pixmap.height() * (1 - value)); prevTargetRect.setHeight(m_previous_pixmap.height() * (1 - value)); } else { prevSrcRect.setX(m_previous_pixmap.width() * value); prevSrcRect.setWidth(m_previous_pixmap.width() * (1 - value)); prevTargetRect.setWidth(m_previous_pixmap.width() * (1 - value)); } p.drawPixmap(prevTargetRect, m_previous_pixmap, prevSrcRect); if (horizontal) { nextSrcRect.setHeight(m_next_pixmap.height() * value); nextTargetRect.setY(m_next_pixmap.height() * (1 - value)); nextTargetRect.setHeight(m_next_pixmap.height() * value); } else { nextSrcRect.setWidth(m_next_pixmap.width() * value); nextTargetRect.setX(m_next_pixmap.width() * (1 - value)); nextTargetRect.setWidth(m_next_pixmap.width() * value); } p.drawPixmap(nextTargetRect, m_next_pixmap, nextSrcRect); } else { if (horizontal) { nextSrcRect.setY(m_next_pixmap.height() * (1 - value)); nextSrcRect.setHeight(m_next_pixmap.height() * value); nextTargetRect.setHeight(m_next_pixmap.height() * value); } else { nextSrcRect.setX(m_next_pixmap.width() * (1 - value)); nextSrcRect.setWidth(m_next_pixmap.width() * value); nextTargetRect.setWidth(m_next_pixmap.width() * value); } p.drawPixmap(nextTargetRect, m_next_pixmap, nextSrcRect); if (horizontal) { prevSrcRect.setHeight(m_previous_pixmap.height() * (1 - value)); prevTargetRect.setY(m_previous_pixmap.height() * value); prevTargetRect.setHeight(m_previous_pixmap.height() * (1 - value)); } else { prevSrcRect.setWidth(m_previous_pixmap.width() * (1 - value)); prevTargetRect.setX(m_previous_pixmap.width() * value); prevTargetRect.setWidth(m_previous_pixmap.width() * (1 - value)); } p.drawPixmap(prevTargetRect, m_previous_pixmap, prevSrcRect); } //eat event so that widget will not paint default items and override //our custom pixmap. return true; } m_tmp_page->hide(); if (!m_next_pixmap.isNull()) m_stack->stackUnder(m_tmp_page); return false; } default: return false; } } void DefaultSlideAnimator::clearPixmap() { m_previous_pixmap = QPixmap(); m_next_pixmap = QPixmap(); } qt6-ukui-platformtheme/libqt6-ukui-style/animations/scrollbar/0000775000175000017500000000000015154306200023465 5ustar fengfeng././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqt6-ukui-platformtheme/libqt6-ukui-style/animations/scrollbar/ukui-scrollbar-default-interaction-animator.hqt6-ukui-platformtheme/libqt6-ukui-style/animations/scrollbar/ukui-scrollbar-default-interaction-ani0000664000175000017500000000534715154306200033063 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef UKUISCROLLBARDEFAULTINTERACTIONANIMATOR_H #define UKUISCROLLBARDEFAULTINTERACTIONANIMATOR_H #include #include "../animator-iface.h" class QVariantAnimation; namespace UKUI { namespace ScrollBar { class DefaultInteractionAnimator : public QParallelAnimationGroup, public AnimatorIface { Q_OBJECT public: explicit DefaultInteractionAnimator(QObject *parent = nullptr); ~DefaultInteractionAnimator(); bool bindWidget(QWidget *w); bool unboundWidget(); QWidget *boundedWidget() {return m_widget;} QVariant value(const QString &property); bool isRunning(const QString &property = nullptr); bool setAnimatorStartValue(const QString &property, const QVariant &value); bool setAnimatorEndValue(const QString &property, const QVariant &value); QVariant animatorStartValue(const QString &property); QVariant animatorEndValue(const QString &property); bool setAnimatorDuration(const QString &property, int duration); void setAnimatorDirectionForward(const QString &property = nullptr, bool forward = true); void startAnimator(const QString &property = nullptr); void stopAnimator(const QString &property = nullptr); int currentAnimatorTime(const QString &property = nullptr); void setAnimatorCurrentTime(const QString &property, const int msecs); int totalAnimationDuration(const QString &property); void setExtraProperty(const QString &property, const QVariant &value); QVariant getExtraProperty(const QString &property); private: QWidget *m_widget = nullptr; QVariantAnimation *m_groove_width = nullptr; QVariantAnimation *m_slider_opacity = nullptr; QVariantAnimation *m_hover_bg_width = nullptr; QVariantAnimation *m_sunken_silder_additional_opacity = nullptr; QVariantAnimation *m_silder_move_position = nullptr; int m_endPosition = 0; int m_startPosition = 0; bool m_addValue = true; }; } } #endif // UKUISCROLLBARDEFAULTINTERACTIONANIMATOR_H ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqt6-ukui-platformtheme/libqt6-ukui-style/animations/scrollbar/ukui-scrollbar-default-interaction-animator.cppqt6-ukui-platformtheme/libqt6-ukui-style/animations/scrollbar/ukui-scrollbar-default-interaction-ani0000664000175000017500000003454015154306200033060 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "ukui-scrollbar-default-interaction-animator.h" #include #include #include using namespace UKUI::ScrollBar; DefaultInteractionAnimator::DefaultInteractionAnimator(QObject *parent) : QParallelAnimationGroup (parent) { } DefaultInteractionAnimator::~DefaultInteractionAnimator() { if(m_groove_width){ m_groove_width->deleteLater(); m_groove_width = nullptr; } if(m_slider_opacity){ m_slider_opacity->deleteLater(); m_slider_opacity = nullptr; } if(m_sunken_silder_additional_opacity){ m_sunken_silder_additional_opacity->deleteLater(); m_sunken_silder_additional_opacity = nullptr; } } /*! * \brief DefaultInteractionAnimator::bindWidget * \param w * \return * * \details * QObject has a feature that parent object can use findChild() method * getting a specific named child. * * I use QObject::setObjectName() set my animator and bind to a scroll bar. * So that i could not cache a hash or map to manage animators. * * \bug * Cause I use named QObject child to cache the animator for a scrollbar, * However there are some troubles for my unexcepted. * * For example, qt5 assistant's main view can not find child correctly. * I don't know if animator bind with child was been removed at some times. */ bool DefaultInteractionAnimator::bindWidget(QWidget *w) { if (w->property("doNotAnimate").toBool()) return false; if (qobject_cast(w)) { m_widget = w; } else { return false; } if(m_groove_width){ delete(m_groove_width); m_groove_width = nullptr; } m_groove_width = new QVariantAnimation(this); m_groove_width->setStartValue(0.0); m_groove_width->setEndValue(1.0); m_groove_width->setDuration(200); m_groove_width->setEasingCurve(QEasingCurve::InOutCubic); addAnimation(m_groove_width); if( m_slider_opacity){ delete(m_slider_opacity); m_slider_opacity = nullptr; } m_slider_opacity = new QVariantAnimation(this); m_slider_opacity->setStartValue(0.0); m_slider_opacity->setEndValue(1.0); m_slider_opacity->setDuration(200); m_slider_opacity->setEasingCurve(QEasingCurve::InOutCubic); addAnimation(m_slider_opacity); if( m_hover_bg_width){ delete(m_hover_bg_width); m_hover_bg_width = nullptr; } m_hover_bg_width = new QVariantAnimation(this); m_hover_bg_width->setStartValue(0.0); m_hover_bg_width->setEndValue(1.0); m_hover_bg_width->setDuration(200); m_hover_bg_width->setEasingCurve(QEasingCurve::InOutCubic); addAnimation(m_hover_bg_width); if( m_sunken_silder_additional_opacity){ delete(m_sunken_silder_additional_opacity); m_sunken_silder_additional_opacity = nullptr; } m_sunken_silder_additional_opacity = new QVariantAnimation(this); m_sunken_silder_additional_opacity->setStartValue(0.0); m_sunken_silder_additional_opacity->setEndValue(0.10); m_sunken_silder_additional_opacity->setDuration(150); addAnimation(m_sunken_silder_additional_opacity); m_silder_move_position = new QVariantAnimation(this); m_silder_move_position->setStartValue(0.0); m_silder_move_position->setEndValue(1.0); m_silder_move_position->setDuration(300); m_silder_move_position->setEasingCurve(QEasingCurve::OutQuad); addAnimation(m_silder_move_position); setObjectName("ukui_scrollbar_default_interaction_animator"); connect(m_groove_width, &QVariantAnimation::valueChanged, w, [=]() { w->update(); }); connect(m_slider_opacity, &QVariantAnimation::valueChanged, w, [=]() { w->update(); }); connect(m_sunken_silder_additional_opacity, &QVariantAnimation::valueChanged, w, [=]() { w->update(); }); connect(m_silder_move_position, &QVariantAnimation::valueChanged, w, [=]() { w->update(); }); connect(m_hover_bg_width, &QVariantAnimation::valueChanged, w, [=]() { w->update(); }); connect(m_groove_width, &QVariantAnimation::finished, w, [=]() { w->update(); }); connect(m_slider_opacity, &QVariantAnimation::finished, w, [=]() { w->update(); }); connect(m_sunken_silder_additional_opacity, &QVariantAnimation::finished, w, [=]() { w->update(); }); connect(m_silder_move_position, &QVariantAnimation::finished, w, [=]() { w->update(); }); connect(m_hover_bg_width, &QVariantAnimation::finished, w, [=]() { w->update(); }); return true; } bool DefaultInteractionAnimator::unboundWidget() { this->stop(); this->setDirection(QAbstractAnimation::Forward); if(m_groove_width){ delete(m_groove_width); m_groove_width = nullptr; } if(m_slider_opacity){ delete(m_slider_opacity); m_slider_opacity = nullptr; } if(m_sunken_silder_additional_opacity){ delete(m_sunken_silder_additional_opacity); m_sunken_silder_additional_opacity = nullptr; } if(m_silder_move_position){ delete(m_silder_move_position); m_silder_move_position = nullptr; } if(m_hover_bg_width){ delete(m_hover_bg_width); m_hover_bg_width = nullptr; } if (m_widget) { this->setParent(nullptr); return true; } return false; } QVariant DefaultInteractionAnimator::value(const QString &property) { if (property == "groove_width") { return m_groove_width->currentValue(); } else if (property == "slider_opacity") { return m_slider_opacity->currentValue(); } else if (property == "additional_opacity") { return m_sunken_silder_additional_opacity->currentValue(); } else if (property == "move_position") { return m_silder_move_position->currentValue(); } else if (property == "bg_width") { return m_hover_bg_width->currentValue(); } else { return QVariant(); } } bool DefaultInteractionAnimator::setAnimatorStartValue(const QString &property, const QVariant &value) { if (property == "groove_width") { m_groove_width->setStartValue(value); return true; } else if (property == "slider_opacity") { m_slider_opacity->setStartValue(value); return true; } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->setStartValue(value); return true; } else if (property == "move_position") { m_silder_move_position->setStartValue(value); return true; } else if (property == "bg_width") { m_hover_bg_width->setStartValue(value); return true; } else { return false; } } bool DefaultInteractionAnimator::setAnimatorEndValue(const QString &property, const QVariant &value) { if (property == "groove_width") { m_groove_width->setEndValue(value); return true; } else if (property == "slider_opacity") { m_slider_opacity->setEndValue(value); return true; } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->setEndValue(value); return true; } else if (property == "move_position") { m_silder_move_position->setEndValue(value); return true; } else if (property == "bg_width") { m_hover_bg_width->setEndValue(value); return true; } else { return false; } } QVariant DefaultInteractionAnimator::animatorStartValue(const QString &property) { if (property == "groove_width") { return m_groove_width->startValue(); } else if (property == "slider_opacity") { return m_slider_opacity->startValue(); } else if (property == "additional_opacity") { return m_sunken_silder_additional_opacity->startValue(); } else if (property == "move_position") { return m_silder_move_position->startValue(); } else if (property == "bg_width") { return m_hover_bg_width->startValue(); } else { return QVariant(); } } QVariant DefaultInteractionAnimator::animatorEndValue(const QString &property) { if (property == "groove_width") { return m_groove_width->endValue(); } else if (property == "slider_opacity") { return m_slider_opacity->endValue(); } else if (property == "additional_opacity") { return m_sunken_silder_additional_opacity->endValue(); } else if (property == "move_position") { return m_silder_move_position->endValue(); } else if (property == "bg_width") { return m_hover_bg_width->endValue(); } else { return QVariant(); } } bool DefaultInteractionAnimator::setAnimatorDuration(const QString &property, int duration) { if (property == "groove_width") { m_groove_width->setDuration(duration); return true; } else if (property == "slider_opacity") { m_slider_opacity->setDuration(duration); return true; } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->setDuration(duration); return true; } else if (property == "move_position") { m_silder_move_position->setDuration(duration); return true; } else if (property == "bg_width") { m_hover_bg_width->setDuration(duration); return true; } else { return false; } } void DefaultInteractionAnimator::setAnimatorDirectionForward(const QString &property, bool forward) { auto d = forward? QAbstractAnimation::Forward: QAbstractAnimation::Backward; if (property == "groove_width") { m_groove_width->setDirection(d); } else if (property == "slider_opacity") { m_slider_opacity->setDirection(d); } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->setDirection(d); } else if (property == "move_position") { m_silder_move_position->setDirection(d); } else if (property == "bg_width") { m_hover_bg_width->setDirection(d); } else { return; } } bool DefaultInteractionAnimator::isRunning(const QString &property) { if (property == "groove_width") { return m_groove_width->state() == Running; } else if (property == "slider_opacity") { return m_slider_opacity->state() == Running; } else if (property == "additional_opacity") { return m_sunken_silder_additional_opacity->state() == Running; } else if (property == "move_position") { return m_silder_move_position->state() == Running; } else if (property == "bg_width") { return m_hover_bg_width->state() == Running; } else { return this->state() == Running; } } void DefaultInteractionAnimator::startAnimator(const QString &property) { if (property == "groove_width") { m_groove_width->start(); } else if (property == "slider_opacity") { m_slider_opacity->start(); } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->start(); } else if (property == "move_position") { m_silder_move_position->start(); } else if (property == "bg_width") { m_hover_bg_width->start(); } else { this->start(); } } void DefaultInteractionAnimator::stopAnimator(const QString &property) { if (property == "groove_width") { m_groove_width->stop(); } else if (property == "slider_opacity") { m_slider_opacity->stop(); } else if (property == "additional_opacity") { m_sunken_silder_additional_opacity->stop(); } else if (property == "move_position") { m_silder_move_position->stop(); } else if (property == "bg_width") { m_hover_bg_width->stop(); } else { this->stop(); } } int DefaultInteractionAnimator::currentAnimatorTime(const QString &property) { if (property == "groove_width") { return m_groove_width->currentTime(); } else if (property == "slider_opacity") { return m_slider_opacity->currentTime(); } else if (property == "additional_opacity") { return m_sunken_silder_additional_opacity->currentTime(); } else if (property == "move_position") { return m_silder_move_position->currentTime(); } else if (property == "bg_width") { return m_hover_bg_width->currentTime(); } else { return this->currentTime(); } } void DefaultInteractionAnimator::setAnimatorCurrentTime(const QString &property, const int msecs) { if ("move_position" == property) { m_silder_move_position->setCurrentTime(msecs); } } int DefaultInteractionAnimator::totalAnimationDuration(const QString &property) { if (property == "groove_width") { return m_groove_width->duration(); } else if (property == "slider_opacity") { return m_slider_opacity->duration(); } else if (property == "additional_opacity") { return m_sunken_silder_additional_opacity->duration(); } else if (property == "move_position") { return m_silder_move_position->duration(); } else if (property == "bg_width") { return m_hover_bg_width->duration(); } else { return this->duration(); } } void DefaultInteractionAnimator::setExtraProperty(const QString &property, const QVariant &value) { if(property == "end_position") m_endPosition = value.toInt(); else if(property == "start_position") m_startPosition = value.toInt(); else if(property == "addValue") m_addValue = value.toBool(); } QVariant DefaultInteractionAnimator::getExtraProperty(const QString &property) { if(property == "end_position") return m_endPosition; else if(property == "start_position") return m_startPosition; else if(property == "addValue") return m_addValue; return QVariant(); } qt6-ukui-platformtheme/libqt6-ukui-style/CMakeLists.txt0000664000175000017500000000641715154306200022110 0ustar fengfengcmake_minimum_required(VERSION 3.16) project(qt6-ukui-style) # 设置共享库的版本号 set(QT5_UKUI-STYLE_VERSION_MAJOR 1) set(QT5_UKUI-STYLE_VERSION_MINOR 0) set(QT5_UKUI-STYLE_VERSION_PATCH 0) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) # Qt6 推荐使用 C++17 标准 set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Qt6 最低版本要求 set(QT_MIN_VERSION "6.4.2") set(KF5_MIN_VERSION "5.66.0") # 查找 Qt6 组件 find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets Concurrent ) # 获取 Qt6 库路径 get_target_property(LIB_PATH Qt6::Widgets IMPORTED_LOCATION) get_filename_component(PARENT_PATH "${LIB_PATH}" PATH) message("libqt5-ukui-style PARENT_PATH: ${PARENT_PATH}") find_package(X11) find_package(PkgConfig) pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0) pkg_check_modules(Qsettings REQUIRED gsettings-qt6) pkg_check_modules(KYSDKCONF2 REQUIRED kysdk-conf2) include_directories( ${Qsettings_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ) if (KYSDKCONF2_FOUND) include_directories(${KYSDKCONF2_INCLUDE_DIRS}) link_directories(${KYSDKCONF2_LIBRARY_DIRS}) endif() # 手动指定需要包含的源文件和头文件(排除 gestures 目录) file(GLOB_RECURSE Header "animations/*.h" "animations/*.hpp" "effects/*.h" "effects/*.hpp" "internal-styles/*.h" "internal-styles/*.hpp" "settings/*.h" "settings/*.hpp" ) file(GLOB_RECURSE Sources "animations/*.cpp" "animations/*.c" "animations/*.ui" "effects/*.cpp" "effects/*.c" "effects/*.ui" "internal-styles/*.cpp" "internal-styles/*.c" "internal-styles/*.ui" "settings/*.cpp" "settings/*.c" "settings/*.ui" ) file(GLOB_RECURSE XML "org.ukui.style.gschema.xml") source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${Header} ${Sources} ${XML}) add_library(qt6-ukui-style SHARED ${Sources} ${Header} ${XML}) # 设置共享库的命名规则 set_target_properties(qt6-ukui-style PROPERTIES OUTPUT_NAME "qt6-ukui-style" VERSION ${QT5_UKUI-STYLE_VERSION_MAJOR}.${QT5_UKUI-STYLE_VERSION_MINOR}.${QT5_UKUI-STYLE_VERSION_PATCH} SOVERSION ${QT5_UKUI-STYLE_VERSION_MAJOR} ) # 链接 Qt6 目标 target_link_libraries(qt6-ukui-style PRIVATE Qt6::Widgets Qt6::Concurrent gsettings-qt6 gio-2.0 ${KYSDKCONF2_LIBRARIES} ) add_definitions(-DLIBQT5UKUISTYLE_LIBRARY) add_definitions(-DQT_DEPRECATED_WARNINGS) add_definitions(-DQT_MESSAGELOGCONTEXT) # 添加 Qt6 兼容性宏 add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) if(UNIX) set(TARGET_PATH "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}") install(TARGETS ${PROJECT_NAME} DESTINATION ${TARGET_PATH}) set(GSCHEMA_PATH "/usr/share/glib-2.0/schemas") set(GSCHEMA_FILE "${CMAKE_CURRENT_SOURCE_DIR}/settings/org.ukui.style.gschema.xml") install(FILES ${GSCHEMA_FILE} DESTINATION ${GSCHEMA_PATH}) set(KCONF2_PATH "/etc/kylin-config/basic/") set(KCONF2_FILE "${CMAKE_CURRENT_SOURCE_DIR}/settings/org.ukui.style.yaml") install(FILES ${KCONF2_FILE} DESTINATION ${KCONF2_PATH}) set(PKGCONFIG_PATH "${TARGET_PATH}/pkgconfig") set(PKGCONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/development-files/qt6-ukui.pc") install(FILES ${PKGCONFIG_FILE} DESTINATION ${PKGCONFIG_PATH}) install(FILES ${Header} DESTINATION "/usr/include/qt6-ukui/") endif() qt6-ukui-platformtheme/libqt6-ukui-style/internal-styles/0000775000175000017500000000000015154306200022475 5ustar fengfengqt6-ukui-platformtheme/libqt6-ukui-style/internal-styles/internal-style.h0000664000175000017500000000325715154306200025627 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef INTERNALSTYLE_H #define INTERNALSTYLE_H #include /*! * \brief The InternalStyle class * \details * This class is a interface type class. It is desgined as an extension of UKUI theme * frameworks. Applications which use internal style means that there will be no effect * when system theme switched, for example, from fusion to ukui-white. * But an internal style usually should response the palette settings changed for * keeping the unity as a desktop environment theme's extensions. * * The typical example which implement the internal style is MPSStyle. */ class InternalStyle : public QProxyStyle { Q_OBJECT public: explicit InternalStyle(QStyle *parentStyle = nullptr); explicit InternalStyle(const QString parentStyleName); signals: void useSystemStylePolicyChanged(bool use); public slots: virtual void setUseSystemStyle(bool use); }; #endif // INTERNALSTYLE_H qt6-ukui-platformtheme/libqt6-ukui-style/internal-styles/mps-style.cpp0000664000175000017500000001140115154306200025133 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "mps-style.h" MPSStyle::MPSStyle(bool dark) : InternalStyle ("fusion") { } void MPSStyle::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const { //FIXME: QProxyStyle::drawComplexControl(control, option, painter, widget); } void MPSStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { //FIXME: QProxyStyle::drawControl(element, option, painter, widget); } void MPSStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const { //FIXME: QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap); } void MPSStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const { //FIXME: QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole); } void MPSStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { //FIXME: QProxyStyle::drawPrimitive(element, option, painter, widget); } QPixmap MPSStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const { //FIXME: return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option); } QStyle::SubControl MPSStyle::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const { //FIXME: return QProxyStyle::hitTestComplexControl(control, option, position, widget); } QRect MPSStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const { //FIXME: return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap); } QRect MPSStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const { //FIXME: return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text); } int MPSStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const { //FIXME: return QProxyStyle::pixelMetric(metric, option, widget); } void MPSStyle::polish(QWidget *widget) { //FIXME: QProxyStyle::polish(widget); } void MPSStyle::polish(QApplication *application) { //FIXME: QProxyStyle::polish(application); } void MPSStyle::polish(QPalette &palette) { //FIXME: QProxyStyle::polish(palette); } void MPSStyle::unpolish(QWidget *widget) { //FIXME: QProxyStyle::unpolish(widget); } void MPSStyle::unpolish(QApplication *application) { //FIXME: QProxyStyle::unpolish(application); } QSize MPSStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const { //FIXME: return QProxyStyle::sizeFromContents(type, option, contentsSize, widget); } QIcon MPSStyle::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { //FIXME: return QProxyStyle::standardIcon(standardIcon, option, widget); } QPalette MPSStyle::standardPalette() const { //FIXME: return QProxyStyle::standardPalette(); } int MPSStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const { //FIXME: return QProxyStyle::styleHint(hint, option, widget, returnData); } QRect MPSStyle::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const { //FIXME: return QProxyStyle::subControlRect(control, option, subControl, widget); } QRect MPSStyle::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const { //FIXME: return QProxyStyle::subElementRect(element, option, widget); } qt6-ukui-platformtheme/libqt6-ukui-style/internal-styles/mps-style.h0000664000175000017500000001025015154306200024601 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef MPSSTYLE_H #define MPSSTYLE_H #include "internal-style.h" /*! * \brief The MPSStyle class * \details * M(enu)P(anel)S(idebar)Style is an internal style shared in several * UKUI desktop applications, such as UKUI Menu, UKUI Panel and UKUI Sidebar, etc. * * Usually, applications use the styles which have been installed as qstyle plugin in * UKUI desktop environment, such as ukui-white and ukui-black. However one style may * be not enough for UKUI3.0 desgin. The menu, panel and sidebar desgin is Noticeably * different from the common style which we used in peony or other qt's applications. * To integrate the unique style into the theme, I came up the idea of internal styles, * and combine them with current platform theme's frameworks. So it will Looks like a * whole style. * * \see InternalStyle */ class MPSStyle : public InternalStyle { Q_OBJECT public: explicit MPSStyle(bool dark = true); void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const; void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const; void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const; void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const; QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const; QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const; QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const; QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const; //virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget); int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const; void polish(QWidget *widget); void polish(QApplication *application); void polish(QPalette &palette); void unpolish(QWidget *widget); void unpolish(QApplication *application); QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const; QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const; QPalette standardPalette() const; int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const; QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const; QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const; }; #endif // MPSSTYLE_H qt6-ukui-platformtheme/libqt6-ukui-style/internal-styles/internal-style.cpp0000664000175000017500000000210515154306200026151 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "internal-style.h" InternalStyle::InternalStyle(QStyle *parentStyle) : QProxyStyle (parentStyle) { } InternalStyle::InternalStyle(const QString parentStyleName) : QProxyStyle(parentStyleName) { } void InternalStyle::setUseSystemStyle(bool use) { Q_EMIT useSystemStylePolicyChanged(use); } qt6-ukui-platformtheme/libqt6-ukui-style/settings/0000775000175000017500000000000015154306200021200 5ustar fengfengqt6-ukui-platformtheme/libqt6-ukui-style/settings/ukui-style-settings.h0000664000175000017500000000263415154306200025327 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef UKUISTYLESETTINGS_H #define UKUISTYLESETTINGS_H #include "libqt5-ukui-style_global.h" #include //Fix me:after so //#include "ukui-style-conf-settings.h" /*! * \brief The UKUIStyleSettings class * \details * To distingust with other gsettings, I derived this class form QGSettings. * It just represent the specific gsettings "org.ukui.style", and * there is no api difference from UKUIStyleSettings to QGSettings. */ class LIBQT5UKUISTYLESHARED_EXPORT UKUIStyleSettings : public QGSettings { Q_OBJECT public: UKUIStyleSettings(); static UKUIStyleSettings *globalInstance(); }; #endif // UKUISTYLESETTINGS_H qt6-ukui-platformtheme/libqt6-ukui-style/settings/libqt5-ukui-style_global.h0000664000175000017500000000206215154306200026202 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef LIBQT5UKUISTYLE_GLOBAL_H #define LIBQT5UKUISTYLE_GLOBAL_H #include #if defined(LIBQT5UKUISTYLE_LIBRARY) # define LIBQT5UKUISTYLESHARED_EXPORT Q_DECL_EXPORT #else # define LIBQT5UKUISTYLESHARED_EXPORT Q_DECL_IMPORT #endif #endif // LIBQT5UKUISTYLE_GLOBAL_H qt6-ukui-platformtheme/libqt6-ukui-style/settings/black-list.h0000664000175000017500000000665315154306200023410 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef BLACKLIST_H #define BLACKLIST_H #include static const QStringList blackAppList() { QStringList l; //l<<"ukui-control-center"; l<<"kylin-software-center.py"; l<<"ubuntu-kylin-software-center.py"; // l<<"kylin-burner"; l<<"assistant"; l<<"sogouIme-configtool"; l<<"Ime Setting"; // l<<"kylin-user-guide"; l<<"biometric-authentication"; l<<"qtcreator"; return l; } static const QStringList blackAppListWithBlurHelper() { QStringList l; l<<"youker-assistant"; // l<<"kylin-assistant"; // l<<"kylin-video"; // l<<"ukui-control-center"; l<<"ubuntu-kylin-software-center.py"; // l<<"kylin-burner"; l<<"ukui-clipboard"; return l; } static const QStringList useDarkPaletteList() { //use dark palette in default style. QStringList l; // l<<"ukui-menu"; // l<<"ukui-panel"; // l<<"ukui-sidebar"; // l<<"ukui-volume-control-applet-qt"; // l<<"kylin-nm"; //网络 // l<<"panelukui-panel"; //日历 // l<<"ukui-power-manager-tray"; // l<<"ukui-bluetooth"; // l<<"sogouimebs"; //输入法 // l<<"kylin-device-daemon"; //U盘 // l<<"ukui-flash-disk"; // l<<"ukui-bluetooth"; // l<<"mktip"; // l<<"kylin-video"; return l; } static const QStringList useLightPaletteList() { //use light palette in default style. QStringList l; // l<<"kybackup"; // l<<"biometric-manager"; // l<<"kylin-video"; l<<"ukui-screensaver-dialog"; return l; } static const QStringList useTransparentButtonList() { //use transparent button QStringList l; // l<<"kybackup"; // l<<"biometric-manager"; l<<"kylin-video"; l<<"kylin-ipmsg"; l<<"kylin-weather"; l<<"ukui-notebook"; // l<<"kylin-recorder"; return l; } static const QStringList focusStateActiveList() { //focus state style QStringList l; l<<"ukui-menu"; l<<"platformthemeDemo"; l<<"ukui-greeter-dialog"; l<<"ukui-screensaver"; return l; } static const QStringList windowManageBlackList() { QStringList l; l << "iflyime-spe-sym"; l << "iflyime-qimpanel"; l << "iflyime-setw"; l << "iflyime-sett"; l << "iflyime-qim"; l << "iflyime-hw"; l << "SpecificSymbol"; return l; } // static const QStringList disableProgressBarAnimationList() {//不需要使用进度条动画的appName // QStringList l; // l << "ukui-settings-daemon"; // return l; // } static const QStringList ukuiFiledialogBlackList() { QStringList l; l << "Notepad--"; l << "mtxx"; return l; } #endif // BLACKLIST_H qt6-ukui-platformtheme/libqt6-ukui-style/settings/application-style-settings.cpp0000664000175000017500000001335615154306200027213 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "application-style-settings.h" #include #include #include #include #include static ApplicationStyleSettings *global_instance = nullptr; ApplicationStyleSettings *ApplicationStyleSettings::getInstance() { if (!global_instance) global_instance = new ApplicationStyleSettings; return global_instance; } const QString ApplicationStyleSettings::currentCustomStyleName() { if (m_style_stretagy == Default) return nullptr; return m_current_custom_style_name; } void ApplicationStyleSettings::setColor(const QPalette::ColorRole &role, const QColor &color, const QPalette::ColorGroup &group) { beginGroup(m_color_group_enum.key(group)); setValue(m_color_role_enum.key(role), color); endGroup(); QtConcurrent::run([=](){ this->sync(); }); auto palette = QApplication::palette(); palette.setColor(group, role, color); QApplication::setPalette(palette); // qApp->paletteChanged(palette); qApp->setPalette(palette); } const QColor ApplicationStyleSettings::getColor(const QPalette::ColorRole &role, const QPalette::ColorGroup &group) { beginGroup(m_color_role_enum.key(group)); auto data = value(m_color_role_enum.key(role)); QColor color = qvariant_cast(data); endGroup(); if (color.isValid()) return color; return QApplication::palette().color(group, role); } void ApplicationStyleSettings::setColorStretagy(ApplicationStyleSettings::ColorStretagy stretagy) { if (m_color_stretagy != stretagy) { m_color_stretagy = stretagy; setValue("color-stretagy", stretagy); Q_EMIT colorStretageChanged(stretagy); QtConcurrent::run([=](){ this->sync(); }); } } void ApplicationStyleSettings::setStyleStretagy(ApplicationStyleSettings::StyleStretagy stretagy) { if (m_style_stretagy != stretagy) { m_style_stretagy = stretagy; setValue("style-stretagy", stretagy); Q_EMIT styleStretageChanged(stretagy); QtConcurrent::run([=](){ this->sync(); }); } } void ApplicationStyleSettings::setCustomStyle(const QString &style) { m_current_custom_style_name = style; QApplication::setStyle(style); } void ApplicationStyleSettings::refreshData(bool forceSync) { sync(); m_custom_palette = QApplication::palette(); auto color_stretagy = qvariant_cast(value("color-stretagy")); if (color_stretagy != m_color_stretagy) { m_color_stretagy = color_stretagy; Q_EMIT colorStretageChanged(m_color_stretagy); } auto style_stretagy = qvariant_cast(value("style-stretagy")); if (style_stretagy != m_style_stretagy) { m_style_stretagy = style_stretagy; Q_EMIT styleStretageChanged(m_style_stretagy); } auto current_custom_style_name = value("custom-style").toString(); if (m_current_custom_style_name != current_custom_style_name) { m_current_custom_style_name = current_custom_style_name; QApplication::setStyle(m_current_custom_style_name); } readPalleteSettings(); if (forceSync) { QtConcurrent::run([=](){ this->sync(); }); } } void ApplicationStyleSettings::readPalleteSettings() { for (int i = 0; i < m_color_group_enum.keyCount(); i++) { beginGroup(m_color_group_enum.key(i)); for (int j = 0; j < m_color_role_enum.keyCount(); j++) { auto data = value(m_color_role_enum.key(j)); if (data.isValid()) { m_custom_palette.setColor(QPalette::ColorGroup(i), QPalette::ColorRole(j), qvariant_cast(data)); } } } } ApplicationStyleSettings::ApplicationStyleSettings(QObject *parent) : QSettings(parent) { /*! \todo make settings together into an ini file. */ // QString configFileName = QApplication::organizationDomain() + "." + QApplication::organizationName() + "." + QApplication::applicationName(); // QString configDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/" + "ukui"; // QString configPath = configDir + "/" + configFileName; // setPath(QSettings::IniFormat, QSettings::UserScope, configPath); // setDefaultFormat(QSettings::IniFormat); setDefaultFormat(QSettings::IniFormat); #if (QT_VERSION >= QT_VERSION_CHECK(5,10,0)) setAtomicSyncRequired(true); #endif m_color_stretagy = qvariant_cast(value("color-stretagy")); m_style_stretagy = qvariant_cast(value("style-stretagy")); m_current_custom_style_name = value("custom-style").toString(); m_custom_palette = QApplication::palette(); readPalleteSettings(); QFileSystemWatcher *watcher = new QFileSystemWatcher(this); watcher->addPath(fileName()); connect(watcher, &QFileSystemWatcher::fileChanged, [=](){ refreshData(); }); } qt6-ukui-platformtheme/libqt6-ukui-style/settings/ukui-style-conf-settings.h0000664000175000017500000000466615154306200026261 0ustar fengfeng/* * 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 . * * Authors: xibowen * */ #ifndef UKUISTYLECONFSETTINGS_H #define UKUISTYLECONFSETTINGS_H #include #include typedef struct _KSettings KSettings; class ukuiStyleConfSettings : public QObject { Q_OBJECT public: enum VariantClass { VARIANT_CLASS_BOOLEAN = 'b', VARIANT_CLASS_BYTE = 'y', VARIANT_CLASS_INT16 = 'n', VARIANT_CLASS_UINT16 = 'q', VARIANT_CLASS_INT32 = 'i', VARIANT_CLASS_UINT32 = 'u', VARIANT_CLASS_INT64 = 'x', VARIANT_CLASS_UINT64 = 't', VARIANT_CLASS_HANDLE = 'h', VARIANT_CLASS_DOUBLE = 'd', VARIANT_CLASS_STRING = 's', VARIANT_CLASS_OBJECT_PATH = 'o', VARIANT_CLASS_SIGNATURE = 'g', VARIANT_CLASS_VARIANT = 'v', VARIANT_CLASS_MAYBE = 'm', VARIANT_CLASS_ARRAY = 'a', VARIANT_CLASS_TUPLE = '(', VARIANT_CLASS_DICT_ENTRY = '{' }; ukuiStyleConfSettings(const QByteArray &schema_id); ~ukuiStyleConfSettings(); QVariant types_to_qvariant(const char *key, const char *value) const; static ukuiStyleConfSettings *globalInstance(); QVariant get(const QString &key) const; void set(const QString &key, const QVariant &value); bool trySet(const QString &key, const QVariant &value); QStringList keys() const; void reset(const QString &key); static bool isSettingsAvailable(const QString &schema_id); Q_SIGNALS: void changed(const QString &key); private: KSettings *ukuistyle_settings = NULL; long signal_handler_id; }; #endif // UKUISTYLECONFSETTINGS_H qt6-ukui-platformtheme/libqt6-ukui-style/settings/ukui-style-conf-settings.cpp0000664000175000017500000001412615154306200026604 0ustar fengfeng/* * 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 . * * Authors: xibowen * */ #include "ukui-style-conf-settings.h" #include "libkysettings.h" #include #include //char to QString QString qtify_name(const char *name) { bool next_cap = false; QString result; while (*name) { if (*name == '-') { next_cap = true; } else if (next_cap) { result.append(QChar(*name).toUpper().toLatin1()); next_cap = false; } else { result.append(*name); } name++; } return result; } //QString to char char * unqtify_name(const QString &name) { const char *p; QByteArray bytes; GString *str; bytes = name.toUtf8(); str = g_string_new (NULL); for (p = bytes.constData(); *p; p++) { const QChar c(*p); if (c.isUpper()) { g_string_append_c (str, '-'); g_string_append_c (str, c.toLower().toLatin1()); } else { g_string_append_c (str, *p); } } return g_string_free(str, FALSE); } static void settingChanged(KSettings *ukuistyle_settings, const char *key, void *user_data) { ukuiStyleConfSettings *self = (ukuiStyleConfSettings *)user_data; QMetaObject::invokeMethod(self, "changed", Qt::QueuedConnection, Q_ARG(QString, qtify_name(key))); } ukuiStyleConfSettings::ukuiStyleConfSettings(const QByteArray &schema_id) { if (!ukuistyle_settings) ukuistyle_settings = kdk_conf2_new(schema_id, NULL); signal_handler_id = kdk_conf2_connect_signal(ukuistyle_settings, "changed", (KCallBack)settingChanged, this); } ukuiStyleConfSettings::~ukuiStyleConfSettings() { if (ukuistyle_settings) { kdk_conf2_ksettings_destroy(ukuistyle_settings); ukuistyle_settings = NULL; } } QVariant ukuiStyleConfSettings::types_to_qvariant(const char *key,const char* value) const { char *type = kdk_conf2_get_type(this->ukuistyle_settings, key); switch (*type) { case VARIANT_CLASS_BOOLEAN: return QVariant(value); case VARIANT_CLASS_BYTE: return QVariant(QString(value)); case VARIANT_CLASS_INT16: return QVariant(QString(value).toShort()); case VARIANT_CLASS_UINT16: return QVariant(QString(value).toUShort()); case VARIANT_CLASS_INT32: return QVariant(QString(value).toInt()); case VARIANT_CLASS_UINT32: return QVariant(QString(value).toUInt()); case VARIANT_CLASS_INT64: return QVariant(QString(value).toLongLong()); case VARIANT_CLASS_UINT64: return QVariant(QString(value).toULongLong()); case VARIANT_CLASS_DOUBLE: return QVariant(QString(value).toDouble()); case VARIANT_CLASS_STRING: return QVariant(QString(value)); case VARIANT_CLASS_ARRAY: // if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING_ARRAY)) { // GVariantIter iter; // QStringList list; // const gchar *str; // g_variant_iter_init (&iter, value); // while (g_variant_iter_next (&iter, "&s", &str)) // list.append (str); // return QVariant(list); // } else if (g_variant_is_of_type(value, G_VARIANT_TYPE_BYTESTRING)) { // return QVariant(QByteArray(g_variant_get_bytestring(value))); // } else if (g_variant_is_of_type(value, G_VARIANT_TYPE("a{ss}"))) { // GVariantIter iter; // QMap map; // const gchar *key; // const gchar *val; // g_variant_iter_init (&iter, value); // while (g_variant_iter_next (&iter, "{&s&s}", &key, &val)) // map.insert(key, QVariant(val)); // return map; // } // fall through default: g_assert_not_reached(); } } QVariant ukuiStyleConfSettings::get(const QString &key) const { char *ckey = unqtify_name(key); char *value = kdk_conf2_get_value(ukuistyle_settings, ckey); QVariant qvalue = types_to_qvariant(ckey, value); g_free(value); g_free(ckey); return qvalue; } void ukuiStyleConfSettings::set(const QString &key, const QVariant &value) { if (!this->trySet(key, value)) qWarning("unable to set key '%s' to value '%s'", key.toUtf8().constData(), value.toString().toUtf8().constData()); } bool ukuiStyleConfSettings::trySet(const QString &key, const QVariant &value) { if (!ukuistyle_settings) return false; char *ckey = unqtify_name(key); char *cvalue = unqtify_name(value.value()); bool success = false; success = kdk_conf2_set_value(ukuistyle_settings, ckey, cvalue); g_free(ckey); g_free(cvalue); return success; } QStringList ukuiStyleConfSettings::keys() const { QStringList list; char **keys = kdk_conf2_list_keys(ukuistyle_settings); for (int i = 0; keys[i]; i++) list.append(qtify_name(keys[i])); g_strfreev(keys); return list; } void ukuiStyleConfSettings::reset(const QString &qkey) { if (!ukuistyle_settings) return; char *key = unqtify_name(qkey); kdk_conf2_reset(ukuistyle_settings, key); g_free(key); } bool ukuiStyleConfSettings::isSettingsAvailable(const QString &schema_id) { char *schema = unqtify_name(schema_id); bool result = false; if (kdk_conf2_new(schema, NULL)) { result = true; } g_free(schema); return result; } qt6-ukui-platformtheme/libqt6-ukui-style/settings/ukui-style-settings.cpp0000664000175000017500000000216315154306200025657 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "ukui-style-settings.h" static UKUIStyleSettings *global_instance = nullptr; UKUIStyleSettings::UKUIStyleSettings() : QGSettings ("org.ukui.style", "/org/ukui/style/") { } UKUIStyleSettings *UKUIStyleSettings::globalInstance() { if (!global_instance){ global_instance = new UKUIStyleSettings; } return global_instance; } qt6-ukui-platformtheme/libqt6-ukui-style/settings/org.ukui.style.gschema.xml0000664000175000017500000001171215154306200026234 0ustar fengfeng "ukui-light" Current Qt Style Set style for UKUI desktop environment. Have ukui-dark ukui-default ukui-light "ukui-icon-theme-default" Icon Theme for Qt Applications. Icon Theme for Qt Applications.Have ukui ukui-classical ukui-fashion "default" Current widget theme name Set system theme. Have default,classical and fashion "Noto Sans CJK SC" System Font for Qt Applications. System Font for Qt Applications. "10" System Font Size for Qt Applications. System Font Size for Qt Applications. Use point size. true Enable Window Blur Effects. Globally enable or disable the window blur effects for transparent window. Setting it to "false" will disable the effects. 65 Menu's transparency. The default transparency of menu. 65 Peony::SideBar's transparency. The default transparency of the peony side bar. "[]" a list of QWidget based classes do not blur. Example: [QWidget, QWidget1, QWidget2] false Use system palette. Globally enable or disable system palette provided by ukui platform. "" System Palette Set default system palette for UKUI desktop environment. "55,144,250,1" theme color Set theme color for UKUI desktop environment.include default,daybreakBlue,jamPurple,magenta,sunRed,sunsetOrange,dustGold,polarGreen, and using rgba for example "(125,125,125) or #3790FA" true Blink text cursor. Globally enable or disable blinking text cursor. 1200 Blink text cursor interval. The interval of text cursor blink. false Use custom highlight color. Globally enable or disable custom highlight color.Now is to compatible with third party application "#3D6BE5" Custom highlight color Set custom highlight color for UKUI desktop environment.Now is to compatible with third party application "12,8" Window Radius The first represents regular window corner, and second represents menu and tooltip radius "listview" FileDialog view model View display mode of the file dialog. qt6-ukui-platformtheme/libqt6-ukui-style/settings/application-style-settings.h0000664000175000017500000000562715154306200026662 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef APPLICATIONSTYLESETTINGS_H #define APPLICATIONSTYLESETTINGS_H #include #include #include class QStyle; /*! * \brief The ApplicationStyleSettings class * \details * This class is used to decide the style switch stretagies for independent application. * For example, you can choose the color scheme switch stretagy of an application, hold * the color in light or dark, or follow the system's palette. * * \note * This API is unstable, if possible, do not use it. */ class ApplicationStyleSettings : public QSettings { Q_OBJECT public: enum ColorStretagy { System, Bright, Dark, Other }; Q_ENUM(ColorStretagy) enum StyleStretagy { Default, Custom }; Q_ENUM(StyleStretagy) static ApplicationStyleSettings *getInstance(); ColorStretagy currentColorStretagy() {return m_color_stretagy;} StyleStretagy currentStyleStretagy() {return m_style_stretagy;} const QString currentCustomStyleName(); void setColor(const QPalette::ColorRole &role, const QColor &color, const QPalette::ColorGroup &group = QPalette::Active); const QColor getColor(const QPalette::ColorRole &role, const QPalette::ColorGroup &group = QPalette::Active); QPalette getCustomPalette() {return m_custom_palette;} signals: void colorStretageChanged(const ColorStretagy &stretagy); void styleStretageChanged(const StyleStretagy &stretagy); public slots: void setColorStretagy(ColorStretagy stretagy); void setStyleStretagy(StyleStretagy stretagy); void setCustomStyle(const QString &style); protected: void refreshData(bool forceSync = false); void readPalleteSettings(); private: explicit ApplicationStyleSettings(QObject *parent = nullptr); ~ApplicationStyleSettings() {} ColorStretagy m_color_stretagy; StyleStretagy m_style_stretagy; QString m_current_custom_style_name; QMetaEnum m_color_role_enum = QMetaEnum::fromType(); QMetaEnum m_color_group_enum = QMetaEnum::fromType(); QPalette m_custom_palette; }; #endif // APPLICATIONSTYLESETTINGS_H qt6-ukui-platformtheme/libqt6-ukui-style/settings/org.ukui.style.yaml0000664000175000017500000000672515154306200025000 0ustar fengfengstyle: 4.3.1.2: keys: blur-exception-classes: _type: s default: '[]' description: 'Example: [QWidget, QWidget1, QWidget2]' summary: a list of QWidget based classes do not blur. cursor-blink: _type: b default: 'true' description: Globally enable or disable blinking text cursor. summary: Blink text cursor. cursor-blink-time: _type: i default: '1200' description: The interval of text cursor blink. summary: Blink text cursor interval. custom-highlight-color: _type: s default: '#3D6BE5' description: Set custom highlight color for UKUI desktop environment.Now is to compatible with third party application summary: Custom highlight color enabled-global-blur: _type: b default: 'true' description: "Globally enable or disable the window blur effects for transparent\ \ window.\n Setting it to \"false\" will disable the effects." summary: Enable Window Blur Effects. icon-theme-name: _type: s default: ukui-icon-theme-default description: Icon Theme for Qt Applications.Have ukui ukui-classical ukui-fashion summary: Icon Theme for Qt Applications. menu-transparency: _type: i default: '72' description: The default transparency of menu. summary: Menu's transparency. peony-side-bar-transparency: _type: i default: '72' description: The default transparency of the peony side bar. summary: Peony::SideBar's transparency. style-name: _type: s default: ukui-light description: Set style for UKUI desktop environment. Have ukui-dark ukui-default ukui-light summary: Current Qt Style system-font: _type: s default: Noto Sans CJK SC description: System Font for Qt Applications. summary: System Font for Qt Applications. system-font-size: _type: s default: '11' description: System Font Size for Qt Applications. Use point size. summary: System Font Size for Qt Applications. system-palette: _type: s default: '' description: Set default system palette for UKUI desktop environment. summary: System Palette theme-color: _type: s default: '#3790FA' description: "Set theme color for UKUI desktop environment.include default,daybreakBlue,jamPurple,magenta,sunRed,sunsetOrange,dustGold,polarGreen,\n\ \ and using rgba for example \"(125,125,125) or #3790FA" summary: theme color use-custom-highlight-color: _type: b default: 'false' description: Globally enable or disable custom highlight color.Now is to compatible with third party application summary: Use custom highlight color. use-system-palette: _type: b default: 'false' description: Globally enable or disable system palette provided by ukui platform. summary: Use system palette. widget-theme-name: _type: s default: default description: Set system theme. Have default,classical and fashion summary: Current widget theme name window-radius: _type: i default: '12' description: Set the rounded corner size of the window range: 0,12 summary: Window Radius qt6-ukui-platformtheme/libqt6-ukui-style/development-files/0000775000175000017500000000000015154306200022762 5ustar fengfengqt6-ukui-platformtheme/libqt6-ukui-style/development-files/qt6-ukui.pc0000664000175000017500000000046315154306200024776 0ustar fengfengName: libqt6-ukui-style Description: UKUI style API for secondary development. Home Page: https://github.com/ukui/qt5-ukui-platformtheme Requires: Qt5Widgets >= 5.12.1 glib-2.0 gio-2.0 gsettings-qt Version: 1.0.0 Libs: -L/usr/lib -L/usr/lib/x86_64-linux-gnu -lqt6-ukui-style Cflags: -I/usr/include/qt5-ukui qt6-ukui-platformtheme/libqt6-ukui-style/gestures/0000775000175000017500000000000015154306200021201 5ustar fengfengqt6-ukui-platformtheme/libqt6-ukui-style/gestures/ukui-two-finger-zoom-gesture.cpp0000664000175000017500000001624315154306200027405 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "ukui-two-finger-zoom-gesture.h" #include #include #include #include using namespace UKUI; TwoFingerZoomGesture::TwoFingerZoomGesture(QObject *parent) : QGesture(parent) { } UKUI::TwoFingerZoomGestureRecognizer::TwoFingerZoomGestureRecognizer() : QGestureRecognizer() { } QGesture *TwoFingerZoomGestureRecognizer::create(QObject *target) { if (target && target->isWidgetType()) static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); return new TwoFingerZoomGesture; } QGestureRecognizer::Result TwoFingerZoomGestureRecognizer::recognize(QGesture *gesture, QObject *watched, QEvent *event) { if (auto touchEvent = static_cast(event)) { auto zoomGesture = static_cast(gesture); switch (touchEvent->type()) { case QEvent::TouchBegin: gesture->setHotSpot(touchEvent->touchPoints().first().screenPos()); return QGestureRecognizer::MayBeGesture; break; case QEvent::TouchUpdate: { if (touchEvent->touchPoints().count() != 2) return QGestureRecognizer::Ignore; switch (zoomGesture->zoomDirection()) { case TwoFingerZoomGesture::Invalid: { zoomGesture->m_start_points.first = touchEvent->touchPoints().first().pos().toPoint(); zoomGesture->m_start_points.second = touchEvent->touchPoints().last().pos().toPoint(); zoomGesture->m_last_points = zoomGesture->m_start_points; zoomGesture->m_current_points = zoomGesture->m_start_points; zoomGesture->m_start_points_distance = (zoomGesture->m_start_points.first - zoomGesture->m_start_points.second).manhattanLength(); zoomGesture->m_last_points_distance = zoomGesture->m_start_points_distance; zoomGesture->m_zoom_direction = TwoFingerZoomGesture::Unkown; return QGestureRecognizer::TriggerGesture; } case TwoFingerZoomGesture::Unkown: { zoomGesture->m_last_points = zoomGesture->m_current_points; zoomGesture->m_current_points.first = touchEvent->touchPoints().first().pos().toPoint(); zoomGesture->m_current_points.second = touchEvent->touchPoints().last().pos().toPoint(); qreal currentPointsDistance = (zoomGesture->m_current_points.first - zoomGesture->m_current_points.second).manhattanLength(); qreal totalDelta = currentPointsDistance - zoomGesture->m_start_points_distance; //qDebug()<m_start_points_distance< 100) { zoomGesture->m_last_points_distance = currentPointsDistance; if (totalDelta > 0) { zoomGesture->m_zoom_direction = TwoFingerZoomGesture::ZoomIn; } else { zoomGesture->m_zoom_direction = TwoFingerZoomGesture::ZoomOut; } return QGestureRecognizer::TriggerGesture; } else { return QGestureRecognizer::MayBeGesture; } break; } case TwoFingerZoomGesture::ZoomIn: { // check if gesture should trigger or cancel auto tmp = zoomGesture->m_current_points; zoomGesture->m_current_points.first = touchEvent->touchPoints().first().pos().toPoint(); zoomGesture->m_current_points.second = touchEvent->touchPoints().last().pos().toPoint(); qreal currentPointsDistance = (zoomGesture->m_current_points.first - zoomGesture->m_current_points.second).manhattanLength(); qreal distanceOffset = currentPointsDistance - zoomGesture->m_last_points_distance; if (distanceOffset > 0) { // trigger zoom in zoomGesture->m_last_points = tmp; return QGestureRecognizer::TriggerGesture; } else { if (qAbs(distanceOffset) < 100) { return QGestureRecognizer::Ignore; } else { return QGestureRecognizer::CancelGesture; } } } case TwoFingerZoomGesture::ZoomOut: { // check if gesture should trigger or cancel auto tmp = zoomGesture->m_current_points; zoomGesture->m_current_points.first = touchEvent->touchPoints().first().pos().toPoint(); zoomGesture->m_current_points.second = touchEvent->touchPoints().last().pos().toPoint(); qreal currentPointsDistance = (zoomGesture->m_current_points.first - zoomGesture->m_current_points.second).manhattanLength(); qreal distanceOffset = currentPointsDistance - zoomGesture->m_last_points_distance; if (distanceOffset < 0) { // trigger zoom out zoomGesture->m_last_points = tmp; return QGestureRecognizer::TriggerGesture; } else { if (qAbs(distanceOffset) < 100) { return QGestureRecognizer::Ignore; } else { return QGestureRecognizer::CancelGesture; } } } } break; } case QEvent::TouchCancel: reset(gesture); return QGestureRecognizer::CancelGesture; case QEvent::TouchEnd: reset(gesture); return QGestureRecognizer::FinishGesture; default: break; } } return QGestureRecognizer::Ignore; } void TwoFingerZoomGestureRecognizer::reset(QGesture *gesture) { auto zoomGesture = static_cast(gesture); zoomGesture->m_start_points.first = QPoint(); zoomGesture->m_start_points.second = QPoint(); zoomGesture->m_current_points.first = QPoint(); zoomGesture->m_current_points.second = QPoint(); zoomGesture->m_zoom_direction = TwoFingerZoomGesture::Invalid; QGestureRecognizer::reset(gesture); } qt6-ukui-platformtheme/libqt6-ukui-style/gestures/ukui-two-finger-slide-gesture.h0000664000175000017500000000354315154306200027165 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef TWOFINGERSLIDEGESTURE_H #define TWOFINGERSLIDEGESTURE_H #include #include namespace UKUI { class TwoFingerSlideGesture : public QGesture { friend class TwoFingerSlideGestureRecognizer; Q_OBJECT public: enum Direction { Invalid, Horizal, Vertical }; explicit TwoFingerSlideGesture(QObject *parent = nullptr); ~TwoFingerSlideGesture(){} Direction direction() {return m_direction;} const QPoint startPos() {return m_start_pos;} const QPoint currentPos() {return m_current_pos;} int delta(); int totalDelta(); private: QPoint m_start_pos; QPoint m_last_pos; QPoint m_current_pos; Direction m_direction = Invalid; }; class TwoFingerSlideGestureRecognizer : public QGestureRecognizer { public: explicit TwoFingerSlideGestureRecognizer(); QGesture *create(QObject *target) override; QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event) override; void reset(QGesture *gesture) override; }; } #endif // TWOFINGERSLIDEGESTURE_H qt6-ukui-platformtheme/libqt6-ukui-style/gestures/ukui-two-finger-zoom-gesture.h0000664000175000017500000000415415154306200027050 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #ifndef TWOFINGERZOOMGESTURE_H #define TWOFINGERZOOMGESTURE_H #include #include #include namespace UKUI { class TwoFingerZoomGesture : public QGesture { friend class TwoFingerZoomGestureRecognizer; Q_OBJECT public: enum Direction { Invalid, Unkown, ZoomIn, ZoomOut }; explicit TwoFingerZoomGesture(QObject *parent = nullptr); ~TwoFingerZoomGesture(){} Direction zoomDirection() {return m_zoom_direction;} QPair startPoints() {return m_start_points;} QPair lastPoints() {return m_last_points;} QPair currentPoints() {return m_current_points;} private: QPair m_start_points; QPair m_last_points; QPair m_current_points; qreal m_start_points_distance = -1; qreal m_last_points_distance = -1; Direction m_zoom_direction = Invalid; }; class TwoFingerZoomGestureRecognizer : public QGestureRecognizer { public: explicit TwoFingerZoomGestureRecognizer(); ~TwoFingerZoomGestureRecognizer(){} QGesture *create(QObject *target) override; QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event) override; void reset(QGesture *gesture) override; }; } #endif // TWOFINGERZOOMGESTURE_H qt6-ukui-platformtheme/libqt6-ukui-style/gestures/ukui-two-finger-slide-gesture.cpp0000664000175000017500000001402115154306200027511 0ustar fengfeng/* * 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 . * * Authors: Yue Lan * */ #include "ukui-two-finger-slide-gesture.h" #include #include #include #include using namespace UKUI; TwoFingerSlideGesture::TwoFingerSlideGesture(QObject *parent) : QGesture(parent) { } int TwoFingerSlideGesture::delta() { switch (m_direction) { case Horizal: return m_current_pos.x() - m_last_pos.x(); case Vertical: return m_current_pos.y() - m_last_pos.y(); case Invalid: return 0; } return 0; } int TwoFingerSlideGesture::totalDelta() { switch (m_direction) { case Horizal: return m_current_pos.x() - m_start_pos.x(); case Vertical: return m_current_pos.y() - m_start_pos.y(); case Invalid: return 0; } return 0; } TwoFingerSlideGestureRecognizer::TwoFingerSlideGestureRecognizer() : QGestureRecognizer() { } QGesture *TwoFingerSlideGestureRecognizer::create(QObject *target) { //qDebug()<<"create"; if (target && target->isWidgetType()) static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); return new TwoFingerSlideGesture; } QGestureRecognizer::Result TwoFingerSlideGestureRecognizer::recognize(QGesture *gesture, QObject *watched, QEvent *event) { if (auto touchEvent = static_cast(event)) { auto slideGesture = static_cast(gesture); switch (event->type()) { case QEvent::TouchBegin: { slideGesture->m_start_pos = touchEvent->touchPoints().first().pos().toPoint(); slideGesture->m_current_pos = touchEvent->touchPoints().first().pos().toPoint(); slideGesture->m_last_pos = touchEvent->touchPoints().first().pos().toPoint(); gesture->setHotSpot(touchEvent->touchPoints().first().screenPos()); return QGestureRecognizer::MayBeGesture; break; } case QEvent::TouchUpdate: { // only support 2 fingers if (touchEvent->touchPoints().count() != 2) return QGestureRecognizer::Ignore; if (touchEvent->touchPointStates() & Qt::TouchPointPressed) { if (touchEvent->touchPoints().count() == 2) { // update start point center slideGesture->m_start_pos = (touchEvent->touchPoints().first().pos().toPoint() + touchEvent->touchPoints().last().pos().toPoint())/2; //qDebug()<<"update start point"<startPos(); return QGestureRecognizer::MayBeGesture; } } if (touchEvent->touchPointStates() & Qt::TouchPointMoved) { // initial slide gesture direction, note that // once direction ensured, it will not be changed // untill the gesture finished or cancelled. if (slideGesture->direction() == TwoFingerSlideGesture::Invalid) { qreal distance = (touchEvent->touchPoints().first().pos().toPoint() - touchEvent->touchPoints().last().pos().toPoint()).manhattanLength(); // we should distinguish slide and pinch zoom gesture. if (distance > 200) return QGestureRecognizer::Ignore; QPoint offset = (touchEvent->touchPoints().first().pos().toPoint() + touchEvent->touchPoints().last().pos().toPoint())/2 - slideGesture->startPos(); //qDebug()< 50) { slideGesture->m_direction = TwoFingerSlideGesture::Vertical; slideGesture->m_current_pos = touchEvent->touchPoints().first().pos().toPoint(); return QGestureRecognizer::TriggerGesture; } else if (qAbs(offset.x()) > 50) { slideGesture->m_direction = TwoFingerSlideGesture::Horizal; slideGesture->m_current_pos = touchEvent->touchPoints().first().pos().toPoint(); return QGestureRecognizer::TriggerGesture; } else { // if offset set not enough, ignore. return QGestureRecognizer::Ignore; } } else { // update gesture slideGesture->m_last_pos = slideGesture->m_current_pos; slideGesture->m_current_pos = touchEvent->touchPoints().first().pos().toPoint(); return QGestureRecognizer::TriggerGesture; } } break; } case QEvent::TouchEnd: { reset(slideGesture); return QGestureRecognizer::FinishGesture; } case QEvent::TouchCancel: { reset(slideGesture); return QGestureRecognizer::CancelGesture; } default: break; } } return QGestureRecognizer::Ignore; } void TwoFingerSlideGestureRecognizer::reset(QGesture *gesture) { //qDebug()<<"reset"; auto slideGesture = static_cast(gesture); slideGesture->m_current_pos = QPoint(); slideGesture->m_last_pos = QPoint(); slideGesture->m_start_pos = QPoint(); slideGesture->m_direction = TwoFingerSlideGesture::Invalid; QGestureRecognizer::reset(gesture); } qt6-ukui-platformtheme/COPYING0000664000175000017500000001674415154306200015075 0ustar fengfeng GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. qt6-ukui-platformtheme/.github/0000775000175000017500000000000015154306200015366 5ustar fengfengqt6-ukui-platformtheme/.github/workflows/0000775000175000017500000000000015154306200017423 5ustar fengfengqt6-ukui-platformtheme/.github/workflows/build.yml0000664000175000017500000000733015154306200021250 0ustar fengfengname: Check build on: push: branches: - master pull_request: branches: - master schedule: - cron: '0 0 * * *' jobs: archlinux-latest: name: on Archlinux Latest runs-on: ubuntu-20.04 container: docker.io/library/archlinux:latest steps: - name: Checkout qt5-ukui-platformtheme source code uses: actions/checkout@v2 - name: Refresh pacman repository run: pacman -Sy - name: Install build dependencies run: pacman -S --noconfirm base-devel qt5-base gsettings-qt kwindowsystem qt5-tools dconf glibc - name: QMake configure & Make run: | mkdir build; cd build; qmake-qt5 ..; make -j$(nproc); debian-sid: name: on Debian Sid runs-on: ubuntu-20.04 container: docker.io/library/debian:sid env: DEBIAN_FRONTEND: noninteractive steps: - name: Checkout qt5-ukui-platformtheme source code uses: actions/checkout@v2 - name: Update apt repository run: apt-get update -y - name: Install build dependcies run: apt-get install -y build-essential qttools5-dev-tools debhelper-compat pkg-kde-tools libglib2.0-dev libqt5x11extras5-dev libkf5windowsystem-dev libgsettings-qt-dev pkg-config qt5-qmake qtbase5-dev qtbase5-dev-tools qtbase5-private-dev qtchooser qttools5-dev-tools - name: QMake configure & Make run: | mkdir build; cd build; qmake ..; make -j$(nproc); fedora-latest: name: on Fedora Latest runs-on: ubuntu-20.04 container: docker.io/library/fedora:latest steps: - name: Checkout qt5-ukui-platformtheme source code uses: actions/checkout@v2 - name: Install build dependencies run: dnf install -y which gcc gcc-c++ make cmake cmake-rpm-macros autoconf automake intltool rpm-build qt5-rpm-macros glib2-devel qt5-qtx11extras-devel kf5-kwindowsystem-devel gsettings-desktop-schemas-devel qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtbase-static qt5-qttools-devel gsettings-qt-devel - name: QMake configure & Make run: | mkdir build; cd build; qmake-qt5 ..; make -j$(nproc); fedora-rawhide: name: on Fedora Rawhide runs-on: ubuntu-20.04 container: docker.io/library/fedora:rawhide steps: - name: Checkout peony source code uses: actions/checkout@v2 - name: Install build dependencies run: dnf install --refresh --nogpg -y make gcc gcc-c++ which cmake cmake-rpm-macros autoconf automake intltool rpm-build qt5-rpm-macros glib2-devel qt5-qtx11extras-devel kf5-kwindowsystem-devel gsettings-desktop-schemas-devel qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtbase-static qt5-qttools-devel gsettings-qt-devel - name: QMake configure & Make run: | mkdir build; cd build; qmake-qt5 ..; make -j$(nproc); ubuntu-latest: name: on Ubuntu Latest runs-on: ubuntu-20.04 container: docker.io/library/ubuntu:latest env: DEBIAN_FRONTEND: noninteractive steps: - name: Checkout qt5-ukui-platformtheme source code uses: actions/checkout@v2 - name: Update apt repository run: apt-get update -y - name: Install build dependcies run: apt-get install -y build-essential qt5-default qttools5-dev-tools qtmultimedia5-dev debhelper-compat pkg-kde-tools libglib2.0-dev libqt5x11extras5-dev libkf5windowsystem-dev libgsettings-qt-dev pkg-config qt5-qmake qtbase5-dev qtbase5-dev-tools qtbase5-private-dev qtchooser qttools5-dev-tools - name: QMake configure & Make run: | mkdir build; cd build; qmake ..; make -j$(nproc); qt6-ukui-platformtheme/CONTRIBUTING_zh_CN.md0000664000175000017500000000737215154306200017351 0ustar fengfeng# 贡献指南 ## 写给使用者 UKUI的使用者都是此项目的用户,因为它影响了所有UKUI上的Qt应用,我们能从一个标准qt应用的按钮圆角弧度,菜单透明度,动画以及毛玻璃特效等方面看到它对控件样式带来的影响。 我们希望用户能够指出我们在应用和主题风格设计上的不统一处,以及视觉上的不足与问题,这些都有助于我们对项目进行有针对性的提升。 当然,UKUI主题框架不可能接管所有应用的控件风格与绘制,一个应用可能希望保持自己的主题,或者针对现有主题的不足进行改进。对于用户来说,可能很难分辨一个控件是否是属于UKUI主题框架内的标准控件,而只能够发现风格上的不同。 无论如何,如果你找到了视觉上的问题,你都可以向我们提交issue,可以在相应的应用项目中,也可以在这里。 ## 写给开发者 如果你对Qt5 QPA PlatformTheme以及QStyle比较熟悉,那么你应该能够很快的了解这个项目,并且知道如何参与其中。和其它platform theme,如qt5-gtk2-platformtheme、qt5ct、KDE等项目一样,我们希望通过提供平台插件和主题风格插件来构建我们自己的桌面环境主题,这样做将意味着不光是我们自己开发的应用,其它开发这开发的Qt应用也将会在我们的桌面环境中具有UKUI的风格。 这种做法将从根本上解决Qt开发者不得不花费大量时间去调整自己应用的样式以达到接近UKUI设计风格的问题。我们希望开发者花费更多时间在业务逻辑和功能实现上,并且还能够保证应用在其它平台上(如KDE)也能够具有风格的统一性。 为了实现这一目标,我需要开发者们的理解和支持。开发者首先需要知道如何以标准的方式进行应用的开发,然后还需要掌握如何在标准之上针对需求进行合理的调优。通过自己体验这样的流程,你将明白它的长远意义。 现在,我几乎将我全部的精力投入到这个项目的开发中去了,然而它的推进仍然十分缓慢。我一个人很难在短时间内解决所有的问题,所以希望有志愿者能够帮助我。我简单的列出了一些问题: ### Platform Theme层面 和其它platform theme一样,我们希望在UKUI中提供其它platform theme所提供的特性。 - 平台对话框,比如文件选择对话框 - 平台配置,比如字体配置 - 平台扩展,比如全局菜单 当然,Gtk应用的主题风格与Qt应用的风格主题也是一个比较棘手的问题,我们需要考虑怎样合理的统一它们。 ### Style层面 一个好看的主题往往是极其复杂的,比如breeze和oxygen。要构建我们自己的主题,我们需要花费大量的时间在UI设计和细节优化上。作为一名开发者,我们需要做的是将设计稿的内容转化成代码,这大致可以分为2个部分: - 控件的样式绘制与调优,比如按钮菜单的圆角弧度,调色板中的颜色等 - 动画与控件的结合,比如标签页的滑动切换,按钮的悬浮与渐变效果等 你首先得了解QStyle和主题插件的相关流程,它们是怎么绘制一个控件,怎么让控件具有动画效果的。 ### 动画框架层 动画框架一般来说基于Qt的Animation框架,它的目标是: - 让widgets和视图元素具有动画效果,并且让状态的改版更加的平滑和炫酷 需要注意的是动画框架是相对独立的,然而它对主题的影响还是非常之大。 ## 积极的交流 如果你对参与项目感兴趣,我也乐意尽力帮助你熟悉这个项目。你可以以提交issue的方式作为开始,也可以通过邮件与我交流。 Yue Lan, qt6-ukui-platformtheme/doxygen/0000775000175000017500000000000015154306200015503 5ustar fengfengqt6-ukui-platformtheme/doxygen/Doxyfile.in0000664000175000017500000032407315154306200017627 0ustar fengfeng# Doxyfile 1.8.13 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. # # All text after a single hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv # built into libc) for the transcoding. See http://www.gnu.org/software/libiconv # for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by # double-quotes, unless you are using Doxywizard) that should identify the # project for which the documentation is generated. This name is used in the # title of most generated pages and in a few other places. # The default value is: My Project. PROJECT_NAME = "Qt5 UKUI" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. OUTPUT_DIRECTORY = out # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and # will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes # performance problems for the file system. # The default value is: NO. CREATE_SUBDIRS = YES # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode # U+3044. # The default value is: NO. ALLOW_UNICODE_NAMES = YES # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, # Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), # Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, # Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, # Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, # Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, # Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief # description of a member or function before the detailed description # # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. # The default value is: YES. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator that is # used to form the text in various listings. Each string in this list, if found # as the leading text of the brief description, will be stripped from the text # and the result, after processing the whole list, is used as the annotated # text. Otherwise, the brief description is used as-is. If left blank, the # following values are used ($name is automatically replaced with the name of # the entity):The $name class, The $name widget, The $name file, is, provides, # specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # doxygen will generate a detailed section even if there is only a brief # description. # The default value is: NO. ALWAYS_DETAILED_SEC = YES # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. # The default value is: NO. INLINE_INHERITED_MEMB = YES # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. FULL_PATH_NAMES = YES # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. # Stripping is only done if one of the specified strings matches the left-hand # part of the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the path to # strip. # # Note that you can specify absolute paths here, but also relative paths, which # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which # header file to include in order to use a class. If left blank only the name of # the header file containing the class definition is used. Otherwise one should # specify the list of include paths that are normally passed to the compiler # using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't # support long names like on DOS, Mac, or CD-ROM. # The default value is: NO. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the # first line (until the first dot) of a Javadoc-style comment as the brief # description. If set to NO, the Javadoc-style will behave just like regular Qt- # style comments (thus requiring an explicit @brief command for a brief # description.) # The default value is: NO. JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus # requiring an explicit \brief command for a brief description.) # The default value is: NO. QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a # multi-line C++ special comment block (i.e. a block of //! or /// comments) as # a brief description. This used to be the default behavior. The new default is # to treat a multi-line C++ comment block as a detailed description. Set this # tag to YES if you prefer the old behavior instead. # # Note that setting this tag to YES also means that rational rose comments are # not recognized any more. # The default value is: NO. MULTILINE_CPP_IS_BRIEF = YES # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new # page for each member. If set to NO, the documentation of a member will be part # of the file/class/namespace that contains it. # The default value is: NO. SEPARATE_MEMBER_PAGES = YES # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen # uses this value to replace tabs by spaces in code fragments. # Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that act as commands in # the documentation. An alias has the form: # name=value # For example adding # "sideeffect=@par Side Effects:\n" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert # newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" # will allow you to use the command class in the itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all # members will be omitted, etc. # The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Python sources only. Doxygen will then generate output that is more tailored # for that language. For instance, namespaces will be presented as packages, # qualified scopes will look different, etc. # The default value is: NO. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources. Doxygen will then generate output that is tailored for Fortran. # The default value is: NO. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for VHDL. # The default value is: NO. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, Javascript, # C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: # FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: # Fortran. In the later case the parser tries to guess whether the code is fixed # or free formatted code, this is the default for Fortran type files), VHDL. For # instance to make doxygen treat .inc files as Fortran files (default is PHP), # and .f files as C (default is Fortran), use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. # The default value is: YES. MARKDOWN_SUPPORT = YES # When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. # Minimum value: 0, maximum value: 99, default value: 0. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = 0 # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should set this # tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); # versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. # The default value is: NO. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. # The default value is: NO. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: # http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES will make # doxygen to replace the get and set methods by a property in the documentation. # This will only work if the methods are indeed getting or setting a simple # type. If this is not the case, or you want to show the methods anyway, you # should set this option to NO. # The default value is: YES. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = NO # If one adds a struct or class to a group and this option is enabled, then also # any nested class or struct is added to the same group. By default this option # is disabled and one has to add nested compounds explicitly via \ingroup. # The default value is: NO. GROUP_NESTED_COMPOUNDS = NO # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent # subgrouping. Alternatively, this can be done per class using the # \nosubgrouping command. # The default value is: YES. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions # are shown inside the group in which they are included (e.g. using \ingroup) # instead of on a separate page (for HTML and Man pages) or section (for LaTeX # and RTF). # # Note that this feature does not work in combination with # SEPARATE_MEMBER_PAGES. # The default value is: NO. INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions # with only public data fields or simple typedef fields will be shown inline in # the documentation of the scope in which they are defined (i.e. file, # namespace, or group documentation), provided this scope is documented. If set # to NO, structs, classes, and unions are shown on a separate page (for HTML and # Man pages) or section (for LaTeX and RTF). # The default value is: NO. INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or # enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically be # useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. # The default value is: NO. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. # Note: This will also disable the warnings about undocumented members that are # normally produced when WARNINGS is set to YES. # The default value is: NO. EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined # locally in source files will be included in the documentation. If set to NO, # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. If set to YES, local methods, # which are defined in the implementation section but not in the interface are # included in the documentation. If set to NO, only methods in the interface are # included. # The default value is: NO. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base name of # the file that contains the anonymous namespace. By default anonymous namespace # are hidden. # The default value is: NO. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation # section is generated. This option has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option # has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend # (class|struct|union) declarations. If set to NO, these declarations will be # included in the documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any # documentation blocks found inside the body of a function. If set to NO, these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation that is typed after a # \internal command is included. If the tag is set to NO then the documentation # will be excluded. Set it to YES to include the internal documentation. # The default value is: NO. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file # names in lower-case letters. If set to YES, upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. # The default value is: system dependent. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES, the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = NO # If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will # append additional text to a page's title, such as Class Reference. If set to # YES the compound reference will be hidden. # The default value is: NO. HIDE_COMPOUND_REFERENCE= NO # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. SHOW_INCLUDE_FILES = YES # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each # grouped member an include statement to the documentation, telling the reader # which file to include in order to use the member. # The default value is: NO. SHOW_GROUPED_MEMB_INC = NO # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include # files with double quotes in the documentation rather than with sharp brackets. # The default value is: NO. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the # documentation for inline members. # The default value is: YES. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. Note that # this will also influence the order of the classes in the class list. # The default value is: NO. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and # destructors are listed first. If set to NO the constructors will appear in the # respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. # Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief # member documentation. # Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting # detailed member documentation. # The default value is: NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy # of group names into alphabetical order. If set to NO the group names will # appear in their defined order. # The default value is: NO. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by # fully-qualified names, including namespaces. If set to NO, the class list will # be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the alphabetical # list. # The default value is: NO. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper # type resolution of all parameters of a function it will reject a match between # the prototype and the implementation of a member function even if there is # only one candidate or it is obvious which candidate to choose by doing a # simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still # accept a match between prototype and implementation in such cases. # The default value is: NO. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo # list. This list is created by putting \todo commands in the documentation. # The default value is: YES. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test # list. This list is created by putting \test commands in the documentation. # The default value is: YES. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional documentation # sections, marked by \if ... \endif and \cond # ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the # documentation. If the initializer consists of more lines than specified here # it will be hidden. Use a value of 0 to hide initializers completely. The # appearance of the value of individual variables and macros / defines can be # controlled using \showinitializer or \hideinitializer command in the # documentation regardless of this setting. # Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at # the bottom of the documentation of classes and structs. If set to YES, the # list will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This # will remove the Files entry from the Quick Index and from the Folder Tree View # (if specified). # The default value is: YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the # Folder Tree View (if specified). # The default value is: YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command command input-file, where command is the value of the # FILE_VERSION_FILTER tag, and input-file is the name of an input file provided # by doxygen. Whatever the program writes to standard output is used as the file # version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml # will be used as the name of the layout file. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool # to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated to # standard output by doxygen. If QUIET is set to YES this implies that the # messages are off. # The default value is: NO. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. # The default value is: YES. WARNINGS = YES # If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some parameters # in a documented function, or documenting parameters that don't exist or using # markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return # value. If set to NO, doxygen will only warn about wrong or incomplete # parameter documentation, but not about the absence of documentation. # The default value is: NO. WARN_NO_PARAMDOC = NO # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # a warning is encountered. # The default value is: NO. WARN_AS_ERROR = NO # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard # error (stderr). WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. INPUT = ../ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: http://www.gnu.org/software/libiconv) for the list of # possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, # *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, # *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.c++ \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.idl \ *.ddl \ *.odl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.cs \ *.d \ *.php \ *.php4 \ *.php5 \ *.phtml \ *.inc \ *.m \ *.markdown \ *.md \ *.mm \ *.dox \ *.py \ *.pyw \ *.f90 \ *.f95 \ *.f03 \ *.f08 \ *.f \ *.for \ *.tcl \ *.vhd \ *.vhdl \ *.ucf \ *.qsf # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. # The default value is: NO. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = ../test # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. # The default value is: NO. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include # command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands # irrespective of the value of the RECURSIVE tag. # The default value is: NO. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or directories # that contain images that are to be included in the documentation (see the # \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command: # # # # where is the value of the INPUT_FILTER tag, and is the # name of an input file. Doxygen will then use the output that the filter # program writes to standard output. If FILTER_PATTERNS is specified, this tag # will be ignored. # # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: pattern=filter # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and # it is also possible to disable source filtering for a specific pattern using # *.ext= (so without naming a filter). # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. FILTER_SOURCE_PATTERNS = # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will be # generated. Documented entities will be cross-referenced with these sources. # # Note: To get rid of all source code in the generated output, make sure that # also VERBATIM_HEADERS is set to NO. # The default value is: NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. # The default value is: NO. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any # special comment blocks from generated source code fragments. Normal C, C++ and # Fortran comments will always remain visible. # The default value is: YES. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # function all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. REFERENCES_LINK_SOURCE = YES # If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the # source code will show a tooltip with additional information such as prototype, # brief description and links to the definition and documentation. Since this # will make the HTML file larger and loading of large files a bit slower, you # can opt to disable this feature. # The default value is: YES. # This tag requires that the tag SOURCE_BROWSER is set to YES. SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system # (see http://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global # - Enable SOURCE_BROWSER and USE_HTAGS in the config file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # # Doxygen will invoke htags (and that will in turn invoke gtags), so these # tools must be available from the command line (i.e. in the search path). # # The result: instead of the source browser generated by doxygen, the links to # source code will now point to the output of htags. # The default value is: NO. # This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a # verbatim copy of the header file for each class for which an include is # specified. Set to NO to disable this. # See also: Section \class. # The default value is: YES. VERBATIM_HEADERS = YES # If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the # clang parser (see: http://clang.llvm.org/) for more accurate parsing at the # cost of reduced performance. This can be particularly helpful with template # rich C++ code for which doxygen's built-in parser lacks the necessary type # information. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse-libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO # If clang assisted parsing is enabled you can provide the compiler with command # line options that you would normally use when invoking the compiler. Note that # the include paths will already be set by doxygen for the files and directories # specified with INPUT and INCLUDE_PATH. # This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. CLANG_OPTIONS = #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all # compounds will be generated. Enable this if the project contains a lot of # classes, structs, unions or interfaces. # The default value is: YES. ALPHABETICAL_INDEX = YES # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in # which the alphabetical index list will be split. # Minimum value: 1, maximum value: 20, default value: 5. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored # while generating the index headers. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). # The default value is: .html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a user-defined HTML header file for # each generated HTML page. If the tag is left blank doxygen will generate a # standard header. # # To get valid HTML the header file that includes any scripts and style sheets # that doxygen needs, which is dependent on the configuration options used (e.g. # the setting GENERATE_TREEVIEW). It is highly recommended to start with a # default header using # doxygen -w html new_header.html new_footer.html new_stylesheet.css # YourConfigFile # and then modify the file new_header.html. See also section "Doxygen usage" # for information on how to generate the default header that doxygen normally # uses. # Note: The header is subject to change so you typically have to regenerate the # default header when upgrading to a newer version of doxygen. For a description # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard # footer. See HTML_HEADER for more information on how to generate a default # footer and what special commands can be used inside the footer. See also # section "Doxygen usage" for information on how to generate the default footer # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of # the HTML output. If left blank doxygen will generate a default style sheet. # See also section "Doxygen usage" for information on how to generate the style # sheet that doxygen normally uses. # Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as # it is more robust and this tag (HTML_STYLESHEET) will in the future become # obsolete. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined # cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the # standard style sheet and is therefore more robust against future updates. # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the # list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that the # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see # http://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use grayscales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # luminance component of the colors in the HTML output. Values below 100 # gradually make the output lighter, whereas values above 100 make the output # darker. The value divided by 100 is the actual gamma applied, so 80 represents # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not # change the gamma. # Minimum value: 40, maximum value: 240, default value: 80. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this # to YES can help to show when doxygen was last run and thus if the # documentation is up to date. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to # such a level that at most the specified number of entries are visible (unless # a fully collapsed tree already exceeds this amount). So setting the number of # entries 1 will produce a full collapsed tree by default. 0 is a special value # representing an infinite number of entries and will result in a full expanded # tree by default. # Minimum value: 0, maximum value: 9999, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development # environment (see: http://developer.apple.com/tools/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = NO # This tag determines the name of the docset feed. A documentation feed provides # an umbrella under which multiple documentation sets from a single provider # (such as a company or product suite) can be grouped. # The default value is: Doxygen generated docs. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = "Doxygen generated docs" # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = org.doxygen.Project # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. # The default value is: org.doxygen.Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. # The default value is: Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop # (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML # files are now used as the Windows 98 help format, and will replace the old # Windows help format (.hlp) on all Windows platforms in the future. Compressed # HTML files also contain an index, a table of contents, and you can search for # words in the documentation. The HTML workshop also contains a viewer for # compressed HTML files. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = NO # The CHM_FILE tag can be used to specify the file name of the resulting .chm # file. You can add a path in front of the file if the result should not be # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler (hhc.exe). If non-empty, # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated # (YES) or that it should be included in the master .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO # The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = # The BINARY_TOC flag controls whether a binary table of contents is generated # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it # enables the Previous and Next buttons. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members to # the table of contents of the HTML help documentation and to the tree view. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help # (.qch) of the generated HTML documentation. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify # the file name of the resulting .qch file. The path specified is relative to # the HTML output folder. # This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace # (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual # Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- # folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = # The QHG_LOCATION tag can be used to specify the location of Qt's # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the # generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be # generated, together with the HTML files, they form an Eclipse help plugin. To # install this plugin and make it available under the help contents menu in # Eclipse, the contents of the directory containing the HTML and XML files needs # to be copied into the plugins directory of eclipse. The name of the directory # within the plugins directory should be the same as the ECLIPSE_DOC_ID value. # After copying Eclipse needs to be restarted before the help appears. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = NO # A unique identifier for the Eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have this # name. Each documentation set should have its own identifier. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = org.doxygen.Project # If you want full control over the layout of the generated HTML pages it might # be necessary to disable the index and replace it with your own. The # DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top # of each HTML page. A value of NO enables the index and the value YES disables # it. Since the tabs in the index contain the same information as the navigation # tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag # value is set to YES, a side panel will be generated containing a tree-like # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can # further fine-tune the look of the index. As an example, the default style # sheet generated by doxygen has an example that shows how to put an image at # the root of the tree instead of the PROJECT_NAME. Since the tree basically has # the same information as the tab index, you could consider setting # DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # # Note that a value of 0 will completely suppress the enum values from appearing # in the overview section. # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. # Minimum value: 0, maximum value: 1500, default value: 250. # This tag requires that the tag GENERATE_HTML is set to YES. TREEVIEW_WIDTH = 250 # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML # output directory to force them to be regenerated. # Minimum value: 8, maximum value: 50, default value: 10. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # # Note that when changing this option you need to delete any form_*.png files in # the HTML output directory before the changes have effect. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # http://www.mathjax.org) which uses client side Javascript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: # http://docs.mathjax.org/en/latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the HTML # output directory using the MATHJAX_RELPATH option. The destination directory # should contain the MathJax.js script. For instance, if the mathjax directory # is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of # MathJax from http://www.mathjax.org before deployment. # The default value is: http://cdn.mathjax.org/mathjax/latest. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site # (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box for # the HTML output. The underlying search engine uses javascript and DHTML and # should work on any modern browser. Note that when using HTML help # (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) # there is already a search function so this one should typically be disabled. # For large projects the javascript based search engine can be slow, then # enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to # search using the keyboard; to jump to the search box use + S # (what the is depends on the OS and browser, but it is typically # , /