[SOLVED] Qt4 Custom Window not compiling
Posted: Fri Jan 15, 2010 4:24 pm
I'm trying to make a custom QMainWindow. I have this error:
MainWindow.h:
Here's MainWindow.cpp:
I'm using Qt Creator to develop.
Here's the code I'm trying to compile::20: multiple definition of `non-virtual thunk to MainWindow::~MainWindow()'
:15: multiple definition of `MainWindow::~MainWindow()'
:9: first defined here
MainWindow.h:
Code: Select all
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QFileDialog>
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QMainWindow *parent = 0);
virtual ~MainWindow();
private:
QMenu *file;
QAction *save;
QFileDialog *saveDialog;
private slots:
void newLevel();
void saveLevel();
void loadLevel();
};
#endif // MAINWINDOW_H
Code: Select all
#include "MainWindow.h"
MainWindow::MainWindow(QMainWindow *parent) : QMainWindow(parent)
{
setWindowIcon(QIcon("icon.png"));
setWindowTitle("Level Editor Development Version");
setPalette(QPalette(Qt::white));
file = menuBar()->addMenu("&File");
save = new QAction("&Save", this);
file->addAction(save);
connect(save, SIGNAL(triggered()), this, SLOT(saveLevel()));
}
MainWindow::~MainWindow()
{
delete file;
delete save;
delete saveDialog;
}
void MainWindow::saveLevel()
{
saveDialog->getSaveFileName(NULL, "File:");
saveDialog->show();
}
void MainWindow::loadLevel()
{
}
void MainWindow::newLevel()
{
}