小插件接口参数类型改了,需要重新适配。
This commit is contained in:
parent
d00912d546
commit
713924b808
|
@ -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
|
||||||
|
|
|
@ -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.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue