catching mouse signal

Oh Jin Suk sv00116 at ccs.sogang.ac.kr
Fri Apr 13 06:30:58 BST 2001


 hi?
 I write program with Kdevelop 1.4
 I'd like to write program that App Class catches mouseMoveEvent signal from View class, as following

> ----------------------app class--------------------------------------
> #include "view.h"
> #include "doc.h"
> class View;
> class Doc;
>
> class App : public KMainWindow
>
> {
>
> ...
>
> void slotChangeXY(int,int);
> ....
>
> private:
> View *view;
> ....
> }
>
> void App::App():KMainWindow(0,"app"),view(new View(new Doc(),this,0,0))
> {
> ...
> initStatusBar();
> connect(view,SIGNAL(signalChangeXY(int,int),this,SLOT(slotChangeXY(int,int)));
>
> ...
> }
>
> void App::initStatusBar()
> {
> statusBar()->insertItem(i18n("Reday"),1);
> statusBar()->insertItem(i18n(" : "),2,0,true);
> }
>
>
> void App::slotChangeXY(int x, int y)
> {
> QString pos;
> pos.sprintf("%d %d",x,y);
> statusBar()->changeItem(pos,2);
> }
>
> ------------------view class---------------------------
> #include "app.h"
> #include "doc.h"
>
> class App;
> class Doc;
>
> class View : public QWidget
>
> {
> ....
> signals :
> void signalChangeXY(int,int);
> ...
> }
>
> View ::View(Doc* pdoc, QWidget *parent, const char* name, int wflags)
> : QWidget(parent, name, wflags)
> {
> ...
> setMouseTracking(true);
> ......
> }
>
> ....
>
> void View::mouseMoveEvent(QMouseEvent *e)
> {
> emit signalChangeXY(e->pos().x(), e->pos().y())
> }
>
> ---------------------------------
 shortly, app catches view's mouse position and show in on statusbar
 but in app class, it doesn't catch signal from view class, what is wrong do you think?

 thank you

from jin



-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list