Help, I'm lost. I created a main window in the designer and saved it and now I'm trying to use it.
main.cpp
#include <QApplication>
#include "MainWindow.h"
int main(int argc, char *argv[])
{
MainWindow *mainW = new MainWindow();
mainW->show();
return app.exec();
}
#include <QApplication>
#include "MainWindow.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow *mainW = new MainWindow();
mainW->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
MainWindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QDialog>
#include <ui_MainWindow.h>
class MainWindow
: public QDialog,
public Ui
::MainWindow{
Q_OBJECT
public:
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QDialog>
#include <ui_MainWindow.h>
class MainWindow : public QDialog, public Ui::MainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
}
To copy to clipboard, switch view to plain text mode
MainWindow.cpp
#include "MainWindow.h"
MainWindow
::MainWindow(QWidget *parent
){
setupUi(this);
}
#include "MainWindow.h"
MainWindow::MainWindow(QWidget *parent )
: QDialog(parent)
{
setupUi(this);
}
To copy to clipboard, switch view to plain text mode
The error that I get is:
MainWindow.cpp: In constructor 'MainWindow::MainWindow(QWidget*)':
MainWindow.cpp:26: error: no matching function for call to 'MainWindow::setupUi(MainWindow* const)'
Ui/ui_MainWindow.h:52: note: candidates are: void Ui_MainWindow::setupUi(QMainWindow*)
So I know my problem is the "setupUi(this);" What the hell does it want? I'm lost.
Thanks,
Paul
Bookmarks