Results 1 to 3 of 3

Thread: How to show a window in .so without QMainwindow blocking function.

  1. #1
    Join Date
    Mar 2015
    Posts
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default How to show a window in .so without QMainwindow blocking function.

    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..........

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to show a window in .so without QMainwindow blocking function.

    Make sure your application creates a QApplication instance.

    Cheers,
    _

  3. #3
    Join Date
    Mar 2015
    Posts
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: How to show a window in .so without QMainwindow blocking function.

    Thanks for your reply..

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

    my Blibs.so export function is

    Qt Code:
    1. int ShowDebugWndw()
    2. {
    3. if(DebugViewDlg == NULL)
    4. {
    5. DebugViewDlg = new CDebugView(); //Program crashed when this calls happen
    6. }
    7. DebugViewDlg->ShowDebugWindow();
    8. return 0;
    9. }
    To copy to clipboard, switch view to plain text mode 

    My mainwindow class is

    Qt Code:
    1. CDebugView *DebugViewDlg = NULL;
    2.  
    3. CDebugView::CDebugView(QWidget *parent) : QMainWindow(parent),
    4. ui(new Ui::CDebugView) // Crashed at this line
    5. {
    6. ui->setupUi(this);
    7.  
    8. Initialize();
    9. }
    10.  
    11. CDebugView::~CDebugView()
    12. {
    13. delete ui;
    14. }
    15. void CDebugView::ShowDebugWindow()
    16. {
    17. this->show();
    18. this->raise();
    19. }
    To copy to clipboard, switch view to plain text mode 

    It is crashed on asking QApplication instance.

    so I created QApplication as global

    Qt Code:
    1. QApplication app(NULL,NULL);
    To copy to clipboard, switch view to plain text mode 

    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..

Similar Threads

  1. Replies: 3
    Last Post: 14th June 2013, 12:22
  2. QSqlQuery exec blocking function
    By reinki0013 in forum Qt Programming
    Replies: 5
    Last Post: 13th August 2012, 19:00
  3. Replies: 2
    Last Post: 17th October 2011, 05:20
  4. Replies: 5
    Last Post: 15th August 2010, 22:34
  5. run function before closing QMainWindow
    By raphaelf in forum Newbie
    Replies: 1
    Last Post: 31st August 2006, 10:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.