Qwebview, how to resize it with window/ - python

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.

Related

Rescaling the absolute coordinate x,y values of self items in order to resize items fit into different resolutions [duplicate]

I want to have a small QFormLayout that grows to fill its parent widget.
I created a new .ui file using the QWidget template in Qt Designer. I put a QFormLayout inside that 'window', then put some controls inside that QFormLayout.
This all works reasonably well, but the QFormLayout always stays at the size I set in Qt Designer. I would like the QFormLayout to fill its parent widget and grow/shrink with it.
How can I accomplish that?
In Designer, activate the centralWidget and assign a layout, e.g. horizontal or vertical layout.
Then your QFormLayout will automatically resize.
Always make sure, that all widgets have a layout! Otherwise, automatic resizing will break with that widget!
See also
Controls insist on being too large, and won't resize, in QtDesigner
I found it was impossible to assign a layout to the centralwidget until I had added at least one child beneath it. Then I could highlight the tiny icon with the red 'disabled' mark and then click on a layout in the Designer toolbar at top.
The accepted answer (its image) is wrong, at least now in QT5. Instead you should assign a layout to the root object/widget (pointing to the aforementioned image, it should be the MainWindow instead of centralWidget). Also note that you must have at least one QObject created beneath it for this to work. Do this and your ui will become responsive to window resizing.
You need to change the default layout type of top level QWidget object from Break layout type to other layout types (Vertical Layout, Horizontal Layout, Grid Layout, Form Layout).
For example:
To something like this:

Python pyqt: background images

I'm using Python (2.7.3) and Qt designer (4.8.2) in Windows 7, and I'm new'ish to Qt designer:
How may I create a background image within a Form widget in Qt designer?
It doesn't matter if this takes up the entire screen or an area of the form (as demonstrated below). What I do need however is to superimpose objects such as QLineEdits and/or QLCDNumbers.
Ideally, I'd do this within Qt and not at run-time (a point and click solution would be a perfect for me).
I have generated this image in gimp quickly to demonstrate what I mean:
Found solution here:
https://www.youtube.com/watch?v=pzzccU9mErg [from 00:06:00 to 00:08:00]
Steps:
1/ Within Qt designer position a Qlabel within your widget
2/ Delete text in the text properties ('TextLabel' by deafult), and resize to image size wanted.
3/ Scroll to pixmap property and select intended image; click scaledContents is wanted
you'll now see your image within the widget

modelPanel (Maya) in QT UI using PySide

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?

pyGTK : pack and unpack

Can I use pack once the main loop has been showed, or should I use something else to add /remove widgets to /from a vbox afterwards ?
I have this gtk.Window() that contains a vbox, where a menu, a treeview and a button are packed. At the push of this button, I want to display an image in a new container inside this window / vbox, and ideally, close said container at will.
(think image viewer with a file list, you click on an image file and a pane opens displaying it, if you click on another image file the new image is displayed in place of the old, and you can close the image pane)
My question is : How do you do that ? My trials so far led me to believe that once the vbox has been show()'d, you cant pack anything else into it..?
Has the "image" container have to exist prior to being displayed...?
What is the proper process to do this, in witch direction of the GTK manual should I look?
In GTK+ all widgets are hidden by default (which I think was a stupid design decision, but oh well). You usually call show_all() on a window, so indirectly show all widgets contained in it by the time of the call. If you add (pack, whatever) a widget later, don't forget to show() it manually.

PyQT4 QWebView not resizing correctly

I have a QWebview in a grid layout, along with other widgets. When the user resizes the window, the QWebview doesn't resize, but the other widgets do. How can I make the QWebview resize correctly?
Most likely you're not using correct sizePolicy. Take a look here http://doc.qt.nokia.com/4.6/layout.html
Does using other widget in place of QWebView change anything?
in the dialog class's resizeEvent, one that extends QDialog, call webView->setGeometry, and this->resize, this->update.
hint: check if size changed via the QResizeEvent *ptr

Categories

Resources