Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57259 > unrolled thread

Re: PY QT

Started byVincent Vande Vyvre <vincent.vandevyvre@swing.be>
First post2013-10-22 15:41 +0200
Last post2013-10-22 15:41 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: PY QT Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2013-10-22 15:41 +0200

#57259 — Re: PY QT

FromVincent Vande Vyvre <vincent.vandevyvre@swing.be>
Date2013-10-22 15:41 +0200
SubjectRe: PY QT
Message-ID<mailman.1353.1382449278.18130.python-list@python.org>
Le 22/10/2013 15:01, Forsgren a écrit :
> 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...
>
>
>
>
>
>
>
> --
> View this message in context: http://python.6.x6.nabble.com/PY-QT-tp5036684.html
> Sent from the Python - python-list mailing list archive at Nabble.com.

Why are you using % 6 on QLayout.count() ?

QLayout.count() returns the number of the items into the layout but not 
where are is.

If you want to know the number of rows and columns, you have rowCount() 
and columnCount().

Cheers

-- 
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte 
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web