Results 1 to 10 of 10

Thread: No Such Slot

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2012
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy No Such Slot

    I'm trying to implement a QT gui in visual studio, and i've been stuck at this point for a few hours and googling hasn't helped me much. It might be worth adding that i'm only using moc and uic, this isn't made as a QT project.

    I have my MainMenu.ui which uic's to ui_MainMenu.h
    I have MainMenu.h which moc's to moc_MainMenu.cpp
    And I have MainMenu.cpp which contains the methods for the slots.

    This all compiles, however at runtime i receive the errors
    Qt Code:
    1. Object::connect: No such slot QMainWindow::menuBarTriggered(QAction*) in c:\......\src\common\ui_mainmenu.h:144
    2. Object::connect: (sender name: 'menubar')
    3. Object::connect: (receiver name: 'MainMenu')
    To copy to clipboard, switch view to plain text mode 
    for every one of my slots.

    The relevant files are
    MainMenu.h
    Qt Code:
    1. #ifndef MAINMENU_H
    2. #define MAINMENU_H
    3.  
    4.  
    5. #include <QtCore/QObject>
    6. #include <QObject>
    7. #include <QtGui/QMainWindow>
    8. #include "ui_MainMenu.h"
    9.  
    10.  
    11. namespace Ui
    12. {
    13. class MainMenu;
    14. }
    15.  
    16. class MainMenu : public QMainWindow
    17. {
    18. Q_OBJECT
    19.  
    20. public:
    21. MainMenu(QWidget *parent =0);
    22. ~MainMenu();
    23.  
    24. public slots:
    25. void runButtonClicked();
    26. void browseButtonClicked();
    27. void arRadioToggled();
    28. void p2iRadioToggled();
    29. void vfRadioToggled();
    30. void menuBarTriggered(QAction*);
    31.  
    32. private:
    33. Ui::MainMenu *ui;
    34. };
    35. #endif
    To copy to clipboard, switch view to plain text mode 

    MainMenu.cpp
    Qt Code:
    1. #include "MainMenu.h"
    2. #include "ui_MainMenu.h"
    3. #include "moc_MainMenu.cpp"
    4. #include <iostream>
    5.  
    6. MainMenu::MainMenu(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainMenu)
    7. {
    8. ui->setupUi(this);
    9. }
    10.  
    11. MainMenu::~MainMenu()
    12. {
    13. delete ui;
    14. }
    15.  
    16. void MainMenu::runButtonClicked()
    17. {
    18. std::cout << "run";
    19. }
    20. void MainMenu::browseButtonClicked()
    21. {
    22. std::cout << "browse";
    23. }
    24. void MainMenu::arRadioToggled()
    25. {
    26. std::cout << "ar";
    27. }
    28. void MainMenu::p2iRadioToggled()
    29. {
    30. std::cout << "p2i";
    31. }
    32. void MainMenu::vfRadioToggled()
    33. {
    34. std::cout << "browse";
    35. }
    36. void MainMenu::menuBarTriggered(QAction* a)
    37. {
    38. std::cout << "menu";
    39. }
    To copy to clipboard, switch view to plain text mode 


    If you need the moc output or other files i can post those to.

    Thanks
    Last edited by Geoffry31; 13th November 2012 at 21:13.

Similar Threads

  1. Replies: 8
    Last Post: 7th November 2012, 14:10
  2. Replies: 2
    Last Post: 26th August 2011, 08:51
  3. no such slot
    By JeanC in forum Qt Programming
    Replies: 4
    Last Post: 26th January 2008, 11:39
  4. Slot
    By mickey in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2006, 18:51
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52

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.