Project

General

Profile

Actions

Bug #11505

open

Calling WStandardItemModel::setHeaderData() on an empty model crashes

Added by Tibor Miseta about 1 year ago. Updated about 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
Start date:
04/07/2023
Due date:
% Done:

0%

Estimated time:

Description

Calling WStandardItemModel::setHeaderData() on an empty model crashes the whole application. The program exits unexpectedly.


Files

wt_bug_setHeaderData.cpp (1.29 KB) wt_bug_setHeaderData.cpp Tibor Miseta, 04/07/2023 07:37 PM
Actions #1

Updated by Roel Standaert about 1 year ago

  • Target version set to future

setHeaderData() on an empty model indeed does not work, that's a limitation of WStandardItemModel, and you should set the column count first.

However, I do think that instead of crashing it should probably either:

  • throw, or
  • return false (this is what Qt's QStandardItemModel does)
Actions

Also available in: Atom PDF