Seite 1 von 1

[gelöst] undefined reference to `vtable for MainWindow'

Verfasst: 3. August 2005 01:25
von rulzmaker

Code: Alles auswählen

/***************************************************************************
                          mainwnd.h  -  description
                             -------------------
    begin                : Mo Aug 1 2005
    copyright            : (C) 2005 by toni
    email                : cs_rulzmaker@web.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef __mwnd
#define __mwnd

#include <qmainwindow.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qmenubar.h>
#include <qobject.h>

class MainWindow: public QObject
{
    Q_OBJECT
    public:
    MainWindow(QWidget * parent = 0, const char * name = 0, WFlags f = WType_TopLevel);    
    ~MainWindow();
    void show();
    void setGeometry(int,int,int,int);
    QMainWindow* getWindow();

    public slots:
    void bsprachenClicked();

    private:
    QToolBar *toolbar;
    QLineEdit *edit;
    QPushButton *bsearch;
    QPushButton *bsprachen;
    QPopupMenu *pop_search;
    QMainWindow *window;
};

#endif //__mwnd

Code: Alles auswählen

/***************************************************************************
                          mainwnd.cpp  -  description
                             -------------------
    begin                : Mo Aug 1 2005
    copyright            : (C) 2005 by toni
    email                : cs_rulzmaker@web.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   window program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#include <qwidget.h>
#include <qmenubar.h>
#include <qpixmap.h>
#include "mainwnd.h"
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include <qlineedit.h>
#include <qmainwindow.h>

MainWindow::MainWindow(QWidget * parent , const char * name , WFlags f)
:QObject(parent, name)
{
    window=new QMainWindow(parent, name, f);
    toolbar=new QToolBar(window, "file operations");
    toolbar->setMovingEnabled(false);
    edit=new QLineEdit(toolbar);
    bsearch=new QPushButton( "&Suchen", toolbar );
    toolbar->addSeparator();
}

MainWindow::~MainWindow()
{
  delete toolbar;
  delete edit;
  delete bsearch;
  delete bsprachen;
  delete window;
}

void MainWindow::bsprachenClicked()
{
    qDebug("Lol");
}

void MainWindow::show()
{
    window->show();
}

void MainWindow::setGeometry(int x1,int y1, int x2, int y2)
{
    window->setGeometry(x1,y1,x2,y2);
}

QMainWindow* MainWindow::getWindow()
{
    return window;
}
Ich benutze KDevelop und der Fehler kommt seitdem ich das Q_OBJECT Makro drin habe.

Edit: schon erledigt. Habe einfach Build/autoconf and automake nochmal gestartet. Dnach configure und dann ging es.