This is QT btw.

I get the following error when i write "make" in the terminal window:

QObject::setParent: New parent must be in the same thread as the previous parent

here's my headerfile:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QDate>
#include <QMainWindow>
#include <QTableWidget>


class QAction;
class QLabel;

class MainWindow : public QTableWidget
{
        Q_OBJECT

    public:
        MainWindow();
	

    public slots:
	void newFile();
	/*void open();
	bool save();
	bool saveAs();
	void find();
	void goToCell();
	void sort();
	void about();
	void openRecentFile();
	void updateStatusBar();*/
	
      

    private:
	void lagKalender();
	void createActions();
	void createMenus();
	void createContextMenu();
	void createToolBars(); 
	void readSettings();
	void writeSettings();
	bool okToContinue();
	bool loadFile(const QString &fileName);
	bool saveFile(const QString &fileName);
	void setCurrentFiles(const QString &fileName);
	void updateRecentFileAtions();
	QString strippedName(const QString &fullFileName);

	QTableWidget *item1;
	QLabel *locationLabel;
	QLabel *formulaLabel;
	QStringList recentFiles;
	QString curFile;

	enum { MaxRecentFiles = 5 };
	QAction *recentFileActions[MaxRecentFiles];
	QAction *separatorAction;

	QMenuBar *menuBar;

	QMenu *fileMenu;
	QMenu *editMenu;
	QMenu *selectSubMenu;
	QMenu *toolsMenu;
	QMenu *optionsMenu;
	QMenu *helpMenu;

	QToolBar *fileToolBar;
	QToolBar *editToolBar;
	
	QAction *newAction;
	QAction *openAction;
	QAction *exitAction;
	QAction *saveAction;
	QAction *saveAsAction;
	QAction *cutAction;
	QAction *copyAction;
	QAction *pasteAction;
	QAction *deleteAction;
	QAction *aboutQtAction;
	QAction *selectRowAction;
	QAction *selectCollumnAction;
	QAction *selectAllAction;
	QAction *findAction;
	QAction *goToCellAction;
	QAction *recalculateAction;
	QAction *sortAction;
	QAction *showGridAction;
	QAction *autoRecalcAction;
	QAction *aboutAction;
	QAction *setShortCut;


};
#endif

There are some stuff that havent been used yet in, but i cant do any other stuff untill i sort this problem.

main code file:

#include <QtGui>
#include "mainwindow.h"



MainWindow::MainWindow()
{
	createActions();
 	createMenus();
	lagKalender();






}
void MainWindow::lagKalender()
{




	this->setRowCount(7);
	this->setColumnCount(7);

	this->setHorizontalHeaderItem(0, new QTableWidgetItem("Monday"));
	this->setHorizontalHeaderItem(1, new QTableWidgetItem("Tuesday"));
	this->setHorizontalHeaderItem(2, new QTableWidgetItem("Wednesday"));
	this->setHorizontalHeaderItem(3, new QTableWidgetItem("Thursday"));
	this->setHorizontalHeaderItem(4, new QTableWidgetItem("Friday"));
	this->setHorizontalHeaderItem(5, new QTableWidgetItem("Saturday"));
	this->setHorizontalHeaderItem(6, new QTableWidgetItem("Sunday"));

	this->setVerticalHeaderItem(0, new QTableWidgetItem("Week1"));
	this->setVerticalHeaderItem(0, new QTableWidgetItem("Week2"));
	this->setVerticalHeaderItem(0, new QTableWidgetItem("Week3"));
	this->setVerticalHeaderItem(0, new QTableWidgetItem("Week4"));
	this->setVerticalHeaderItem(0, new QTableWidgetItem("Week5"));
	this->setVerticalHeaderItem(0, new QTableWidgetItem("Week6"));
	this->setVerticalHeaderItem(0, new QTableWidgetItem("Week7"));

	for (int i=0; i < 31; i++)
	{
		int column = i / 7;
		int row = i % 7;
		QString s;
		s.setNum (i+1);
		this->setItem(column, row, new QTableWidgetItem(s));
	}
}
void MainWindow::createActions()
{
	newAction = new QAction(tr("&New"), this);
	newAction->setIcon(QIcon(":/images/new.pgn"));
	newAction->setShortcut(QKeySequence::New);
	newAction->setStatusTip(tr("Create a new calendar"));
	connect(newAction, SIGNAL(triggered()), 
			this, SLOT(newFile()));

	exitAction = new QAction(tr("E&xit"), this);
	exitAction->setShortcut(tr("Ctrl+Q"));
	exitAction->setStatusTip(tr("Exit the application"));
	connect(exitAction, SIGNAL(triggered()),
			this, SLOT(close()));


	aboutQtAction = new QAction(tr("About &Qt"), this);
	aboutQtAction->setStatusTip(tr("Show the Qt library's About box"));
	connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
void MainWindow::createMenus()
{

	fileMenu = menuBar->addMenu(tr("&File"));
	fileMenu->addAction(newAction);
	fileMenu->addAction(openAction);
	fileMenu->addAction(saveAction);
	fileMenu->addAction(saveAsAction);

	separatorAction = fileMenu->addSeparator();
	for (int i = 0; i < MaxRecentFiles; ++i){
		fileMenu->addAction(recentFileActions[i]);
	}
	fileMenu->addSeparator();
	fileMenu->addAction(exitAction);
	
	editMenu = menuBar->addMenu(tr("&Edit"));
	editMenu->addAction(cutAction);
	editMenu->addAction(copyAction);
	editMenu->addAction(pasteAction);
	editMenu->addAction(deleteAction);
	
	selectSubMenu = editMenu->addMenu(tr("&Select"));
	selectSubMenu->addAction(selectRowAction);
	selectSubMenu->addAction(selectCollumnAction);
	selectSubMenu->addAction(selectAllAction);

	editMenu->addSeparator();
	editMenu->addAction(findAction);
	editMenu->addAction(goToCellAction);

	toolsMenu = menuBar->addMenu(tr("&Tools"));
	toolsMenu->addAction(recalculateAction);
	toolsMenu->addAction(sortAction);
	
	optionsMenu = menuBar->addMenu(tr("&Options"));	
	optionsMenu->addAction(showGridAction);
	optionsMenu->addAction(autoRecalcAction);
	
	menuBar->addSeparator();

	helpMenu = menuBar->addMenu(tr("&Help"));
	helpMenu->addAction(aboutAction);
	helpMenu->addAction(aboutQtAction);
}
void MainWindow::newFile()
{
	
	if (okToContinue()) {
		
	}
}

bool MainWindow::okToContinue()
{
	if(isWindowModified()) {
		int r = QMessageBox::warning(this, tr("Kalender"),
				tr("The documenet has been modified.\n"
				"Do you want to save your changes?"),
			QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
		if(r == QMessageBox::Yes){
			return true;
		}
		else if(r == QMessageBox::Cancel){
			return false;
		}
	}
	return true;
}

main:

#include <QtGui>

#include "mainwindow.h"

int main(int argc, char *argv[])
{
        QApplication app(argc, argv);
        MainWindow window;
        window.resize(640, 256);
        window.show();
        return app.exec();
}

Thxn in advance for helping

the error i get is:
QObject::setParent: Cannot set parent, new parent is in a different thread
Segmentation fault

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.