From ef885e1a2855bf8de3d44f07451d3c421f0ab5c0 Mon Sep 17 00:00:00 2001 From: daniel-Jones Date: Thu, 2 Jun 2016 18:10:52 +0930 Subject: Added feedback for missing presets.txt file, added message box funcrion for user alerts and other misc things --- qt/RGBController/.controllerwindow.cpp.swp | Bin 0 -> 24576 bytes qt/RGBController/.controllerwindow.h.swp | Bin 0 -> 12288 bytes qt/RGBController/RGBController.pro.user | 2 +- qt/RGBController/controllerwindow.cpp | 343 +++++++++++++++-------------- qt/RGBController/controllerwindow.h | 66 +++--- qt/RGBController/controllerwindow.ui | 12 +- qt/RGBController/serial_communication.cpp | 58 ++--- qt/RGBController/serial_communication.h | 20 +- qt/build/degub/RGBController | Bin 1289960 -> 1294552 bytes qt/build/degub/controllerwindow.o | Bin 990128 -> 994448 bytes qt/build/degub/main.o | Bin 872920 -> 872920 bytes qt/build/degub/moc_controllerwindow.o | Bin 969920 -> 970056 bytes qt/build/degub/old.txt | 12 + qt/build/degub/presets.txt | 12 - qt/build/degub/ui_controllerwindow.h | 2 + 15 files changed, 276 insertions(+), 251 deletions(-) create mode 100644 qt/RGBController/.controllerwindow.cpp.swp create mode 100644 qt/RGBController/.controllerwindow.h.swp create mode 100644 qt/build/degub/old.txt delete mode 100644 qt/build/degub/presets.txt diff --git a/qt/RGBController/.controllerwindow.cpp.swp b/qt/RGBController/.controllerwindow.cpp.swp new file mode 100644 index 0000000..e33becb Binary files /dev/null and b/qt/RGBController/.controllerwindow.cpp.swp differ diff --git a/qt/RGBController/.controllerwindow.h.swp b/qt/RGBController/.controllerwindow.h.swp new file mode 100644 index 0000000..51c6912 Binary files /dev/null and b/qt/RGBController/.controllerwindow.h.swp differ diff --git a/qt/RGBController/RGBController.pro.user b/qt/RGBController/RGBController.pro.user index 1b89dcd..92130ad 100755 --- a/qt/RGBController/RGBController.pro.user +++ b/qt/RGBController/RGBController.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/qt/RGBController/controllerwindow.cpp b/qt/RGBController/controllerwindow.cpp index 302e3d2..c5a8e4d 100755 --- a/qt/RGBController/controllerwindow.cpp +++ b/qt/RGBController/controllerwindow.cpp @@ -4,106 +4,115 @@ controllerWindow::controllerWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::controllerWindow) { - /* this is our setup function, we set things up here */ + /* this is our setup function, we set things up here */ ui->setupUi(this); - info_log("RGB Controller started"); - /* disable buttons and widgets that should not be enabled yet, set slider values to 0 */ - ui->disconnect_button->setEnabled(false); - ui->connect_button->setEnabled(false); - ui->red_button->setEnabled(false); - ui->green_button->setEnabled(false); - ui->blue_button->setEnabled(false); - ui->off_button->setEnabled(false); - ui->reload_preset_button->setEnabled(false); - ui->set_preset_button->setEnabled(false); - ui->presets_dropdown->setEnabled(false); - ui->r_slider->setEnabled(false); - ui->g_slider->setEnabled(false); - ui->b_slider->setEnabled(false); - ui->r_slider->setValue(0); - ui->g_slider->setValue(0); - ui->b_slider->setValue(0); - /* set some crucial ints */ - preset_index = 0, r = 0, g = 0, b = 0; - /* populate our serial port dropdown box */ - populate_serial_list(); - /* load our presets file */ - load_presets(); + info_log("RGB Controller started"); + /* disable buttons and widgets that should not be enabled yet, set slider values to 0 */ + ui->disconnect_button->setEnabled(false); + ui->connect_button->setEnabled(false); + ui->red_button->setEnabled(false); + ui->green_button->setEnabled(false); + ui->blue_button->setEnabled(false); + ui->off_button->setEnabled(false); + ui->reload_preset_button->setEnabled(false); + ui->set_preset_button->setEnabled(false); + ui->presets_dropdown->setEnabled(false); + ui->r_slider->setEnabled(false); + ui->g_slider->setEnabled(false); + ui->b_slider->setEnabled(false); + ui->r_slider->setValue(0); + ui->g_slider->setValue(0); + ui->b_slider->setValue(0); + /* set some crucial ints */ + preset_index = 0, r = 0, g = 0, b = 0; + /* populate our serial port dropdown box */ + populate_serial_list(); + /* load our presets file */ + load_presets(); } controllerWindow::~controllerWindow() { - /* this function will end our program and clean up */ + /* this function will end our program and clean up */ delete ui; } void controllerWindow::info_log(QString text) { - /* this function is used to append logging information to our text area */ - ui->info_log_textarea->append(text); + /* this function is used to append logging information to our text area */ + ui->info_log_textarea->append(text); } void controllerWindow::populate_serial_list() { - /* - * things to be done here: - * - clear anything inside our serial dropdown box - * - re-populate the serial dropdown box - */ - - /* remove anything in the list */ - ui->arduino_port_dropdown->clear(); - /* populate the list */ - for (int x = 0; x < QSerialPortInfo::availablePorts().size(); x++) - { - if (!QSerialPortInfo::availablePorts().at(x).description().isEmpty()) - ui->arduino_port_dropdown->addItem(QSerialPortInfo::availablePorts().at(x).portName()); - } - if (!ui->arduino_port_dropdown->itemText(0).isEmpty()) - { - ui->connect_button->setEnabled(true); - info_log("Serial port list populated"); - } else - { - info_log("No serial port found!"); - ui->arduino_port_dropdown->addItem("None"); - } + /* + * things to be done here: + * - clear anything inside our serial dropdown box + * - re-populate the serial dropdown box + */ + + /* remove anything in the list */ + ui->arduino_port_dropdown->clear(); + /* populate the list */ + for (int x = 0; x < QSerialPortInfo::availablePorts().size(); x++) + { + if (!QSerialPortInfo::availablePorts().at(x).description().isEmpty()) + ui->arduino_port_dropdown->addItem(QSerialPortInfo::availablePorts().at(x).portName()); + } + if (!ui->arduino_port_dropdown->itemText(0).isEmpty()) + { + ui->connect_button->setEnabled(true); + info_log("Serial port list populated"); + } else + { + info_log("No serial port found!"); + ui->arduino_port_dropdown->addItem("None"); + } } void controllerWindow::load_presets() { - /* - * this function will load presets from file and put them into a drop down box - * How i plan for it to work: - * -> load file - * -> parse line by line - * -> split line at delimeter - * -> add [0] to dropdown (name), add [1] to an array that stores all the values - */ - QFile inputFile("presets.txt"); - if (inputFile.open(QIODevice::ReadOnly)) - { - QTextStream in(&inputFile); - while (!in.atEnd()) - { - QString line = in.readLine(); - if (line.contains("=")) - { - ui->presets_dropdown->addItem(line.split("=")[0]); - presets.append(line.split("=")[1]); - } - } - inputFile.close(); - info_log("Presets loaded"); - } else - info_log("Presets file not found."); + /* + * this function will load presets from file and put them into a drop down box + * How i plan for it to work: + * -> load file + * -> parse line by line + * -> split line at delimeter + * -> add [0] to dropdown (name), add [1] to an array that stores all the values + */ + QFile inputFile("presets.txt"); + if (inputFile.open(QIODevice::ReadOnly)) + { + QTextStream in(&inputFile); + while (!in.atEnd()) + { + QString line = in.readLine(); + if (line.contains("=")) + { + ui->presets_dropdown->addItem(line.split("=")[0]); + presets.append(line.split("=")[1]); + } + } + inputFile.close(); + info_log("Presets loaded"); + } else + { + show_msgbox("Unable to find the presets fle.\nThis file needs to be named 'presets.txt' and be located in the same directory as the binary."); + info_log("Presets file not found."); + } } void controllerWindow::serial_rgb_change(int r, int g, int b) { - portf.rgb_change(r, g, b); + portf.rgb_change(r, g, b); } +void controllerWindow::show_msgbox(QString message) +{ + QMessageBox msgbox; + msgbox.setText(message); + msgbox.exec(); +} /* * @@ -113,143 +122,145 @@ void controllerWindow::serial_rgb_change(int r, int g, int b) void controllerWindow::on_connect_button_clicked() { - /* - * here we need to call our serial port connect function - * if our connection is sucessful we need to enable and disable a few buttons and widgets - * we must also change our rgb sliders etc - */ - port = ui->arduino_port_dropdown->currentText(); - if (portf.serial_connect(port)) - { // if true we are connected - info_log("Connection established"); - ui->arduino_status_label->setText("Connected"); - /* now we need to disabled and enable some buttons and objects */ - ui->disconnect_button->setEnabled(true); - ui->connect_button->setEnabled(false); - ui->red_button->setEnabled(true); - ui->green_button->setEnabled(true); - ui->blue_button->setEnabled(true); - ui->off_button->setEnabled(true); - ui->reload_preset_button->setEnabled(true); - ui->set_preset_button->setEnabled(true); - ui->presets_dropdown->setEnabled(true); - ui->r_slider->setEnabled(true); - ui->g_slider->setEnabled(true); - ui->b_slider->setEnabled(true); - ui->refresh_port_button->setEnabled(false); - ui->arduino_port_dropdown->setEnabled(false); - } else - { - info_log("Unable to connect (port in use?)"); - } + /* + * here we need to call our serial port connect function + * if our connection is sucessful we need to enable and disable a few buttons and widgets + * we must also change our rgb sliders etc + */ + port = ui->arduino_port_dropdown->currentText(); + if (portf.serial_connect(port)) + { // if true we are connected + info_log("Connection established"); + ui->arduino_status_label->setText("Connected"); + /* now we need to disabled and enable some buttons and objects */ + ui->disconnect_button->setEnabled(true); + ui->connect_button->setEnabled(false); + ui->red_button->setEnabled(true); + ui->green_button->setEnabled(true); + ui->blue_button->setEnabled(true); + ui->off_button->setEnabled(true); + ui->reload_preset_button->setEnabled(true); + ui->set_preset_button->setEnabled(true); + ui->presets_dropdown->setEnabled(true); + ui->r_slider->setEnabled(true); + ui->g_slider->setEnabled(true); + ui->b_slider->setEnabled(true); + ui->refresh_port_button->setEnabled(false); + ui->arduino_port_dropdown->setEnabled(false); + } else + { + info_log("Unable to connect (port in use?)"); + } } void controllerWindow::on_disconnect_button_clicked() { - /* - * here we will attempt to disconnect from our serial port - * we will also enable/disable some buttons and widgets and set slider values to 0 - */ - if (portf.serial_disconnect()) - { - info_log("Disconnected from serial port"); - ui->arduino_status_label->setText("Disconnected"); - ui->disconnect_button->setEnabled(false); - ui->connect_button->setEnabled(true); - ui->red_button->setEnabled(false); - ui->green_button->setEnabled(false); - ui->blue_button->setEnabled(false); - ui->off_button->setEnabled(false); - ui->reload_preset_button->setEnabled(false); - ui->set_preset_button->setEnabled(false); - ui->presets_dropdown->setEnabled(false); - ui->refresh_port_button->setEnabled(true); - ui->arduino_port_dropdown->setEnabled(true); - ui->r_slider->setEnabled(false); - ui->g_slider->setEnabled(false); - ui->b_slider->setEnabled(false); - ui->r_slider->setValue(0); - ui->g_slider->setValue(0); - ui->b_slider->setValue(0); - - } else - { - /* I have no clue how we'd get here */ - info_log("Cannot disconnect"); - } + /* + * here we will attempt to disconnect from our serial port + * we will also enable/disable some buttons and widgets and set slider values to 0 + */ + if (portf.serial_disconnect()) + { + info_log("Disconnected from serial port"); + ui->arduino_status_label->setText("Disconnected"); + ui->disconnect_button->setEnabled(false); + ui->connect_button->setEnabled(true); + ui->red_button->setEnabled(false); + ui->green_button->setEnabled(false); + ui->blue_button->setEnabled(false); + ui->off_button->setEnabled(false); + ui->reload_preset_button->setEnabled(false); + ui->set_preset_button->setEnabled(false); + ui->presets_dropdown->setEnabled(false); + ui->refresh_port_button->setEnabled(true); + ui->arduino_port_dropdown->setEnabled(true); + ui->r_slider->setEnabled(false); + ui->g_slider->setEnabled(false); + ui->b_slider->setEnabled(false); + ui->r_slider->setValue(0); + ui->g_slider->setValue(0); + ui->b_slider->setValue(0); + } else + { + /* I have no clue how we'd get here */ + info_log("Cannot disconnect"); + } } void controllerWindow::on_refresh_port_button_clicked() { - populate_serial_list(); + populate_serial_list(); } void controllerWindow::on_reload_preset_button_clicked() { - ui->presets_dropdown->clear(); - presets.clear(); - preset_index = 0; - load_presets(); + ui->presets_dropdown->clear(); + presets.clear(); + preset_index = 0; + load_presets(); } void controllerWindow::on_r_slider_valueChanged(int value) { - r = value; - serial_rgb_change(r, g, b); + r = value; + serial_rgb_change(r, g, b); } void controllerWindow::on_g_slider_valueChanged(int value) { - g = value; - serial_rgb_change(r, g, b); + g = value; + serial_rgb_change(r, g, b); } void controllerWindow::on_b_slider_valueChanged(int value) { - b = value; - serial_rgb_change(r, g, b); + b = value; + serial_rgb_change(r, g, b); } void controllerWindow::on_red_button_clicked() { - ui->r_slider->setValue(255); - ui->g_slider->setValue(0); - ui->b_slider->setValue(0); + ui->r_slider->setValue(255); + ui->g_slider->setValue(0); + ui->b_slider->setValue(0); } void controllerWindow::on_green_button_clicked() { - ui->r_slider->setValue(0); - ui->g_slider->setValue(255); - ui->b_slider->setValue(0); + ui->r_slider->setValue(0); + ui->g_slider->setValue(255); + ui->b_slider->setValue(0); } void controllerWindow::on_blue_button_clicked() { - ui->r_slider->setValue(0); - ui->g_slider->setValue(0); - ui->b_slider->setValue(255); + ui->r_slider->setValue(0); + ui->g_slider->setValue(0); + ui->b_slider->setValue(255); } void controllerWindow::on_off_button_clicked() { - ui->r_slider->setValue(0); - ui->g_slider->setValue(0); - ui->b_slider->setValue(0); + ui->r_slider->setValue(0); + ui->g_slider->setValue(0); + ui->b_slider->setValue(0); } void controllerWindow::on_set_preset_button_clicked() { - QString tempstore = presets.at(preset_index); - QStringList temparray = tempstore.split(","); - info_log("Preset selected: " + temparray[0] + " " + temparray[1] + " " + temparray[2]); - ui->r_slider->setValue(temparray[0].toInt()); - ui->g_slider->setValue(temparray[1].toInt()); - ui->b_slider->setValue(temparray[2].toInt()); + if (!presets.empty()) + { + QString tempstore = presets.at(preset_index); + QStringList temparray = tempstore.split(","); + info_log("Preset selected: " + temparray[0] + " " + temparray[1] + " " + temparray[2]); + ui->r_slider->setValue(temparray[0].toInt()); + ui->g_slider->setValue(temparray[1].toInt()); + ui->b_slider->setValue(temparray[2].toInt()); + } } void controllerWindow::on_presets_dropdown_currentIndexChanged(int index) { - preset_index = index; + preset_index = index; } diff --git a/qt/RGBController/controllerwindow.h b/qt/RGBController/controllerwindow.h index 350a599..d8c2403 100755 --- a/qt/RGBController/controllerwindow.h +++ b/qt/RGBController/controllerwindow.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "serial_communication.h" #include "ui_controllerwindow.h" @@ -23,53 +24,54 @@ class controllerWindow : public QMainWindow explicit controllerWindow(QWidget *parent = 0); ~controllerWindow(); - /* public functions */ - void info_log(QString text); - void populate_serial_list(); - void load_presets(); - void serial_rgb_change(int r, int g, int b); - /*public variables */ - /* these three ints will hold the current value (0 - 255) of each slider */ - int r, g, b; - /* this list will contain all the presets loaded from file */ - QStringList presets; - /* this string will hold our selected serial port */ - QString port; - /* this int will contain the current preset index selected */ - int preset_index; + /* public functions */ + void info_log(QString text); + void populate_serial_list(); + void load_presets(); + void serial_rgb_change(int r, int g, int b); + void show_msgbox(QString message); + /*public variables */ + /* these three ints will hold the current value (0 - 255) of each slider */ + int r, g, b; + /* this list will contain all the presets loaded from file */ + QStringList presets; + /* this string will hold our selected serial port */ + QString port; + /* this int will contain the current preset index selected */ + int preset_index; -private slots: - /* these slots are used to trigger button clicks and drop down items selections etc */ - void on_connect_button_clicked(); + private slots: + /* these slots are used to trigger button clicks and drop down items selections etc */ + void on_connect_button_clicked(); - void on_disconnect_button_clicked(); + void on_disconnect_button_clicked(); - void on_refresh_port_button_clicked(); + void on_refresh_port_button_clicked(); - void on_reload_preset_button_clicked(); + void on_reload_preset_button_clicked(); - void on_r_slider_valueChanged(int value); + void on_r_slider_valueChanged(int value); - void on_g_slider_valueChanged(int value); + void on_g_slider_valueChanged(int value); - void on_b_slider_valueChanged(int value); + void on_b_slider_valueChanged(int value); - void on_red_button_clicked(); + void on_red_button_clicked(); - void on_green_button_clicked(); + void on_green_button_clicked(); - void on_blue_button_clicked(); + void on_blue_button_clicked(); - void on_off_button_clicked(); + void on_off_button_clicked(); - void on_set_preset_button_clicked(); + void on_set_preset_button_clicked(); - void on_presets_dropdown_currentIndexChanged(int index); + void on_presets_dropdown_currentIndexChanged(int index); -private: + private: Ui::controllerWindow *ui; - /* serial communication object */ - serial_communication portf; + /* serial communication object */ + serial_communication portf; }; #endif // CONTROLLERWINDOW_H diff --git a/qt/RGBController/controllerwindow.ui b/qt/RGBController/controllerwindow.ui index 1907b33..e96fcf0 100755 --- a/qt/RGBController/controllerwindow.ui +++ b/qt/RGBController/controllerwindow.ui @@ -2,6 +2,9 @@ controllerWindow + + Qt::WindowModal + 0 @@ -196,7 +199,14 @@ - + + + + 120 + 0 + + + diff --git a/qt/RGBController/serial_communication.cpp b/qt/RGBController/serial_communication.cpp index 94e75db..ac0fd81 100644 --- a/qt/RGBController/serial_communication.cpp +++ b/qt/RGBController/serial_communication.cpp @@ -7,41 +7,41 @@ serial_communication::serial_communication() bool serial_communication::serial_connect(QString port) { - /* this function will attempt a serial connection if we are not already connected */ - if (!serial.isOpen()) - { - serial.setPortName(port); - serial.setBaudRate(QSerialPort::Baud9600); - serial.setDataBits(QSerialPort::Data8); - serial.setParity(QSerialPort::NoParity); - serial.setStopBits(QSerialPort::OneStop); - serial.setFlowControl(QSerialPort::NoFlowControl); - serial.open(QIODevice::ReadWrite); - serial.waitForBytesWritten(9000); - if (serial.isWritable()) { - return true; - } - } - return false; + /* this function will attempt a serial connection if we are not already connected */ + if (!serial.isOpen()) + { + serial.setPortName(port); + serial.setBaudRate(QSerialPort::Baud9600); + serial.setDataBits(QSerialPort::Data8); + serial.setParity(QSerialPort::NoParity); + serial.setStopBits(QSerialPort::OneStop); + serial.setFlowControl(QSerialPort::NoFlowControl); + serial.open(QIODevice::ReadWrite); + serial.waitForBytesWritten(9000); + if (serial.isWritable()) { + return true; + } + } + return false; } bool serial_communication::serial_disconnect() { - /* this function disconnects from the serial port if it is connected already */ - if (serial.isOpen()) - { - serial.close(); - return true; - } - return false; + /* this function disconnects from the serial port if it is connected already */ + if (serial.isOpen()) + { + serial.close(); + return true; + } + return false; } void serial_communication::rgb_change(int r, int g, int b) { - /* here we send our rgb values to the serial port */ - data = ""; - /* the 0 is a hack, i need to look into it at some point */ - data.append("0" + QString::number(r) + "," + QString::number(g) + "," + QString::number(b) + "\n"); - if (serial.isOpen()) - serial.write(data); + /* here we send our rgb values to the serial port */ + data = ""; + /* the 0 is a hack, i need to look into it at some point */ + data.append("0" + QString::number(r) + "," + QString::number(g) + "," + QString::number(b) + "\n"); + if (serial.isOpen()) + serial.write(data); } diff --git a/qt/RGBController/serial_communication.h b/qt/RGBController/serial_communication.h index d037757..ffc9b82 100644 --- a/qt/RGBController/serial_communication.h +++ b/qt/RGBController/serial_communication.h @@ -8,16 +8,16 @@ class serial_communication { -public: - /* function declares */ - serial_communication(); - bool serial_connect(QString port); - bool serial_disconnect(); - void rgb_change(int r, int g, int b); - /* variables */ - QString port_name; - QSerialPort serial; - QByteArray data; + public: + /* function declares */ + serial_communication(); + bool serial_connect(QString port); + bool serial_disconnect(); + void rgb_change(int r, int g, int b); + /* variables */ + QString port_name; + QSerialPort serial; + QByteArray data; }; #endif // SERIAL_COMMUNICATION_H diff --git a/qt/build/degub/RGBController b/qt/build/degub/RGBController index d3016b1..5697898 100755 Binary files a/qt/build/degub/RGBController and b/qt/build/degub/RGBController differ diff --git a/qt/build/degub/controllerwindow.o b/qt/build/degub/controllerwindow.o index d88e786..650edf3 100644 Binary files a/qt/build/degub/controllerwindow.o and b/qt/build/degub/controllerwindow.o differ diff --git a/qt/build/degub/main.o b/qt/build/degub/main.o index 68c328f..1f486a8 100644 Binary files a/qt/build/degub/main.o and b/qt/build/degub/main.o differ diff --git a/qt/build/degub/moc_controllerwindow.o b/qt/build/degub/moc_controllerwindow.o index f716615..dd21680 100644 Binary files a/qt/build/degub/moc_controllerwindow.o and b/qt/build/degub/moc_controllerwindow.o differ diff --git a/qt/build/degub/old.txt b/qt/build/degub/old.txt new file mode 100644 index 0000000..776a532 --- /dev/null +++ b/qt/build/degub/old.txt @@ -0,0 +1,12 @@ +Only add things to this file if you know what you are doing. +Don't be dumb. + +The program only cares for lines here if they contain the equals symbol. +Everything else is ignored - if you add an equals symbol to this file, you will most likely crash it. + +white=255,255,255 +purple=255,0,255 +light purple=255,55,255 +yellow=255,83,0 +light blue=0,255,255 + diff --git a/qt/build/degub/presets.txt b/qt/build/degub/presets.txt deleted file mode 100644 index 776a532..0000000 --- a/qt/build/degub/presets.txt +++ /dev/null @@ -1,12 +0,0 @@ -Only add things to this file if you know what you are doing. -Don't be dumb. - -The program only cares for lines here if they contain the equals symbol. -Everything else is ignored - if you add an equals symbol to this file, you will most likely crash it. - -white=255,255,255 -purple=255,0,255 -light purple=255,55,255 -yellow=255,83,0 -light blue=0,255,255 - diff --git a/qt/build/degub/ui_controllerwindow.h b/qt/build/degub/ui_controllerwindow.h index cebe2ce..1bebf40 100755 --- a/qt/build/degub/ui_controllerwindow.h +++ b/qt/build/degub/ui_controllerwindow.h @@ -56,6 +56,7 @@ public: { if (controllerWindow->objectName().isEmpty()) controllerWindow->setObjectName(QStringLiteral("controllerWindow")); + controllerWindow->setWindowModality(Qt::WindowModal); controllerWindow->resize(229, 394); centralWidget = new QWidget(controllerWindow); centralWidget->setObjectName(QStringLiteral("centralWidget")); @@ -173,6 +174,7 @@ public: presets_dropdown = new QComboBox(centralWidget); presets_dropdown->setObjectName(QStringLiteral("presets_dropdown")); + presets_dropdown->setMinimumSize(QSize(120, 0)); formLayout->setWidget(10, QFormLayout::LabelRole, presets_dropdown); -- cgit v1.2.3