0
votes

I was following some code posted in other questions on how to connect the status bar between parent and distant child by means of signals and slots.

MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent)
{
...
connect(myCanvas,SIGNAL(mouseMoved(QString)),
        this,slot(setStatusBar(QString)));
...
}

Somewhere in the class MainWindow the following is declared as public slot:

void MainWindow::setStatusBarText(const QString& text) {
statusBar()->showMessage(text);
}

in the class to which myCanvas belongs declares the signal:

signals:
void mouseMoved(const QString&);

And emits the signal:

void GraphicsView::mouseMoveEvent(QMouseEvent *mouseEvent)
{
 ...
     emit mouseMoved(QString("("+QString::number(mouseMoveCatch.x())+";"
        +QString::number(mouseMoveCatch.y())+")"));
 ...
 }

I am sure QString is properly included. But when i compile I get an error on the connect line saying "QString does not refer to a value". I have no clue what this means. Thanks for any help!

1
You need to capitalize SLOT in your connect line. - RA.

1 Answers

0
votes

You have a case error on the line

connect(myCanvas,SIGNAL(mouseMoved(QString)),
    this,slot(setStatusBar(QString)));

You should be using SLOT, not slot.