473,378 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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(QDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)

if not name:
self.setName("MyDialog")

self.setSizeGripEnabled(1)

self.build_window()

def build_window(self):

toplayout = QGridLayout(self,1,1,11,6,"toplayout")
vbMain = qt.QVBox(self)
toplayout.addWidget(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.addWidget(vbox, 0, 0)

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

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

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

if __name__ == "__main__":
app = QApplication(sys.argv)
f = MyDialog()
f.show()
app.setMainWidget(f)
app.exec_loop()
Jul 11 '08 #1
0 985

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

Similar topics

2
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,...
10
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...
0
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...
4
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()...
2
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...
3
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...
1
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...
1
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....
9
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.