Skip to content

Commit fc69097

Browse files
committed
fix: setEnabled is WRITE
1 parent c4656a7 commit fc69097

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/network/test/network.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ FloatingWindow {
2323
CheckBox {
2424
text: "Software"
2525
checked: Network.wifi.enabled
26-
onClicked: Network.wifi.setEnabled(!Network.wifi.enabled)
26+
onClicked: Network.wifi.enabled = !Network.wifi.enabled
2727
}
2828
CheckBox {
2929
enabled: false

src/network/wifi.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class Wifi: public QObject {
114114
Q_PROPERTY(UntypedObjectModel* devices READ devices CONSTANT);
115115
QSDOC_TYPE_OVERRIDE(ObjectModel<qs::network::WifiDevice>*);
116116
/// True when the wifi software switch is enabled.
117-
Q_PROPERTY(bool enabled READ enabled NOTIFY enabledChanged BINDABLE bindableEnabled);
117+
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged);
118118
/// True when the wifi hardware switch is enabled.
119119
Q_PROPERTY(bool hardwareEnabled READ hardwareEnabled NOTIFY hardwareEnabledChanged BINDABLE bindableHardwareEnabled);
120120
// clang-format on
@@ -132,11 +132,9 @@ public slots:
132132
public:
133133
explicit Wifi(QObject* parent = nullptr);
134134

135-
/// Set the state of the wifi software switch.
136-
Q_INVOKABLE void setEnabled(bool enabled);
137-
138135
[[nodiscard]] ObjectModel<WifiDevice>* devices() { return &this->mDevices; };
139136
[[nodiscard]] bool enabled() const { return this->bEnabled; };
137+
void setEnabled(bool enabled);
140138
[[nodiscard]] bool hardwareEnabled() const { return this->bHardwareEnabled; };
141139
QBindable<bool> bindableEnabled() { return &this->bEnabled; };
142140
QBindable<bool> bindableHardwareEnabled() { return &this->bHardwareEnabled; };

0 commit comments

Comments
 (0)