Some basic question
Hi friends,
I am using Qt Creature to form applications and to new C++(not C) adventure I encountered like question below.
what is static_cast here, <>, actually I never understand thes code
1 2 3
|
static_cast<void (QSerialPort::*)(QSerialPort::SerialPortError)>
(&QSerialPort::error)
|
|
connect(serial, static_cast<void (QSerialPort::(QSerialPort::SerialPortError)>(&QSerialPort::error),this, &MainWindow::handleError);
|
also
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
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; --> what does it mean?
|
Thanks to helps
Last edited on
It casts a function pointer to a pointer to a member function of the class
QSerialPort
that take the parameter
QSerialPort::SerialPortError
The const promises the caller of that function that no member variables are changed during the call.
Topic archived. No new replies allowed.