QAbstractTableModel, QTableView and restoreState.
Hi to all,
I used to save the QTableView horizontalHeader through saveState() and restore it by restoreState(...toByteArray()).
The model usually associated is a QSqlQueryModel. Now my QTableView is filled with a custom model inherited from QAbstractTableModel.
Code:
#ifndef CARTMODEL_H
#define CARTMODEL_H
#include <QtWidgets>
#include "ItemsCart.h"
class ItemsCart;
{
Q_OBJECT
public:
void setCart(ItemsCart *inItemsCart);
QVariant headerData
(int section, Qt
::Orientation orientation,
int role
= Qt
::DisplayRole) const;
protected:
ItemsCart *mItemsCart;
};
#endif
The problem I have is that restoreState() restore nothing, instead clears or hides all the horizontal headers.
Should I miss a function to reimplement?
Thanks in advance,
Danilo