PDA

View Full Version : How to show a window in .so without QMainwindow blocking function.



Jaga
20th March 2015, 06:32
Dear All,

* I need to call a function in a BLib.so(for eg) from another ALib.so(for eg) library.

* BLib.so contains a widget application it will show the dynamic list of operations in a qtablewidget.

* I have created the BLib.so using Qt-4.8.4 (QtCreator-2.5.2) as normal (main.cpp, cdebugview.cpp,.h), but since it is a dll i dont want main.cpp file so i removed.

* In cdebugview.cpp, I have two exported functions to call and show the widget. But the problem is, when I try to create a object of the widget class it is crashed with the following error.

#0 0xffffe430 in __kernel_vsyscall ()
#1 0xb743b0cb in waitpid () from /lib/libpthread.so.0
#2 0xb74d7793 in g_spawn_sync () from /lib/libglib-2.0.so.0
#3 0xb74d7cf4 in g_spawn_command_line_sync () from /lib/libglib-2.0.so.0
#4 0xb6308046 in ?? () from /usr/lib/gtk-2.0/modules/libgnomesegvhandler.so
#5 <signal handler called>
#6 0xffffe430 in __kernel_vsyscall ()
#7 0xb71b18df in raise () from /lib/libc.so.6
#8 0xb71b3220 in abort () from /lib/libc.so.6
#9 0xb2d7e4f6 in qt_message_output(QtMsgType, char const*) () from /root/Desktop/10.3/TransUC3/Debug//BLib.so
#10 0xb2d7e6c9 in qt_message(QtMsgType, char const*, char*) () from /root/Desktop/10.3/TransUC3/Debug//BLib.so
#11 0xb2d7e7e8 in qFatal(char const*, ...) () from /root/Desktop/10.3/TransUC3/Debug//BLib.so
#12 0xb2692c4e in QWidgetPrivate::QWidgetPrivate(int) () from /root/Desktop/10.3/TransUC3/Debug//BLib.so
#13 0xb29ddd20 in QMainWindow::QMainWindow(QWidget*, QFlags<Qt::WindowType>) () from /root/Desktop/10.3/TransUC3/Debug//BLib.so
#14 0xb264c961 in CDebugView::CDebugView (this=0x8fe9ea0, parent=0x0) at cdebugview.cpp:11
#15 0xb264dd21 in ShowDebugWndw () at cdebugview.cpp:129

Kindly help to resolve this issue.
Thanks in Advance..........

anda_skoa
20th March 2015, 10:47
Make sure your application creates a QApplication instance.

Cheers,
_

Jaga
20th March 2015, 11:38
Thanks for your reply..

I come across many forums but not able to get the answer.

my Blibs.so export function is



int ShowDebugWndw()
{
if(DebugViewDlg == NULL)
{
DebugViewDlg = new CDebugView(); //Program crashed when this calls happen
}
DebugViewDlg->ShowDebugWindow();
return 0;
}


My mainwindow class is



CDebugView *DebugViewDlg = NULL;

CDebugView::CDebugView(QWidget *parent) : QMainWindow(parent),
ui(new Ui::CDebugView) // Crashed at this line
{
ui->setupUi(this);

Initialize();
}

CDebugView::~CDebugView()
{
delete ui;
}
void CDebugView::ShowDebugWindow()
{
this->show();
this->raise();
}


It is crashed on asking QApplication instance.

so I created QApplication as global


QApplication app(NULL,NULL);

It is working in Linux Opensuse 11.4 but crashing as usual in Opensuse 10.3.

My Architecture is

1. Qt GUI App --> loads a dynamic library Alib.so which doesn't have GUI (normal cpp applications)
2. Alib.so --> loads another dynamic library Blib.so which contains QMainWindow


Sorry all, I know its too complex in its architecture but Ii need to follow this.
Please help me to resolve this.

Thanks in advance..