summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qmake/project.cpp14
-rw-r--r--src/corelib/kernel/qcoreevent.cpp2
-rw-r--r--src/corelib/tools/qbytearray.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp9
-rw-r--r--src/gui/image/qpixmap.cpp21
-rw-r--r--src/gui/kernel/qapplication_p.h6
-rw-r--r--src/gui/kernel/qapplication_s60.cpp47
-rw-r--r--src/gui/kernel/qformlayout.cpp6
-rw-r--r--src/gui/painting/qpainter.cpp3
-rw-r--r--src/opengl/qgl_x11.cpp6
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp38
-rw-r--r--tools/runonphone/main.cpp4
-rw-r--r--tools/runonphone/runonphone.pro6
-rw-r--r--tools/runonphone/serenum_stub.cpp53
-rw-r--r--tools/runonphone/serenum_unix.cpp64
15 files changed, 254 insertions, 29 deletions
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 2ad6112..c2e033e 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -79,7 +79,7 @@ enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST
E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND,
E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_REPLACE,
- E_SIZE };
+ E_SIZE, E_GENERATE_UID };
QMap<QString, ExpandFunc> qmake_expandFunctions()
{
static QMap<QString, ExpandFunc> *qmake_expand_functions = 0;
@@ -111,6 +111,7 @@ QMap<QString, ExpandFunc> qmake_expandFunctions()
qmake_expand_functions->insert("prompt", E_PROMPT);
qmake_expand_functions->insert("replace", E_REPLACE);
qmake_expand_functions->insert("size", E_SIZE);
+ qmake_expand_functions->insert("generate_uid", E_GENERATE_UID);
}
return *qmake_expand_functions;
}
@@ -1864,6 +1865,9 @@ QMakeProject::doProjectExpand(QString func, QStringList args,
return doProjectExpand(func, args_list, place);
}
+// defined in symbian generator
+extern QString generate_test_uid(const QString& target);
+
QStringList
QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
QMap<QString, QStringList> &place)
@@ -2301,6 +2305,14 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
ret += QString::number(size);
}
break; }
+ case E_GENERATE_UID:
+ if (args.count() != 1) {
+ fprintf(stderr, "%s:%d: generate_uid(var) requires one argument.\n",
+ parser.file.toLatin1().constData(), parser.line_no);
+ } else {
+ ret += generate_test_uid(args.first());
+ }
+ break;
default: {
fprintf(stderr, "%s:%d: Unknown replace function: %s\n",
parser.file.toLatin1().constData(), parser.line_no,
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 1b167e2..3f69b4f 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -107,13 +107,13 @@ QT_BEGIN_NAMESPACE
\value ApplicationLayoutDirectionChange The default application layout direction has changed.
\value ApplicationPaletteChange The default application palette has changed.
\value ApplicationWindowIconChange The application's icon has changed.
- \value CloseSoftwareInputPanel A widget wants to close the software input panel (SIP).
\value ChildAdded An object gets a child (QChildEvent).
\value ChildInserted An object gets a child (QChildEvent). Qt3Support only, use ChildAdded instead.
\value ChildPolished A widget child gets polished (QChildEvent).
\value ChildRemoved An object loses a child (QChildEvent).
\value Clipboard The clipboard contents have changed (QClipboardEvent).
\value Close Widget was closed (QCloseEvent).
+ \value CloseSoftwareInputPanel A widget wants to close the software input panel (SIP).
\value ContentsRectChange The margins of the widget's content rect changed.
\value ContextMenu Context popup menu (QContextMenuEvent).
\value CursorChange The widget's cursor has changed.
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index d2fbf5a..4049925 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -538,7 +538,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
forever {
ulong alloc = len;
- d.reset(q_check_ptr(static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + alloc))));
+ d.reset(q_check_ptr(static_cast<QByteArray::Data *>(qRealloc(d.take(), sizeof(QByteArray::Data) + alloc))));
if (!d) {
// we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS
qWarning("qUncompress: could not allocate enough memory to uncompress data");
@@ -551,7 +551,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
switch (res) {
case Z_OK:
if (len != alloc) {
- d.reset(q_check_ptr(static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + len))));
+ d.reset(q_check_ptr(static_cast<QByteArray::Data *>(qRealloc(d.take(), sizeof(QByteArray::Data) + len))));
if (!d) {
// we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS
qWarning("qUncompress: could not allocate enough memory to uncompress data");
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index cae9660..1361a89 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -2997,9 +2997,16 @@ void QGraphicsItem::setActive(bool active)
*/
bool QGraphicsItem::hasFocus() const
{
+ if (!d_ptr->scene || !d_ptr->scene->isActive())
+ return false;
+
if (d_ptr->focusProxy)
return d_ptr->focusProxy->hasFocus();
- return isActive() && (d_ptr->scene && d_ptr->scene->focusItem() == this);
+
+ if (d_ptr->scene->d_func()->focusItem != this)
+ return false;
+
+ return panel() == d_ptr->scene->d_func()->activePanel;
}
/*!
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 674d5da..f823fdc 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -833,14 +833,21 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
if (QPixmapCache::find(key, *this))
return true;
- QPixmapData *tmp = QPixmapData::create(0, 0, QPixmapData::PixmapType);
- if (tmp->fromFile(fileName, format, flags)) {
- data = tmp;
- QPixmapCache::insert(key, *this);
- return true;
+ bool ok;
+
+ if (data) {
+ ok = data->fromFile(fileName, format, flags);
+ } else {
+ QScopedPointer<QPixmapData> tmp(QPixmapData::create(0, 0, QPixmapData::PixmapType));
+ ok = tmp->fromFile(fileName, format, flags);
+ if (ok)
+ data = tmp.take();
}
- delete tmp;
- return false;
+
+ if (ok)
+ QPixmapCache::insert(key, *this);
+
+ return ok;
}
/*!
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index f8943a8..9c001ab 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -501,9 +501,9 @@ public:
static TUint resolveS60ScanCode(TInt scanCode, TUint keysym);
QSet<WId> nativeWindows;
- int symbianProcessWsEvent(const TWsEvent *event);
- int symbianHandleCommand(int command);
- int symbianResourceChange(int type);
+ int symbianProcessWsEvent(const QSymbianEvent *symbianEvent);
+ int symbianHandleCommand(const QSymbianEvent *symbianEvent);
+ int symbianResourceChange(const QSymbianEvent *symbianEvent);
#endif
#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS)
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 8c77728..361d231 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1528,6 +1528,12 @@ void QApplication::beep()
qt_S60Beep->Play();
}
+static inline bool callSymbianEventFilters(const QSymbianEvent *event)
+{
+ long unused;
+ return qApp->filterEvent(const_cast<QSymbianEvent *>(event), &unused);
+}
+
/*!
\warning This function is only available on Symbian.
\since 4.6
@@ -1544,6 +1550,9 @@ int QApplication::symbianProcessEvent(const QSymbianEvent *event)
QScopedLoopLevelCounter counter(d->threadData);
+ if (d->eventDispatcher->filterEvent(const_cast<QSymbianEvent *>(event)))
+ return 1;
+
QWidget *w = qApp ? qApp->focusWidget() : 0;
if (w) {
QInputContext *ic = w->inputContext();
@@ -1556,29 +1565,34 @@ int QApplication::symbianProcessEvent(const QSymbianEvent *event)
switch (event->type()) {
case QSymbianEvent::WindowServerEvent:
- return d->symbianProcessWsEvent(event->windowServerEvent());
+ return d->symbianProcessWsEvent(event);
case QSymbianEvent::CommandEvent:
- return d->symbianHandleCommand(event->command());
+ return d->symbianHandleCommand(event);
case QSymbianEvent::ResourceChangeEvent:
- return d->symbianResourceChange(event->resourceChangeType());
+ return d->symbianResourceChange(event);
default:
return -1;
}
}
-int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event)
+int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent)
{
// Qt event handling. Handle some events regardless of if the handle is in our
// widget map or not.
+ const TWsEvent *event = symbianEvent->windowServerEvent();
CCoeControl* control = reinterpret_cast<CCoeControl*>(event->Handle());
const bool controlInMap = QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control);
switch (event->Type()) {
case EEventPointerEnter:
- if (controlInMap)
+ if (controlInMap) {
+ callSymbianEventFilters(symbianEvent);
return 1; // Qt::Enter will be generated in HandlePointerL
+ }
break;
case EEventPointerExit:
if (controlInMap) {
+ if (callSymbianEventFilters(symbianEvent))
+ return 1;
if (S60) {
// mouseEvent outside our window, send leave event to last focused widget
QMouseEvent mEvent(QEvent::Leave, S60->lastPointerEventPos, S60->lastCursorPos,
@@ -1591,6 +1605,8 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event)
}
break;
case EEventScreenDeviceChanged:
+ if (callSymbianEventFilters(symbianEvent))
+ return 1;
if (S60)
S60->updateScreenSize();
if (qt_desktopWidget) {
@@ -1603,6 +1619,8 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event)
return 0; // Propagate to CONE
case EEventWindowVisibilityChanged:
if (controlInMap) {
+ if (callSymbianEventFilters(symbianEvent))
+ return 1;
const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged();
QWidget *w = QWidgetPrivate::mapper->value(control);
if (!w->d_func()->maybeTopData())
@@ -1620,6 +1638,8 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event)
}
break;
case EEventFocusGained:
+ if (callSymbianEventFilters(symbianEvent))
+ return 1;
#ifndef QT_NO_CURSOR
//re-enable mouse interaction
if (S60->mouseInteractionEnabled) {
@@ -1633,6 +1653,8 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event)
#endif
break;
case EEventFocusLost:
+ if (callSymbianEventFilters(symbianEvent))
+ return 1;
#ifndef QT_NO_CURSOR
//disable mouse as may be moving to application that does not support it
if (S60->mouseInteractionEnabled) {
@@ -1684,11 +1706,16 @@ bool QApplication::symbianEventFilter(const QSymbianEvent *event)
\sa s60EventFilter(), s60ProcessEvent()
*/
-int QApplicationPrivate::symbianHandleCommand(int command)
+int QApplicationPrivate::symbianHandleCommand(const QSymbianEvent *symbianEvent)
{
Q_Q(QApplication);
int ret = 0;
+ if (callSymbianEventFilters(symbianEvent))
+ return 1;
+
+ int command = symbianEvent->command();
+
switch (command) {
#ifdef Q_WS_S60
case EAknSoftkeyExit: {
@@ -1728,14 +1755,18 @@ int QApplicationPrivate::symbianHandleCommand(int command)
Currently, KEikDynamicLayoutVariantSwitch and
KAknsMessageSkinChange are handled.
*/
-int QApplicationPrivate::symbianResourceChange(int type)
+int QApplicationPrivate::symbianResourceChange(const QSymbianEvent *symbianEvent)
{
int ret = 0;
+ int type = symbianEvent->resourceChangeType();
+
switch (type) {
#ifdef Q_WS_S60
case KEikDynamicLayoutVariantSwitch:
{
+ if (callSymbianEventFilters(symbianEvent))
+ return 1;
if (S60)
S60->updateScreenSize();
@@ -1760,6 +1791,8 @@ int QApplicationPrivate::symbianResourceChange(int type)
#ifndef QT_NO_STYLE_S60
case KAknsMessageSkinChange:
+ if (callSymbianEventFilters(symbianEvent))
+ return 1;
if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) {
s60Style->d_func()->handleSkinChange();
ret = 1;
diff --git a/src/gui/kernel/qformlayout.cpp b/src/gui/kernel/qformlayout.cpp
index b44cd50..aebc3a5 100644
--- a/src/gui/kernel/qformlayout.cpp
+++ b/src/gui/kernel/qformlayout.cpp
@@ -1925,11 +1925,11 @@ void QFormLayoutPrivate::arrangeWidgets(const QVector<QLayoutStruct>& layouts, Q
/*
If the field on the right-hand side is tall,
we want the label to be top-aligned, but not too
- much. So we introduce a 5 / 4 factor so that it
- gets a few extra pixels at the top.
+ much. So we introduce a 7 / 4 factor so that it
+ gets some extra pixels at the top.
*/
height = qMin(height,
- qMin(label->sizeHint.height() * 5 / 4,
+ qMin(label->sizeHint.height() * 7 / 4,
label->maxSize.height()));
}
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index a9dcea0..31132d9 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1374,9 +1374,6 @@ void QPainterPrivate::updateState(QPainterState *newState)
opacity with non-smooth transformation mode
(\c QPainter::SmoothPixmapTransform not enabled as a render hint).
- \o Text drawing with regular font sizes with simple
- transformations with solid colors using no or 8-bit antialiasing.
-
\o Rectangle fills with solid color, two-color linear gradients
and simple transforms.
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp
index f4cc7c7..61a16be 100644
--- a/src/opengl/qgl_x11.cpp
+++ b/src/opengl/qgl_x11.cpp
@@ -1651,8 +1651,12 @@ static bool qt_resolveTextureFromPixmap(QPaintDevice *paintDevice)
{
return false; // Can't use TFP without NPOT
}
+
const QX11Info *xinfo = qt_x11Info(paintDevice);
- QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
+ Display *display = xinfo ? xinfo->display() : X11->display;
+ int screen = xinfo ? xinfo->screen() : X11->defaultScreen;
+
+ QGLExtensionMatcher extensions(glXQueryExtensionsString(display, screen));
if (extensions.match("GLX_EXT_texture_from_pixmap")) {
glXBindTexImageEXT = (qt_glXBindTexImageEXT) qglx_getProcAddress("glXBindTexImageEXT");
glXReleaseTexImageEXT = (qt_glXReleaseTexImageEXT) qglx_getProcAddress("glXReleaseTexImageEXT");
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 2340ef5..8bcd5e8 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -171,6 +171,8 @@ private slots:
void preserveDepth();
void splash_crash();
+
+ void loadAsBitmapOrPixmap();
};
static bool lenientCompare(const QPixmap &actual, const QPixmap &expected)
@@ -1510,5 +1512,41 @@ void tst_QPixmap::preserveDepth()
QCOMPARE(depth, source.depth());
}
+void tst_QPixmap::loadAsBitmapOrPixmap()
+{
+ QImage tmp(10, 10, QImage::Format_RGB32);
+ tmp.save("tmp.png");
+
+ bool ok;
+
+ // Check that we can load the pixmap as a pixmap and that it then turns into a pixmap
+ QPixmap pixmap("tmp.png");
+ QVERIFY(!pixmap.isNull());
+ QVERIFY(pixmap.depth() > 1);
+ QVERIFY(!pixmap.isQBitmap());
+
+ pixmap = QPixmap();
+ ok = pixmap.load("tmp.png");
+ QVERIFY(ok);
+ QVERIFY(!pixmap.isNull());
+ QVERIFY(pixmap.depth() > 1);
+ QVERIFY(!pixmap.isQBitmap());
+
+ // The do the same check for bitmaps..
+ QBitmap bitmap("tmp.png");
+ QVERIFY(!bitmap.isNull());
+ QVERIFY(bitmap.depth() == 1);
+ QVERIFY(bitmap.isQBitmap());
+
+ bitmap = QBitmap();
+ ok = bitmap.load("tmp.png");
+ QVERIFY(ok);
+ QVERIFY(!bitmap.isNull());
+ QVERIFY(bitmap.depth() == 1);
+ QVERIFY(bitmap.isQBitmap());
+}
+
+
+
QTEST_MAIN(tst_QPixmap)
#include "tst_qpixmap.moc"
diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp
index d8c306f..c7fc43f 100644
--- a/tools/runonphone/main.cpp
+++ b/tools/runonphone/main.cpp
@@ -175,7 +175,11 @@ int main(int argc, char *argv[])
}
if(loglevel > 0)
outstream << "Connecting to target via " << serialPortName << endl;
+#ifdef Q_OS_WIN
launcher->setTrkServerName(QString("\\\\.\\") + serialPortName);
+#else
+ launcher->setTrkServerName(serialPortName);
+#endif
launcher->setFileName(QString("c:\\sys\\bin\\") + exeFile);
launcher->setCommandLineArgs(cmdLine);
diff --git a/tools/runonphone/runonphone.pro b/tools/runonphone/runonphone.pro
index cf0c055..cb27d1b 100644
--- a/tools/runonphone/runonphone.pro
+++ b/tools/runonphone/runonphone.pro
@@ -18,3 +18,9 @@ windows {
-luuid \
-ladvapi32
}
+unix:!symbian {
+ SOURCES += serenum_unix.cpp
+}
+else {
+ SOURCES += serenum_stub.cpp
+}
diff --git a/tools/runonphone/serenum_stub.cpp b/tools/runonphone/serenum_stub.cpp
new file mode 100644
index 0000000..f39765e
--- /dev/null
+++ b/tools/runonphone/serenum_stub.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "serenum.h"
+#include <QByteArray>
+#include <QString>
+#include <QDebug>
+
+QList<SerialPortId> enumerateSerialPorts()
+{
+ QList<SerialPortId> list;
+ qWarning() << "enumerateSerialPorts not implemented" << endl;
+ return list;
+}
+
diff --git a/tools/runonphone/serenum_unix.cpp b/tools/runonphone/serenum_unix.cpp
new file mode 100644
index 0000000..ca6c437
--- /dev/null
+++ b/tools/runonphone/serenum_unix.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "serenum.h"
+#include <QByteArray>
+#include <QString>
+#include <QDebug>
+#include <QFileInfo>
+#include <QDir>
+
+QList<SerialPortId> enumerateSerialPorts()
+{
+ QList<SerialPortId> list;
+ QDir dir("/dev/serial/by-id/");
+ QFileInfoList ports(dir.entryInfoList());
+ foreach(QFileInfo info, ports) {
+ if (!info.isDir()) {
+ SerialPortId id;
+ id.friendlyName = info.fileName();
+ id.portName = info.canonicalFilePath();
+ list << id;
+ }
+ }
+ return list;
+}
+