From 383ee53814649190e24e08a16acd6aee629de157 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Mon, 1 Dec 2014 14:30:57 +0300 Subject: Add scroll area to Enumerator example When a system has many serial ports, the last of them are not visible on the screen, because a widget has a big height. So, it is reasonable to add scrolling of all serial ports info. Change-Id: Ic13b58fba38a17d6f5142476bca501a0d26ec76d Reviewed-by: Sergey Belyashov --- examples/serialport/enumerator/main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/serialport/enumerator/main.cpp b/examples/serialport/enumerator/main.cpp index 007e918..40bc67a 100644 --- a/examples/serialport/enumerator/main.cpp +++ b/examples/serialport/enumerator/main.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include QT_USE_NAMESPACE @@ -44,8 +45,6 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); - QWidget w; - w.setWindowTitle(QObject::tr("Info about all available serial ports.")); QVBoxLayout *layout = new QVBoxLayout; foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) { @@ -62,8 +61,13 @@ int main(int argc, char *argv[]) layout->addWidget(label); } - w.setLayout(layout); - w.show(); + QWidget *workPage = new QWidget; + workPage->setLayout(layout); + + QScrollArea area; + area.setWindowTitle(QObject::tr("Info about all available serial ports.")); + area.setWidget(workPage); + area.show(); return a.exec(); } -- cgit v1.2.1