Answer the question
In order to leave comments, you need to log in
Why does an Access violation occur?
Hello!
In my MyForm class, I inherit QMainWindow and pass a pointer to the parent widget to its constructor. If I try to call MyForm() with an argument in the form of a pointer to a widget, I get an Access Violation:
//forms.h
#include "ui_mainwindow.h"
#include "ui_settings.h"
class MainForm : public QMainWindow
{
Q_OBJECT
private:
Ui::MainWindow* mainWindow;
public:
explicit MainForm(QWidget* pobj = 0) : QMainWindow (pobj) {
mainWindow->setupUi(this);
}
Ui::MainWindow* getUiClass(){
return mainWindow;
}
};
//main.cpp
QMainWindow* form = new QMainWindow;
MainForm f1(form); //Ошибка!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question