Refresh printers on page refresh
This commit is contained in:
parent
ad0f92ba1e
commit
8c721b398b
3 changed files with 18 additions and 0 deletions
|
@ -33,6 +33,8 @@ Page {
|
|||
}
|
||||
}
|
||||
|
||||
signal refreshed()
|
||||
|
||||
Component.onCompleted: {
|
||||
discovery.discover();
|
||||
}
|
||||
|
@ -64,6 +66,7 @@ Page {
|
|||
text: qsTr("Refresh")
|
||||
onClicked: {
|
||||
discovery.discover();
|
||||
page.refreshed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +99,15 @@ Page {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
Connections {
|
||||
target: page
|
||||
onRefreshed: {
|
||||
console.log("onRefreshed")
|
||||
printer.refresh()
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if(!canPrint)
|
||||
return;
|
||||
|
|
|
@ -43,6 +43,10 @@ void IppPrinter::setUrl(QString url)
|
|||
|
||||
void IppPrinter::onUrlChanged()
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
|
||||
void IppPrinter::refresh() {
|
||||
_attrs = QJsonObject();
|
||||
emit attrsChanged();
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ public:
|
|||
QString getUrl() {return _url;}
|
||||
void setUrl(QString url);
|
||||
|
||||
Q_INVOKABLE void refresh();
|
||||
|
||||
Q_INVOKABLE bool print(QJsonObject attrs, QString file);
|
||||
Q_INVOKABLE bool getJobs();
|
||||
Q_INVOKABLE bool cancelJob(qint32 jobId);
|
||||
|
|
Loading…
Reference in a new issue