How to add another constructor ?
-
wrote on 2 Jan 2023, 17:58 last edited by
OK, I git hopelessly lost in "put the code in "backticks" ,,,"
I call the class with this
TERMINAL_MainWindow *MW = new TERMINAL_MainWindow();
mdiArea->addSubWindow(MW)->
// setWindowState(Qt::WindowMinimized) ;
setWindowState(Qt::WindowMinimized) ;
text = "Bluetooth (serial) terminal ";
MW->setWindowTitle(text);it passes "null pointer" as parent...
How do I pass a option to run SPECIFIC constructor ?
What has to be changed ?I would prefer to build another class , if feasible, in SAME project.
TERMINAL_MainWindow::TERMINAL_MainWindow(QWidget *parent) :
QMainWindow(parent),
m_ui(new Ui::TERMINAL_MainWindow),
m_status(new QLabel),
m_console(new Console),
m_settings(new SettingsDialog),
//! [1]
m_serial(new QSerialPort(this))
//! [1]
{ -
OK, I git hopelessly lost in "put the code in "backticks" ,,,"
I call the class with this
TERMINAL_MainWindow *MW = new TERMINAL_MainWindow();
mdiArea->addSubWindow(MW)->
// setWindowState(Qt::WindowMinimized) ;
setWindowState(Qt::WindowMinimized) ;
text = "Bluetooth (serial) terminal ";
MW->setWindowTitle(text);it passes "null pointer" as parent...
How do I pass a option to run SPECIFIC constructor ?
What has to be changed ?I would prefer to build another class , if feasible, in SAME project.
TERMINAL_MainWindow::TERMINAL_MainWindow(QWidget *parent) :
QMainWindow(parent),
m_ui(new Ui::TERMINAL_MainWindow),
m_status(new QLabel),
m_console(new Console),
m_settings(new SettingsDialog),
//! [1]
m_serial(new QSerialPort(this))
//! [1]
{@AnneRanch said in How to add another constructor ?:
How do I pass a option to run SPECIFIC constructor ?
Simply change your ctor to get a- QWidget pointer as first parameter - it's nothing more than a normal function.
1/2