I want to use btn1 to send a signal to the slot function of deviceTypeSelect, but btn1 can only be associated with QStackedWidget. enter image description here

enter image description here

1

There are 1 answers

2
musicamante On BEST ANSWER

There are two problems.

The first is conceptual: Designer cannot know anything about custom slots that are going to be implemented in a promoted widget, and it even should not. The connection to those slots can only be achieved programmatically, and that's for good reasons: Designer cannot "inspect" (nor it should) the source of the files that will be promoted, and it's also completely possible that one would promote a widget and use different classes with the same design files.

The other problem is technical: the "pages" of multipage widgets like QStackedWidget or QTabWidget cannot be used as signal targets on Designer. I don't know if it's just a missing feature or it's by design (knowing how multipage widget plugins are dealt with I wouldn't bet about the it), but unfortunately it really is not possible.
If you want to connect to standard QWidget slots (setEnabled() etc.), set a dummy boxed layout on the page, and add another QWidget in it, but if you use custom slots, as explained before, those must be manually connected from your code.