settingsdialog.h Example File
terminal/settingsdialog.h
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include <QDialog>
#include <QSerialPort>
namespace Ui {
class SettingsDialog;
}
class QIntValidator;
class SettingsDialog : public QDialog
{
Q_OBJECT
public:
struct Settings {
QString name;
qint32 baudRate;
QString stringBaudRate;
QSerialPort::DataBits dataBits;
QString stringDataBits;
QSerialPort::Parity parity;
QString stringParity;
QSerialPort::StopBits stopBits;
QString stringStopBits;
QSerialPort::FlowControl flowControl;
QString stringFlowControl;
bool localEchoEnabled;
};
explicit SettingsDialog(QWidget *parent = nullptr);
~SettingsDialog();
Settings settings() const;
private slots:
void showPortInfo(int idx);
void apply();
void checkCustomBaudRatePolicy(int idx);
void checkCustomDevicePathPolicy(int idx);
private:
void fillPortsParameters();
void fillPortsInfo();
void updateSettings();
private:
Ui::SettingsDialog *m_ui = nullptr;
Settings m_currentSettings;
QIntValidator *m_intValidator = nullptr;
};
#endif // SETTINGSDIALOG_H