Question of QTableWidget setSpan

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Question of QTableWidget setSpan

이창호

Hi.

 

I am making a simple program with PyQt5.

 

Why the below results are different?

 

Id like to display 2. Style using QHeaderView.ResizeToContents option.

 

Is this a pyqt bug?

 

 

Changho.

 

1.  Set QHeaderView.ResizeToContents option
 
 
 
2.  Didnt set QHeaderView.ResizeToContents option
 
 
 

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Question of QTableWidget setSpan

Damon Lynch
On Thu, Apr 20, 2017 at 9:38 PM, 이창호 <[hidden email]> wrote:

Hi.

 

I am making a simple program with PyQt5.

 

Why the below results are different?

 

Id like to display 2. Style using QHeaderView.ResizeToContents option.

 

Is this a pyqt bug?

 




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

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Loading...