diff options
author | Laszlo Papp <lpapp@kde.org> | 2013-11-23 17:59:34 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-24 16:56:16 +0100 |
commit | affd326dbba01fd2ea23fa87c7c165bc07bd08fe (patch) | |
tree | 76f97b5bd859a09e4a335221d24adee3514447f1 /examples/serialport/terminal | |
parent | d4d79896db4f6c4d3eca39a57e7bec29f43e206d (diff) |
Replace the silly empty output with a reasonable "N/A" placeholder
Change-Id: Iad5076e9a192f5a07e41314d286bc02e46ea92c8
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'examples/serialport/terminal')
-rw-r--r-- | examples/serialport/terminal/settingsdialog.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/serialport/terminal/settingsdialog.cpp b/examples/serialport/terminal/settingsdialog.cpp index ad32824e..923f0004 100644 --- a/examples/serialport/terminal/settingsdialog.cpp +++ b/examples/serialport/terminal/settingsdialog.cpp @@ -151,14 +151,19 @@ void SettingsDialog::fillPortsParameters() void SettingsDialog::fillPortsInfo() { ui->serialPortInfoListBox->clear(); + static const QString blankString = QObject::tr("N/A"); + QString description; + QString manufacturer; foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) { QStringList list; + description = info.description(); + manufacturer = info.manufacturer(); list << info.portName() - << info.description() - << info.manufacturer() + << (!description.isEmpty() ? description : blankString) + << (!manufacturer.isEmpty() ? manufacturer : blankString) << info.systemLocation() - << (info.vendorIdentifier() ? QString::number(info.vendorIdentifier(), 16) : QString()) - << (info.productIdentifier() ? QString::number(info.productIdentifier(), 16) : QString()); + << (info.vendorIdentifier() ? QString::number(info.vendorIdentifier(), 16) : blankString) + << (info.productIdentifier() ? QString::number(info.productIdentifier(), 16) : blankString); ui->serialPortInfoListBox->addItem(list.first(), list); } |