hello,
i've got the following implementation:
int main() {
GUI gui;
gui.start();
}
int main() {
GUI gui;
gui.start();
}
To copy to clipboard, switch view to plain text mode
void GUI::start(){
int argc = 0;
char** argv = 0;
m_MainWindow = new MainWindow();
m_MainWindow->show();
m_Application->exec();
}
void GUI::start(){
int argc = 0;
char** argv = 0;
m_Application = new QApplication( argc, argv );
m_MainWindow = new MainWindow();
m_MainWindow->show();
m_Application->exec();
}
To copy to clipboard, switch view to plain text mode
so far, everything works fine. but as soon as i call the following function:
void MainWindow::startDetection() {
ImageWindow* edgeDetectedImageWindow = new ImageWindow(this, m_ImageName, resultLocation, name);
edgeDetectedImageWindow->show();
}
void MainWindow::startDetection() {
ImageWindow* edgeDetectedImageWindow = new ImageWindow(this, m_ImageName, resultLocation, name);
edgeDetectedImageWindow->show();
}
To copy to clipboard, switch view to plain text mode
the whole application ist still working fine unless i close it: Segmentation fault
the debugger says:
(gdb) bt
#0 0xb5c28326 in ?? () from /lib/tls/i686/cmov/libc.so.6
#1 0xb5c28fc0 in ?? () from /lib/tls/i686/cmov/libc.so.6
#2 0xb5be9c1a in exit () from /lib/tls/i686/cmov/libc.so.6
#3 0xb5bd177d in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
#4 0x08056161 in _start () at ../sysdeps/i386/elf/start.S:119
anyone can help me with this matter?
here are the headers of the classes:
#ifndef GUI_H
#define GUI_H
#include <QSplashScreen>
#include <QApplication>
#include "MainWindow/MainWindow.h"
#define THIS GUI
using namespace std;
class THIS{
// Q_OBJECT;
public:
THIS();
~THIS();
void start();
private:
MainWindow* m_MainWindow;
};
#undef THIS
#endif /*GUI_H*/
#ifndef GUI_H
#define GUI_H
#include <QSplashScreen>
#include <QApplication>
#include "MainWindow/MainWindow.h"
#define THIS GUI
using namespace std;
class THIS{
// Q_OBJECT;
public:
THIS();
~THIS();
void start();
private:
MainWindow* m_MainWindow;
QApplication* m_Application;
};
#undef THIS
#endif /*GUI_H*/
To copy to clipboard, switch view to plain text mode
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QStatusBar>
#include <QDir>
#include <QFrame>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QScrollArea>
#include <QLabel>
#include <QFileDialog>
#include <QMessageBox>
#include <QMenuBar>
#include <QMenu>
#include <QAction>
#include <QString>
#include <QIcon>
#include "../../Modules/NevedgModule/NevedgModule.h"
#include "../../Modules/Obj2PgmModule/Obj2PgmModule.h"
#include "../../Modules/HystlineModule/HystlineModule.h"
#include "../../Modules/PumaToQTConverterModule/PumaToQTConverterModule.h"
#include "../../Modules/HasplitModule/HasplitModule.h"
#include "../../Modules/FindRectangleModule/FindRectangleModule.h"
#include "../../Modules/FindCircleModule/FindCircleModule.h"
#include "../../Modules/GeometricObjectConverterModule/GeometricObjectConverterModule.h"
#include "ImageWindow/ImageWindow.h"
#include "GraphicsWindow/GraphicsWindow.h"
#define THIS MainWindow
using namespace std;
Q_OBJECT;
public:
THIS();
~THIS();
private:
void loadModules();
NevedgModule* m_NevedgModule;
Obj2PgmModule* m_Obj2PgmModule;
HystlineModule* m_HystlineModule;
PumaToQTConverterModule* m_PumaToQTConverterModule;
HasplitModule* m_HasplitModule;
FindRectangleModule* m_FindRectangleModule;
FindCircleModule* m_FindCircleModule;
GeometricObjectConverterModule* m_GeometricObjectConverterModule;
void createMainWidget();
void createMenus();
public slots:
void openImage();
void loadImage
(const QString &fileName
);
void startDetection();
};
#undef THIS
#endif
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QStatusBar>
#include <QDir>
#include <QFrame>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QScrollArea>
#include <QLabel>
#include <QFileDialog>
#include <QMessageBox>
#include <QMenuBar>
#include <QMenu>
#include <QAction>
#include <QString>
#include <QIcon>
#include "../../Modules/NevedgModule/NevedgModule.h"
#include "../../Modules/Obj2PgmModule/Obj2PgmModule.h"
#include "../../Modules/HystlineModule/HystlineModule.h"
#include "../../Modules/PumaToQTConverterModule/PumaToQTConverterModule.h"
#include "../../Modules/HasplitModule/HasplitModule.h"
#include "../../Modules/FindRectangleModule/FindRectangleModule.h"
#include "../../Modules/FindCircleModule/FindCircleModule.h"
#include "../../Modules/GeometricObjectConverterModule/GeometricObjectConverterModule.h"
#include "ImageWindow/ImageWindow.h"
#include "GraphicsWindow/GraphicsWindow.h"
#define THIS MainWindow
using namespace std;
class MainWindow : public QMainWindow {
Q_OBJECT;
public:
THIS();
~THIS();
private:
QString m_AppName;
QString m_ImageName;
QString m_ImageBaseName;
QString m_ImagePath;
void loadModules();
NevedgModule* m_NevedgModule;
Obj2PgmModule* m_Obj2PgmModule;
HystlineModule* m_HystlineModule;
PumaToQTConverterModule* m_PumaToQTConverterModule;
HasplitModule* m_HasplitModule;
FindRectangleModule* m_FindRectangleModule;
FindCircleModule* m_FindCircleModule;
GeometricObjectConverterModule* m_GeometricObjectConverterModule;
void createMainWidget();
QFrame* m_MainFrame;
QHBoxLayout* m_MainLayout;
QFrame* m_OperationsFrame;
QVBoxLayout* m_OperationsLayout;
QPushButton* m_LoadImagePushButton;
QPushButton* m_StartDetectionPushButton;
QScrollArea* m_InitialScrollArea;
QLabel* m_InitialLabel;
void createMenus();
QMenu* m_FileMenu;
QAction* m_LoadImageAction;
QAction* m_ExitAct;
QMenu* m_EditMenu;
QMenu* m_ViewMenu;
QMenu* m_HelpMenu;
public slots:
void openImage();
void loadImage(const QString &fileName);
void startDetection();
};
#undef THIS
#endif
To copy to clipboard, switch view to plain text mode
#ifndef IMAGEWINDOW_H
#define IMAGEWINDOW_H
#include <QMainWindow>
#include <QWidget>
#include <QString>
#include <QDir>
#include <QIcon>
#include <QScrollArea>
#include <QLabel>
#include <QMessageBox>
#define THIS ImageWindow
using namespace std;
Q_OBJECT;
public:
~THIS();
private:
public slots:
};
#undef THIS
#endif
#ifndef IMAGEWINDOW_H
#define IMAGEWINDOW_H
#include <QMainWindow>
#include <QWidget>
#include <QString>
#include <QDir>
#include <QIcon>
#include <QScrollArea>
#include <QLabel>
#include <QMessageBox>
#define THIS ImageWindow
using namespace std;
class ImageWindow : public QMainWindow {
Q_OBJECT;
public:
THIS(QWidget* parent, QString &imageName, QString &imagePath, QString &operation);
~THIS();
private:
QString m_ImageName;
QString m_ImagePath;
QString m_Operation;
QScrollArea *m_ImageScrollArea;
QLabel* m_ImageLabel;
public slots:
};
#undef THIS
#endif
To copy to clipboard, switch view to plain text mode
Bookmarks