basic C++ question...
-
Qt project creates 'folders" , for lack of other terminology headers sources forms resulting in this constructor
#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}MainWindow::~MainWindow()
{
delete ui;
}I am trying to add "forms " to my exiting project. I follow the Qt menus... but I do not know how to modify my constructor.
#ifdef BYPASS
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
#endifCCC_MdiChild::CCC_MdiChild()
{
setAttribute(Qt::WA_DeleteOnClose);
isUntitled = true;
}Please help me to understand what Qt did and how to modify
my constructor so I can access my "form".
The verbal description / code annotation would be appreciated.
Thanks -
Qt project creates 'folders" , for lack of other terminology headers sources forms resulting in this constructor
#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}MainWindow::~MainWindow()
{
delete ui;
}I am trying to add "forms " to my exiting project. I follow the Qt menus... but I do not know how to modify my constructor.
#ifdef BYPASS
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
#endifCCC_MdiChild::CCC_MdiChild()
{
setAttribute(Qt::WA_DeleteOnClose);
isUntitled = true;
}Please help me to understand what Qt did and how to modify
my constructor so I can access my "form".
The verbal description / code annotation would be appreciated.
Thanks -
This is not a C++ question, basic or otherwise. It is a QT question. You will probably get a better answer from a QT specific forum.
Keep Calm and Carry On
-
Could you at least read this for me - in English - in generic way ? It is C++_ syntax I am having problems with. Would appreciate that.
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)It's the constructor of a class called
MainWindow
.QMainWindow
andui
are being initialized using an initialization list."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Could you at least read this for me - in English - in generic way ? It is C++_ syntax I am having problems with. Would appreciate that.
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)It is a single parameter constructor of the
MainWindow
class. The constructor accepts a single parameter which is a pointer to aQWidget
object. The constructor sets itsQMainWindow
property to the input parameter - in this case the pointer namedparent
. It then sets itsui
property by calling theUi::MainWindow
constructor, to create a new object of that class. To find out what the latter returns you need to look at theUi
class documentation.