[SOLVED]Qt 5.1 available serial port list
General and Desktop
2
Posts
1
Posters
10.7k
Views
1
Watching
-
This the code I'm using:
@#include <QGuiApplication>
#include <QtQml>
#include <QtQuick/QQuickView>
#include <QtSerialPort/QSerialPortInfo>
#include <QList>int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine(QUrl("qml/main.qml"));QList<QSerialPortInfo> list; QObject *topLevel = engine.rootObjects().value(0); QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel); if ( !window ) { qWarning("Error: Your root item has to be a Window."); return -1; } list = QSerialPortInfo::availablePorts(); <----------Error window->show(); return app.exec();}@
but I've errors on the line indicated.
What is the problem? I'm trying to have simply the list of available ports on the pc!!
thanks -
Missed "QT += serialport" in .pro file