Notifications
Clear all

[Closed] MaxSDK Qt How to use a custom function in a slot?

I have a plugin which has a QWidget window with a LineEdit(edtPrefix) and a QListWidget. I’m trying to hook up a signal for when the LineEdit is changed it will add a prefix to the items in the List. When I compile the .ui I get the following in the ui header file. Actually this is from a test to see if the connect is working if I use a button SLOT to set the focus. Which works correctly.

QObject::connect(edtPrefix, SIGNAL(textEdited(QString)), btnExport, SLOT(setFocus()));

So I’m confused with how to reference the parent qt window to run a custom function which would update the List.

I’ve tried setting the SLOT to the Qt dialog window and update() in the designer but update is never called.

QObject::connect(edtPrefix, SIGNAL(textEdited(QString)), QtDialogWindow, SLOT(update()));

I’m assuming I can change update() to a function of my choice so I believe the problem is in the QtDialogWindow. I not sure how and where to declare and define this.

QtDialogWindow is my QWidget window.

void setupUi(QWidget *QtDialogWindow)

Hope this makes sense.

Rod

1 Reply

Ok after banging my head on this all day and finally breaking down and posting for help it came to me that I needed to put the update() declaration in the protected slots section of the class. Everything works now.

Really could use some more Qt examples in the SDK.