473,804 Members | 3,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PyQt QScrollView/QGridLayout question

folks,

I am trying put some user input fields into a scrollable (QScrollView)
window. So,
I placed a QLabel at 0,0 and QLineEdit at 0,1, next to QLabel.

Somehow, results are not what I am expecting.It is placing QLineEdit
below QLabel.
I am not using designer for this. Please, notice that I convert vbox's
box layout into
grid layout, so that, I can place QLabel at 0,0 and QLineEdit at 0,1.
But it does not
do that. any advice on correcting this piece of code will be helpfull.
regards,

here is how this code looks like:

-----
import sys, qt
from qt import *
class MyDialog(QDialo g):
def __init__(self,p arent = None,name = None,modal = 0,fl = 0):
QDialog.__init_ _(self,parent,n ame,modal,fl)

if not name:
self.setName("M yDialog")

self.setSizeGri pEnabled(1)

self.build_wind ow()

def build_window(se lf):

toplayout = QGridLayout(sel f,1,1,11,6,"top layout")
vbMain = qt.QVBox(self)
toplayout.addWi dget(vbMain, 0, 0)

sview = qt.QScrollView( vbMain)
vp = sview.viewport( )
vbox = qt.QVBox(vp)
sview.addChild( vbox)

vplayout = qt.QGridLayout( vp, 0, 0, 1,-1, 'vpl')
vplayout.addWid get(vbox, 0, 0)

grid = qt.QGridLayout( vbox.layout(), 2, 2)

ll = qt.QLabel('circ uit name', vbox)
grid.addWidget( ll, 0,0, qt.Qt.AlignLeft )

nameinput = qt.QLineEdit(vb ox)
grid.addWidget( nameinput, 0,1, qt.Qt.AlignLeft )

if __name__ == "__main__":
app = QApplication(sy s.argv)
f = MyDialog()
f.show()
app.setMainWidg et(f)
app.exec_loop()
Jul 11 '08 #1
0 1002

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2449
by: Konrad Koller | last post by:
For a card playing game I constructed a layout of 49 playing cards (size of each: x=71, y=96) which are arranged in a 7X7 matrix side by side. Accordingly the pysical size of the Canvas is x=71*7, y=96*7: in the main program: canvas=QCanvas(497,672) class Board(QCanvasView): def __init__(self,canvas,parent): QCanvasView.__init__(self,canvas,parent)
10
5201
by: Volker Lenhardt | last post by:
For a QApplication (PyQt) on the small screen of my Zaurus 5500 PDA I try to layout my data output in a QScrollView as the central widget. I'd prefer to use QGridLayout, but cannot add it to the scroll view. sc=QScrollView(self) layout=QGridLayout(..., sc.viewport()) sc.addChild(layout) results in a TypeError.
0
1258
by: Volker Lenhardt | last post by:
Once again a maybe silly question, but I find no solution, neither in the documentation nor in examples. I have got some different layouts to change place by the help of a QGridLayout in its parent widget. To make it nice I use row/col spacing and stretch respectively as well as multicell widgets. There is no problem if the layout next to come uses more rows and columns than the former one. But if it is the other way round, the grid...
4
6758
by: gregarican | last post by:
I have an PyQt app were I need one of the windows to be able to be opened more than one at a time. When I try to open it I only get one instance at the same time. The main class is the QWidget() class with a QGridLayout() displaying the various window components. Is there a certain flag I need to set or different constructor I need to use to allow the window to be opened more than one at a time? Here's a brief snippet of the code that...
2
7067
by: Svenn Bjerkem | last post by:
Hi, I am looking for a bit more elaboration on the problem of deleting elements from a QListsView. I know this is a tricky problem with references, but I have not been able to extract enough knowledge from the documentation to solve a specific problem: In a dialog I have a QListView called referenceList. Entries are added and deleted from this list with buttons addButton and removeButton connected with sockets:
3
2075
by: Phil Thompson | last post by:
Riverbank Computing is pleased to announce the release of PyQt v4.0beta1 available from http://www.riverbankcomputing.co.uk/pyqt/. PyQt is a comprehensive set of Qt bindings for the Python programming language and supports the same platforms as Qt (Windows, Linux and MacOS/X). Like Qt, PyQt is available under the GPL and a commercial license. PyQt v4 supports Qt v4 (http://www.trolltech.com/products/qt/index.html). PyQt v3 is still...
1
2016
by: Felix Steffenhagen | last post by:
Hello, I have a problem with updating contents in a qscrollview. I've implementented two widgets (PremiseInput and PremiseList). You can find the source code under http://www.informatik.uni-freiburg.de/~steffenh/premiseinput.{html|py} and http://www.informatik.uni-freiburg.de/~steffenh/premiselist.{html|py} The PremiseInput is a widget containing two QLineEdit's and a QComboBox. This widget should be showed in the PremiseList widget,...
1
2169
by: Yannick | last post by:
Hello, is there a way with the QT library to have a QGridLayout with all cells having the same size (fixed or depending on the largest widget in the grid)?? I am actually wrapping Qt and Gtk. I found the homogeneous property for the Gtk::Table but nothing equivalent in QGridLayout :( Thanks.
9
5506
by: cgrebeld | last post by:
Is it possible for a Qt C++ application, which embeds the python interpreter, to import and use PyQt? There can be only one QApplication, which is created in the C++ side, so how would I use that from the python side?
0
10588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.