Closed mayurpatelgec closed 5 years ago
A patch to apply to the example that shows how to read txt records. Please close the ticket if satisfied.
--- a/example/window.cpp
+++ b/example/window.cpp
@@ -149,9 +149,12 @@ void mainWindow::stopPublishClicked()
void mainWindow::addService(QZeroConfService zcs)
{
+ QMap <QByteArray, QByteArray> records;
qint32 row;
QTableWidgetItem *cell;
- qDebug() << "Added service: " << zcs;
+
+ records = zcs.txt();
+ qDebug() << "Added service: " << zcs << records["Qt"];
i have not tested it but i think it will work.
thanks.. :+1:
The markdown parser removed the template arguments. Here is the correct patch...
--- a/example/window.cpp
+++ b/example/window.cpp
@@ -149,10 +149,13 @@ void mainWindow::stopPublishClicked()
void mainWindow::addService(QZeroConfService zcs)
{
+ QMap<QByteArray, QByteArray> records;
qint32 row;
QTableWidgetItem *cell;
qDebug() << "Added service: " << zcs;
+ records = zcs->txt();
+ qDebug() << "Added service: " << zcs << records["Qt"];
I want to fetch text record of added service aka.
zcs.txt["Qt"];
--> should give me QT is best according to your info file.but in my case, its showing failed. the hint can be mismatch data type in QMap & QByteArray; bcz
qDebug () << zcs.txt();
gives me complete QMap but cant fetch the single one.. a simple example like your readme will be enough.error: invalid types ' [const char [5]]' for array subscript.