 |
Das deutsche QBasic- und FreeBASIC-Forum Für euch erreichbar unter qb-forum.de, fb-forum.de und freebasic-forum.de!
|
Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
Autor |
Nachricht |
TuxForAll
Anmeldungsdatum: 24.06.2007 Beiträge: 9
|
Verfasst am: 05.10.2010, 18:50 Titel: Segmentfehler |
|
|
Moin moin,
ich habe hier ein kleines Problem, denke ich.
Und zwar dattel ich mit Qt rum und stoße hier auf für seltsame Probleme und das bei
einfachen Sachen! Aber schaut auch den Code an habe die Stellen markiert, wo es kracht!
qt_types.h
Code: |
typedef struct {int dummy;} qt_Application;
typedef struct {int dummy;} qt_widget;
|
QApplicationWrapper.h
Code: |
#include "qt_types.h"
#ifdef __cplusplus
extern "C" {
#endif
qt_Application* newApplication1(int argc, char** argv, int qtversion);
int execQApplication(qt_Application* handle);
#ifdef __cplusplus
}
#endif
|
QApplicationWrapper.cpp
Code: |
extern "C" {
#include "QApplicationWrapper.h"
}
#include <QtGui/QApplication>
class QApplicationWrapper : public QApplication
{
public:
QApplicationWrapper(int &argc, char **argv, int QTVERSION) : QApplication(argc, argv, QTVERSION) {}
~QApplicationWrapper() {}
};
qt_Application* newApplication1(int argc, char** argv, int qtversion) {
return (qt_Application*) new QApplicationWrapper((int &)argc, argv, qtversion);
}
int execQApplication(qt_Application* handle) {
return (int) ((QApplicationWrapper *)handle)->exec();
}
|
qt_types.bi
Code: |
type qt_Widget: dummy as integer: end type
type qt_Application: dummy as integer: end type
|
Code: |
#include once "qt_types.bi"
#define null 0
#define UseUDT
extern "c" lib "FBQtCore"
declare function newApplication1 cdecl(byref argc as integer, byval argv as zstring ptr ptr, byval qtvsersion as integer) as qt_Application ptr
declare function execQApplication cdecl(byval handle as qt_Application ptr) as integer
declare function newQWidget cdecl(byval widget as qt_Widget ptr, byval f as integer) as qt_Widget ptr
declare sub showQWidget cdecl(byval widget as qt_Widget ptr)
end extern
type QApplication
private:
as QApplication ptr newQtApplication
public:
declare constructor (byref argc as integer, byval argv as zstring ptr ptr, byval qtvsersion as integer = &H40603)
declare destructor()
'
declare function exec() as integer
end type
type QWidget
private:
as QWidget ptr newQtWidget
public:
declare constructor(byval parent as qt_Widget ptr = null, byval f as integer = 0)
declare destructor()
'
declare sub show()
end type
constructor QApplication(byref argc as integer, byval argv as zstring ptr ptr , byval qtvsersion as integer)
this.newQtApplication = newApplication1(argc, argv, qtvsersion)
end constructor
function QApplication.exec() as integer
return execQApplication(this.newQtApplication)
end function
'##################################################################
constructor QWidget(byval parent as qt_Widget ptr, f as integer)
this.newQtWidget = newQWidget(parent, f)
end constructor
sub QWidget.show()
showQWidget(this.newQtWidget)
end sub
#ifdef UseUDT
'läuft nicht doesn't run
dim as QApplication ptr MyApp = new QApplication(__fb_argc__, __fb_argv__)
dim as QWidget ptr Widget = new QWidget()
dim as QWidget ptr Widget2 = new QWidget(Widget) ' <- SIGSEGV ohne Widget2 und Widget3
dim as QWidget ptr Widget3 = new QWidget(Widget2) ' dann kracht es in Widget->show()
Widget->show() '<- SIGSEGV
MyApp->exec()
#else
' läuft run
dim as qt_Application ptr MyApp = newApplication1(__fb_argc__, __fb_argv__, &H40603)
dim as qt_Widget ptr Widget = newQWidget(null, 0)
dim as qt_Widget ptr Widget2 = newQWidget(Widget, 0)
dim as qt_Widget ptr Widget3 = newQWidget(Widget2, 0)
showQWidget(Widget)
execQApplication(MyApp)
#endif
end
|
ick weis nicht weiter aber vielleicht hat ja jemand eine Idee!
Gruß aus HH und danke für die Mühe. |
|
Nach oben |
|
 |
TuxForAll
Anmeldungsdatum: 24.06.2007 Beiträge: 9
|
Verfasst am: 12.11.2010, 16:41 Titel: Segmentfehler |
|
|
Hallo,
habe ein Lösung gefunden. |
|
Nach oben |
|
 |
Westbeam

Anmeldungsdatum: 22.12.2009 Beiträge: 760
|
Verfasst am: 12.11.2010, 17:03 Titel: |
|
|
...
...
Wäre aber toll, wenn du die Lösung auch veröffentlichen würdest. Wenn jemand den gleichen Fehler hat, kann er hier im Forum auch nach der Lösung suchen.  |
|
Nach oben |
|
 |
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
|