سؤال

I have created 2 *.ui using Qt Designer in my project, where one is the main screen and another one is a dialog widget. The dialog widget is called by one of the functions in main screen.

How can I connect the function in my main window to call the dialog widget?

e.g. If I click on [About > Author] in my main window's menu, I should be able to call the dialog widget.

Any help will be appreciated.

Thanks.

هل كانت مفيدة؟

المحلول

It depends on where you keep your dialog pointer. For example, you can create some signal on your main window and connect it with dialog show() slot(or exec() if you need it to be modal). Or if you keep your dialog pointer in the main windows then you can just use it with show/exec method directly.

As to About->Author menu: for that you should create QAction and add it to the menu. And QAction has triggered() signal which you can connect to exec/show slot of the dialog.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top