Question

I have a KMainWindow:

//file.h
class MainWindow: public KMainWindow {
public:
    MainWindow(QWidget *parent = 0);
...
...
...

private slots:
    void removeClick();

//file.cpp
MainWindow::MainWindow(QWidget *parent) :
KMainWindow(parent) {}

void MainWindow::removeClick() 
    {
    std::cout << "Remove" << std::endl;
    }

I can compile it correctly, but when I execute the I get the message

Object::connect: No such slot KMainWindow::removeClick()

Can anybody help me?

Was it helpful?

Solution

You forgot the Q_OBJECT macro.

class MainWindow: public KMainWindow 
{
    Q_OBJECT

public:
    // [snip]
}

OTHER TIPS

solved using KXmlGuiWindow instead of KMainWindow and the Q_OBJECT macro

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top