I am having an issue parenting a modelPanel (Viewport) into a predefined space in a QT Ui created in Designer. When I try to parent the modelPanel and run the script in Maya, it immediately crashes.
Example:
Create a new window in Qt Designer, and drag and drop a vertical layout in the window and save the ui. In the python class when do the parenting i do it as follows:
pm.modelPanel('modelPanelA', p = 'verticalLayout')
The window is drawn and I see the viewport, BUT the window is not scaleable. Which it has to be. So back in Qt Designer I got to Form > Lay Out as Grid. Now the vertical layout is scalable. I save the UI, reload the class, and create the window. Maya crashes! Why?
Related
So I am making a PyQt5 game and have created different .py files using Qt Designer for a start screen, level selector, and levels. So basically all the files represent the various windows which I can open/run individually using the standard:
app = QtWidgets.QApplication(sys.argv)
Level_Window = QtWidgets.QMainWindow()
ui = LevelWindow(Level_Window)
Level_Window.show()
sys.exit(app.exec_())
Now, how can I make the actual window switching to work? I was thinking to have another py file that has a window manager class with a stacked widget containing all these other windows. Also other windows should be able to access this stacked widget to like switch to a desired window when user clicks something. Can someone explain how I can accomplish this?
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.
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()
I'm quite new to Python, and I'm developing an app with the PySide library.
I have a QTabWidget in which I will later define buttons/labels/... with some layouts. The question is simple : I'd like to have my active tab filling the window horizontally and vertically, even when I resize the window. For now its size is determined by the widgets I put in. Even with addStretch(1) in a QHBoxLayout or QVBoxLayout I can't get it to expand.
Is there an easy way to do this (I'm not a Python expert yet) ?
Any help will be highly appreciated.
If your main window is QMainWindow then it is enough to insert QTabWidget with mainwindow->setCentralWidget() - by default it will use all available space.
In other case, to have QTabWidget to follow the resizing/geometry change of parent widget, it is enough to make some layout on the parent widget and just insert QTabWidget there.
Code is approx (in Qt):
QWidget * dialog = ...
QTabWidget * tabs = new QTabWidget;
QVBoxLayout * vbox = new QVBoxLayout;
vbox->addWidget(tabs);
dialog->setLayout(vbox);
dialog->show();
I have a PySide (Qt) application that utilizes an mdiArea in the main window and then populates this area with a number of QWidgets (windows). These QWidgets have menu bars added to a vertical layout.
This works great on Linux and Windows, but fails on OS X, i.e. only the QMainWindow menu bar is shown. A menubar added to a QWidget that is a sub window of an mdiArea is never displayed. What is the normal method for supporting menubars in sub windows across all platforms? Is it possible to put the menu into a toolbar?
Techniques in python or C++ are appreciated - whether a piece of code or a broader design pattern.
I've got an QWebView object inside my project and i want it to resize whenever i am resizing a main window. How to achieve that?
http://pastebin.com/3wcUygvb <- That's the ui code/
It looks like you've put all your widgets in layouts, but you haven't set a layout on the main form.
In Qt Designer, right-click on a blank area of the form and select Layout/Layout in a Grid.
Then save and re-compile with pyuic4.