小插件接口参数类型改了,需要重新适配。

This commit is contained in:
JunjieBai 2022-09-27 15:41:10 +08:00
parent d00912d546
commit 713924b808
2 changed files with 14 additions and 9 deletions

View File

@ -25,12 +25,20 @@ AppWidget {
} }
function updateSearchBarColor() { function updateSearchBarColor() {
var data = window.parseJson(window.datevalue); // for (var i in window.datavalue) {
// if (i === "colorData") {
// var data = window.parseJson(window.datavalue[i]);
// searchBar.color = Qt.rgba(data.red, data.green, data.blue, data.alpha);
// placeholderText.color = data.placeHolderTextColor;
// }
// }
var data = window.parseJson(window.datavalue["colorData"]);
searchBar.color = Qt.rgba(data.red, data.green, data.blue, data.alpha); searchBar.color = Qt.rgba(data.red, data.green, data.blue, data.alpha);
placeholderText.color = data.placeHolderTextColor; placeholderText.color = data.placeHolderTextColor;
} }
onDatevalueChanged: updateSearchBarColor(); onDatavalueChanged: updateSearchBarColor();
Rectangle { Rectangle {
id:searchBar id:searchBar
@ -39,10 +47,6 @@ AppWidget {
height: 64 height: 64
radius: searchBar.height / 2 radius: searchBar.height / 2
Component.onCompleted: {
window.updateSearchBarColor();
}
RowLayout { RowLayout {
id: layout id: layout
anchors.fill: parent anchors.fill: parent

View File

@ -7,6 +7,7 @@
#include <QJsonObject> #include <QJsonObject>
#include <QJsonDocument> #include <QJsonDocument>
#include <QApplication> #include <QApplication>
#include <QVariantMap>
#define CONTROL_CENTER_PERSONALISE_GSETTINGS_ID "org.ukui.control-center.personalise" #define CONTROL_CENTER_PERSONALISE_GSETTINGS_ID "org.ukui.control-center.personalise"
#define TRANSPARENCY_KEY "transparency" #define TRANSPARENCY_KEY "transparency"
@ -70,12 +71,12 @@ void AppWidgetPlugin::appWidgetUpdate()
obj.insert("alpha", QJsonValue(GlobalSettings::getInstance()->getValue(TRANSPARENCY_KEY).toDouble())); obj.insert("alpha", QJsonValue(GlobalSettings::getInstance()->getValue(TRANSPARENCY_KEY).toDouble()));
QString jsonData = QString(QJsonDocument(obj).toJson()); QString jsonData = QString(QJsonDocument(obj).toJson());
QDBusVariant variant; QVariantMap dataMap;
variant.setVariant(jsonData); dataMap.insert("colorData", QVariant(jsonData));
// variant.setVariant(QGuiApplication::palette().color(QPalette::Window).name(QColor::HexArgb)); // variant.setVariant(QGuiApplication::palette().color(QPalette::Window).name(QColor::HexArgb));
if(m_manager) { if(m_manager) {
m_manager->updateAppWidget("search", variant); m_manager->updateAppWidget("search", dataMap);
qDebug() <<"==========update style and transparency successful."; qDebug() <<"==========update style and transparency successful.";
} }
} }