qtqtablewidgetqt5.5qt5.1qheaderview

what's wrong with setSectionResizeMode in qt?


I have used qt 5.1.1 for 2 years on Ubuntu. now I install qt 5.5 on it. (I mean both versions are exist on my Ubuntu) actually this version of Qt framework doesn't work as good as the older one. so I want to use qt 5.1.1 .

The problem is here that now I have the below error on my code:

code:

_headerView->setSectionResizeMode(QHeaderView::Stretch);

error:

... error: 'class QHeaderView' has no member named 'setSectionResizeMode'

I found this answer on this site. but actually I don't get how to solve the problem! It just say its reason.

PS: I want this line of code to stretch my table fix to my window.


Solution

  • This Error can happen when you have two or more version of qt installed on your machine.
    setResizeMode is a old function that override in new versions and changed it's name to setSectionResizeMode the safest way to solve this problem is to use setSectionResizeMode that you can be sure it will be available by any Qt from 5 and later.