0
votes

As far as the GUI designer, I understand how certain signals affect certain slots and invoke code. Other than that method, I am unsure about how to invoke a slot from a signal.

Take this example:

void QFileDialog::directoryEntered ( const QString & directory ) [signal]

This is a signal. When the directory is entered, I want this to populate a widget QColumnView with the contents of the directory.

How does a non widget signal invoke a slot of a UI widget.

I assume you use connect but the example provided uses two separate objects.

1

1 Answers

1
votes

Signals and slots are features of QObject. It works well even for non-GUI code.

Connecting a signal to a slot is always done through the connect function:

connect(myDialog, SIGNAL(directoryEntered(QString)),
    this, SLOT(updateColumn(QString)));

here assuming that you have updateColumn() slot in your main object handling the actual UI update of that QColumnView.