How to open a separate UI Window from QMainWindow?
So I have a MainWindow.ui in the class QMainWindow. I also have a separate QWidget and QDialog window (not sure which one is better to use) that I would like to open by using the menu bar from MainWindow.ui. I know that I can simply do something like:
self.main_layout.addWidget(self.form_widget)
or
flashC = flashCard()
flashC.show()
But I want to do this in Qt Designer, so that I don't have to change the .py file every time I run pyuic5 (since these changes will be replaced upon running.)
My question is, how do I make it so that QMainWindow can open other windows that I make later from within Qt Designer. Right now I can't access any other windows in my signal/slot editor.
I've been trying to figure this out and the books and other resources that I've looked at haven't pointed me in the right direction. I just want to know if it's possible to call other windows from within Qt Designer.
python qt pyqt5
add a comment |
So I have a MainWindow.ui in the class QMainWindow. I also have a separate QWidget and QDialog window (not sure which one is better to use) that I would like to open by using the menu bar from MainWindow.ui. I know that I can simply do something like:
self.main_layout.addWidget(self.form_widget)
or
flashC = flashCard()
flashC.show()
But I want to do this in Qt Designer, so that I don't have to change the .py file every time I run pyuic5 (since these changes will be replaced upon running.)
My question is, how do I make it so that QMainWindow can open other windows that I make later from within Qt Designer. Right now I can't access any other windows in my signal/slot editor.
I've been trying to figure this out and the books and other resources that I've looked at haven't pointed me in the right direction. I just want to know if it's possible to call other windows from within Qt Designer.
python qt pyqt5
add a comment |
So I have a MainWindow.ui in the class QMainWindow. I also have a separate QWidget and QDialog window (not sure which one is better to use) that I would like to open by using the menu bar from MainWindow.ui. I know that I can simply do something like:
self.main_layout.addWidget(self.form_widget)
or
flashC = flashCard()
flashC.show()
But I want to do this in Qt Designer, so that I don't have to change the .py file every time I run pyuic5 (since these changes will be replaced upon running.)
My question is, how do I make it so that QMainWindow can open other windows that I make later from within Qt Designer. Right now I can't access any other windows in my signal/slot editor.
I've been trying to figure this out and the books and other resources that I've looked at haven't pointed me in the right direction. I just want to know if it's possible to call other windows from within Qt Designer.
python qt pyqt5
So I have a MainWindow.ui in the class QMainWindow. I also have a separate QWidget and QDialog window (not sure which one is better to use) that I would like to open by using the menu bar from MainWindow.ui. I know that I can simply do something like:
self.main_layout.addWidget(self.form_widget)
or
flashC = flashCard()
flashC.show()
But I want to do this in Qt Designer, so that I don't have to change the .py file every time I run pyuic5 (since these changes will be replaced upon running.)
My question is, how do I make it so that QMainWindow can open other windows that I make later from within Qt Designer. Right now I can't access any other windows in my signal/slot editor.
I've been trying to figure this out and the books and other resources that I've looked at haven't pointed me in the right direction. I just want to know if it's possible to call other windows from within Qt Designer.
python qt pyqt5
python qt pyqt5
edited Dec 1 '18 at 11:46
halfer
14.6k758114
14.6k758114
asked Nov 27 '18 at 19:57
M. RuizM. Ruiz
306
306
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can have multiple QMainWindow
in your application. To create a second window simply define it in Qt Designer as you have for your current window, then import and create an instance of it.
Remember it will only appear once you call .show()
Sorry, how do you import? Does this mean everything has to be done programmatically and I can't just do the Signal/Slot editor for the menu bar to call on other windows?
– M. Ruiz
Nov 27 '18 at 20:07
As far as I know you would need to do the opening programmatically. The window can be defined entirely within Designer, but you need to create the new window object from Python.
– mfitzp
Nov 28 '18 at 17:24
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53507194%2fhow-to-open-a-separate-ui-window-from-qmainwindow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can have multiple QMainWindow
in your application. To create a second window simply define it in Qt Designer as you have for your current window, then import and create an instance of it.
Remember it will only appear once you call .show()
Sorry, how do you import? Does this mean everything has to be done programmatically and I can't just do the Signal/Slot editor for the menu bar to call on other windows?
– M. Ruiz
Nov 27 '18 at 20:07
As far as I know you would need to do the opening programmatically. The window can be defined entirely within Designer, but you need to create the new window object from Python.
– mfitzp
Nov 28 '18 at 17:24
add a comment |
You can have multiple QMainWindow
in your application. To create a second window simply define it in Qt Designer as you have for your current window, then import and create an instance of it.
Remember it will only appear once you call .show()
Sorry, how do you import? Does this mean everything has to be done programmatically and I can't just do the Signal/Slot editor for the menu bar to call on other windows?
– M. Ruiz
Nov 27 '18 at 20:07
As far as I know you would need to do the opening programmatically. The window can be defined entirely within Designer, but you need to create the new window object from Python.
– mfitzp
Nov 28 '18 at 17:24
add a comment |
You can have multiple QMainWindow
in your application. To create a second window simply define it in Qt Designer as you have for your current window, then import and create an instance of it.
Remember it will only appear once you call .show()
You can have multiple QMainWindow
in your application. To create a second window simply define it in Qt Designer as you have for your current window, then import and create an instance of it.
Remember it will only appear once you call .show()
answered Nov 27 '18 at 20:01
mfitzpmfitzp
10.1k53255
10.1k53255
Sorry, how do you import? Does this mean everything has to be done programmatically and I can't just do the Signal/Slot editor for the menu bar to call on other windows?
– M. Ruiz
Nov 27 '18 at 20:07
As far as I know you would need to do the opening programmatically. The window can be defined entirely within Designer, but you need to create the new window object from Python.
– mfitzp
Nov 28 '18 at 17:24
add a comment |
Sorry, how do you import? Does this mean everything has to be done programmatically and I can't just do the Signal/Slot editor for the menu bar to call on other windows?
– M. Ruiz
Nov 27 '18 at 20:07
As far as I know you would need to do the opening programmatically. The window can be defined entirely within Designer, but you need to create the new window object from Python.
– mfitzp
Nov 28 '18 at 17:24
Sorry, how do you import? Does this mean everything has to be done programmatically and I can't just do the Signal/Slot editor for the menu bar to call on other windows?
– M. Ruiz
Nov 27 '18 at 20:07
Sorry, how do you import? Does this mean everything has to be done programmatically and I can't just do the Signal/Slot editor for the menu bar to call on other windows?
– M. Ruiz
Nov 27 '18 at 20:07
As far as I know you would need to do the opening programmatically. The window can be defined entirely within Designer, but you need to create the new window object from Python.
– mfitzp
Nov 28 '18 at 17:24
As far as I know you would need to do the opening programmatically. The window can be defined entirely within Designer, but you need to create the new window object from Python.
– mfitzp
Nov 28 '18 at 17:24
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53507194%2fhow-to-open-a-separate-ui-window-from-qmainwindow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown