[PyQt] ItemSelectionModel like in Kontact

Lukas LuHe at gmx.at
Wed Dec 24 18:52:21 GMT 2008


Am Mittwoch 24 Dezember 2008 16:40:32 schrieb Lukas:
> Hello,
>
> i want to create a QMainWindow whick looks similar to KDEs Kontact (I
> uploaded a screenshot here:
> http://img72.imageshack.us/img72/9964/kontacter1.png )
>
> There should be an ItemSelectionModel an the left border and it should be
> completely done with Qt Designer.
>
> I attacked my first attempt, which has the following disadvantages:
*   attached 

>  - The background color is white.
>     If I use a stylesheet I can only change the color to grey, but I want
> to use something like QMainWindow.backgroundRole()
>
>  - I'm not able to set a preferred minimal size.
>    I hardcoded the gridSize to 48x70, iconSize to 48x48 and
>    maximumSize to 52 x anything
>    So if there is any item with an longer text, the text will be simply cut
> off, but the size should be adjusted correctly.
>
> Is there any way to work around these disadvantages?

I also tried to make these changes in the generated code:

self.listWidget.adjustSize()
self.listWidget.setBackgroundRole(MainWindow.backgroundRole())

But the problem still persists

> Thanks for your help,
> Lukas
>
> p.s.: Merry Christmas!



More information about the PyQt mailing list