[PyQt] Question of QTableWidget setSpan

Damon Lynch damonlynch at gmail.com
Fri Apr 21 17:45:12 BST 2017


On Thu, Apr 20, 2017 at 9:38 PM, 이창호 <changho at hyundai-autron.com> wrote:

> Hi.
>
>
>
> I am making a simple program with PyQt5.
>
>
>
> Why the below results are different?
>
>
>
> I’d like to display 2. Style using QHeaderView.ResizeToContents option.
>
>
>
> Is this a pyqt bug?
>
>
> <https://www.riverbankcomputing.com/mailman/listinfo/pyqt>
>


Hi Changdo,

I very much doubt it's a PyQt bug. What you're seeing is more likely to be
caused by the fact that when you call setSpan, the automatic layout
features of Qt tables works in unexpected ways. In my experience (see left
side of image below) as soon as you use setSpan, expect to have to manually
set individual cell sizes. And that can get complicated pretty quickly.
It's unfortunate, but I'm not aware of any other way to solve the problem.
However, it goes without saying that others might have different ways of
confronting the problem, so it's worth seeking feedback from them too.




Best,
Damon
-- 
http://www.damonlynch.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170421/0a542f9f/attachment-0001.html>


More information about the PyQt mailing list