Results 1 to 14 of 14

Thread: Why Qt can not find a public slot?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Location
    Russia, Moscow
    Posts
    35
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Why Qt can not find a public slot?

    Hi.
    When I compile my application compiler says that it can't find two public slots.

    Qt Code:
    1. Object::connect: No such slot QWidget::geometryClicked(Geometry*,QPoint) in src/mwnd.cpp:28
    2. Object::connect: No such slot QWidget::mouseEventCoordinate(QMouseEvent*,QPointF) in src/mwnd.cpp:46
    To copy to clipboard, switch view to plain text mode 

    All the slots are defined in header and are writed in cpp file.

    This is the part of code where I connect SIGNAL in mc and l and SLOT in mwnd.
    Qt Code:
    1. mc = new MapControl( mapMcSize );
    2. mapadapter = new TileMapAdapter("robots.local", "/maps/maps/%1/%2/%3.png", 256, 0, 17);
    3. l = new MapLayer("Custom Layer", mapadapter);
    4. mc->addLayer(l);
    To copy to clipboard, switch view to plain text mode 

    27 - 28
    Qt Code:
    1. connect(l, SIGNAL( geometryClicked(Geometry*,QPoint) ),
    2. this, SLOT( geometryClicked(Geometry*,QPoint) ));
    To copy to clipboard, switch view to plain text mode 

    45-46
    Qt Code:
    1. connect(mc,SIGNAL(mouseEventCoordinate(const QMouseEvent*,QPointF)),
    2. this, SLOT(mouseEventCoordinate(QMouseEvent*,QPointF)));
    To copy to clipboard, switch view to plain text mode 


    Header:
    Qt Code:
    1. public slots:
    2. void geometryClicked(Geometry* geom, QPoint coord_px);
    3. void mouseEventCoordinate(QMouseEvent* event,QPointF point);
    To copy to clipboard, switch view to plain text mode 

    CPP:
    Qt Code:
    1. void mwnd::geometryClicked(Geometry *geom, QPoint)
    2. {
    3. if (geom->hasClickedPoints())
    4. {
    5. QList<Geometry*> pp = geom->clickedPoints();
    6. for (int i=0; i<pp.size(); i++)
    7. {
    8. QMessageBox::information(this, geom->name(), pp.at(i)->name());
    9. }
    10. }
    11. else if (geom->GeometryType == "Point")
    12. {
    13. QMessageBox::information(this, geom->name(), "just a point");
    14. }
    15. }
    16. void mwnd::mouseEventCoordinate(QMouseEvent *event,QPointF point)
    17. {
    18. QMessageBox::information(this, "Test", QString("%1 : %2").arg(point.x()).arg(point.y()));
    19. event->accept();
    20. }
    To copy to clipboard, switch view to plain text mode 

    What's I does wrong? Where is my mistake?
    (Sorry for bad english)

    PS I used qmapcontrol http://www.medieninf.de/qmapcontrol/
    Last edited by Alex Snet; 12th April 2009 at 19:24.

Similar Threads

  1. Problem When Creating my own Slot
    By Fatla in forum Qt Programming
    Replies: 12
    Last Post: 6th June 2008, 14:44
  2. problems installing Qt opensource with msvc2008 support
    By odin1985 in forum Installation and Deployment
    Replies: 6
    Last Post: 24th May 2008, 09:06
  3. Replies: 1
    Last Post: 6th March 2007, 15:27
  4. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.