PY QT

F

Forsgren

I'm really embarrassed to be asking this, I feel that there is a really
simple answer to this, but I cant for the life of me find it.
So, I have this app, which loads a ui, which has a scrollarea that is a
parent to a gridlayout.

So in QT designer it looks like this:

/>someParentWidgets
scrollArea
myGridLayout/


I then want to add a couple of Qtool buttons to the GridLayout within my
python code, so i run a forloop:

/> for name in mylist:
btn =QtGui.QToolButton()
btn.setText(str(name))

cols = self.myGridLayout.count()%6
rows = int(self.myGridLayout.count()/6)
self.myGridLayout.addWidget(btn,rows,cols)/

No errors, no complaining what so ever, but the buttons isn't showing in the
layout.
The thing is if I change my ui file to

/>someParentWidgets
myGridLayout
/

The buttons show perfectly fine! What am I missing? I've tried changing the
GridLayout to a verticalLayout, but same thing there...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top