PDA

View Full Version : Qt Seg Fault on Cross-Class Signal Access



StarKid
October 18th, 2011, 02:23 PM
I have a class called appWindow that subclasses QMainWindow. It contains a QProgressBar* called webLoad and an instance of another class:


firstpage = new articlePage;articlePage contains a QWebView called wordSearch.

I want the progress bar to show the progress of wordSearch while loading, so, in appwindow.cpp, I have:


connect(firstPage->wordSearch, SIGNAL(loadProgress(int)), webLoad, SLOT(setValue(int)));.

When I try to access a signal of a member variable of another class, I get a seg fault. There's only one case in which I've made this work: accessing the clicked() signal of QPushButton *quit of appWindow from main.cpp to quit the application.
I always instantiate the class before trying to connect signals. I can access signals of in-class member variables just fine. I've been banging my head over this for days. What could I be doing wrong?

hakermania
October 18th, 2011, 02:45 PM
Hello, I don't know an instant solution to your question, but I would suggest asking at
www.qtcentre.org/forum.php or at
http://www.qtforum.org/index.html :)

karlson
October 18th, 2011, 02:47 PM
I have a class called appWindow that subclasses QMainWindow. It contains a QProgressBar* called webLoad and an instance of another class:


firstpage = new articlePage;articlePage contains a QWebView called wordSearch.

I want the progress bar to show the progress of wordSearch while loading, so, in appwindow.cpp, I have:


connect(firstPage->wordSearch, SIGNAL(loadProgress(int)), webLoad, SLOT(setValue(int)));.

When I try to access a signal of a member variable of another class, I get a seg fault. There's only one case in which I've made this work: accessing the clicked() signal of QPushButton *quit of appWindow from main.cpp to quit the application.
I always instantiate the class before trying to connect signals. I can access signals of in-class member variables just fine. I've been banging my head over this for days. What could I be doing wrong?

Have you analyzed the core dump?