2020-10-10 11:18:21 +02:00
|
|
|
/*
|
2025-01-04 13:37:40 +01:00
|
|
|
Copyright 2006-2025 The QElectroTech Team
|
2020-08-16 14:19:38 +02:00
|
|
|
This file is part of QElectroTech.
|
2020-02-20 21:33:26 +01:00
|
|
|
|
2020-08-16 14:19:38 +02:00
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2020-02-20 21:33:26 +01:00
|
|
|
|
2020-08-16 14:19:38 +02:00
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2020-02-20 21:33:26 +01:00
|
|
|
|
2020-08-16 14:19:38 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
2020-02-20 21:33:26 +01:00
|
|
|
*/
|
|
|
|
#include "qetgraphicsheaderitem.h"
|
2020-12-08 19:57:35 +01:00
|
|
|
|
|
|
|
#include "../../createdxf.h"
|
|
|
|
#include "../../qetxml.h"
|
|
|
|
#include "../../utils/qetutils.h"
|
2020-02-20 21:33:26 +01:00
|
|
|
#include "qabstractitemmodel.h"
|
|
|
|
|
|
|
|
#include <QFontMetrics>
|
|
|
|
#include <QPainter>
|
|
|
|
|
2020-04-12 18:51:38 +02:00
|
|
|
static int no_model_height = 20;
|
|
|
|
static int no_model_width = 40;
|
2020-02-20 21:33:26 +01:00
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::QetGraphicsHeaderItem
|
|
|
|
@param parent
|
|
|
|
*/
|
2020-02-20 21:33:26 +01:00
|
|
|
QetGraphicsHeaderItem::QetGraphicsHeaderItem(QGraphicsItem *parent) :
|
2020-09-07 21:41:45 +02:00
|
|
|
QGraphicsObject(parent)
|
2020-05-08 00:08:57 +02:00
|
|
|
{}
|
2020-02-20 21:33:26 +01:00
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::setModel
|
|
|
|
Set the model presented by this item
|
|
|
|
Since QetGraphicsHeaderItem don't take ownership of model,
|
2022-12-04 08:21:12 -05:00
|
|
|
if item already have a model, it's your responsibility to delete it.
|
2020-08-16 11:19:36 +02:00
|
|
|
@param model
|
|
|
|
*/
|
2020-02-20 21:33:26 +01:00
|
|
|
void QetGraphicsHeaderItem::setModel(QAbstractItemModel *model)
|
|
|
|
{
|
2020-03-08 10:38:49 +01:00
|
|
|
if (m_model) {
|
2020-09-07 21:41:45 +02:00
|
|
|
disconnect(m_model, &QAbstractItemModel::headerDataChanged,
|
|
|
|
this, &QetGraphicsHeaderItem::headerDataChanged);
|
|
|
|
disconnect(m_model, &QAbstractItemModel::modelReset,
|
|
|
|
this, &QetGraphicsHeaderItem::modelReseted);
|
|
|
|
disconnect(m_model, &QAbstractItemModel::columnsInserted,
|
|
|
|
this, &QetGraphicsHeaderItem::modelReseted);
|
2020-03-08 10:38:49 +01:00
|
|
|
}
|
|
|
|
|
2020-09-07 21:41:45 +02:00
|
|
|
m_model = model;
|
2020-04-12 18:51:38 +02:00
|
|
|
if (m_model)
|
|
|
|
{
|
2020-09-07 21:41:45 +02:00
|
|
|
connect(m_model, &QAbstractItemModel::headerDataChanged,
|
|
|
|
this, &QetGraphicsHeaderItem::headerDataChanged);
|
|
|
|
connect(m_model, &QAbstractItemModel::modelReset, this,
|
|
|
|
&QetGraphicsHeaderItem::modelReseted);
|
|
|
|
connect(m_model, &QAbstractItemModel::columnsInserted,
|
|
|
|
this, &QetGraphicsHeaderItem::modelReseted);
|
2020-04-12 18:51:38 +02:00
|
|
|
setUpMinimumSectionsSize();
|
|
|
|
m_current_sections_width.clear();
|
|
|
|
m_current_sections_width.resize(m_sections_minimum_width.size());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
setUpMinimumSectionsSize();
|
|
|
|
}
|
2020-03-08 10:38:49 +01:00
|
|
|
adjustSize();
|
2020-02-20 21:33:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::model
|
|
|
|
@return the model that this item is presenting
|
|
|
|
*/
|
2020-09-07 21:41:45 +02:00
|
|
|
QAbstractItemModel *QetGraphicsHeaderItem::model() const
|
|
|
|
{
|
2020-02-20 21:33:26 +01:00
|
|
|
return m_model;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::boundingRect
|
|
|
|
Reimplemented from QGraphicsObject::boundingRect() const;
|
|
|
|
@return
|
|
|
|
*/
|
2020-09-07 21:41:45 +02:00
|
|
|
QRectF QetGraphicsHeaderItem::boundingRect() const
|
|
|
|
{
|
2020-02-20 21:33:26 +01:00
|
|
|
return m_bounding_rect;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::paint
|
|
|
|
Reimplemented from QGraphicsObject::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) const;
|
|
|
|
@param painter
|
|
|
|
@param option
|
|
|
|
@param widget
|
|
|
|
*/
|
2020-09-07 21:41:45 +02:00
|
|
|
void QetGraphicsHeaderItem::paint(
|
|
|
|
QPainter *painter,
|
|
|
|
const QStyleOptionGraphicsItem *option,
|
|
|
|
QWidget *widget)
|
2020-02-20 21:33:26 +01:00
|
|
|
{
|
|
|
|
Q_UNUSED(option)
|
|
|
|
Q_UNUSED(widget)
|
|
|
|
|
|
|
|
painter->save();
|
|
|
|
|
|
|
|
QPen pen;
|
|
|
|
pen.setWidthF(0.7);
|
|
|
|
pen.setColor(Qt::black);
|
|
|
|
|
|
|
|
QBrush brush = painter->brush();
|
|
|
|
brush.setColor(Qt::lightGray);
|
|
|
|
brush.setStyle(Qt::SolidPattern);
|
|
|
|
painter->setBrush(brush);
|
|
|
|
|
|
|
|
painter->setPen(pen);
|
|
|
|
painter->drawRect(m_current_rect);
|
|
|
|
|
|
|
|
if (!m_model)
|
|
|
|
{
|
|
|
|
painter->restore();
|
|
|
|
return;
|
|
|
|
}
|
2020-09-07 21:41:45 +02:00
|
|
|
painter->setFont(
|
|
|
|
m_model->headerData(
|
|
|
|
0,
|
|
|
|
Qt::Horizontal,
|
|
|
|
Qt::FontRole).value<QFont>());
|
2020-02-20 21:33:26 +01:00
|
|
|
|
2020-09-07 21:41:45 +02:00
|
|
|
//Draw vertical lines
|
2020-02-20 21:33:26 +01:00
|
|
|
auto offset= 0;
|
2025-02-14 16:17:58 +01:00
|
|
|
for(auto size : m_current_sections_width)
|
2020-02-20 21:33:26 +01:00
|
|
|
{
|
|
|
|
QPointF p1(offset+size, m_current_rect.top());
|
|
|
|
QPointF p2(offset+size, m_current_rect.bottom());
|
|
|
|
painter->drawLine(p1, p2);
|
|
|
|
offset += size;
|
|
|
|
}
|
|
|
|
|
2020-09-07 21:41:45 +02:00
|
|
|
//Write text of each cell
|
|
|
|
auto margins_ = QETUtils::marginsFromString(
|
|
|
|
m_model->headerData(
|
|
|
|
0,
|
|
|
|
Qt::Horizontal,
|
|
|
|
Qt::UserRole+1).toString());
|
2020-05-08 00:08:57 +02:00
|
|
|
QPointF top_left(margins_.left(), margins_.top());
|
2020-02-20 21:33:26 +01:00
|
|
|
for (auto i= 0 ; i<m_model->columnCount() ; ++i)
|
|
|
|
{
|
2020-09-07 21:41:45 +02:00
|
|
|
QSize size(
|
|
|
|
m_current_sections_width.at(i)
|
|
|
|
- margins_.left()
|
|
|
|
- margins_.right(),
|
|
|
|
|
|
|
|
m_section_height
|
|
|
|
- margins_.top()
|
|
|
|
- margins_.bottom());
|
|
|
|
painter->drawText(
|
|
|
|
QRectF(top_left, size),
|
|
|
|
m_model->headerData(
|
|
|
|
0,
|
|
|
|
Qt::Horizontal,
|
|
|
|
Qt::TextAlignmentRole).toInt(),
|
|
|
|
m_model->headerData(
|
|
|
|
i,
|
|
|
|
Qt::Horizontal,
|
|
|
|
Qt::DisplayRole).toString());
|
2020-03-08 10:38:49 +01:00
|
|
|
|
|
|
|
top_left.setX(top_left.x() + m_current_sections_width.at(i));
|
2020-02-20 21:33:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
painter->restore();
|
|
|
|
}
|
2020-09-07 16:16:33 +10:00
|
|
|
/**
|
2020-09-07 21:41:45 +02:00
|
|
|
@brief QetGraphicsHeaderItem::toDXF
|
|
|
|
Draw this table to the dxf document
|
|
|
|
@param filepath file path of the the dxf document
|
|
|
|
@return true if draw success
|
2020-09-07 16:16:33 +10:00
|
|
|
*/
|
|
|
|
bool QetGraphicsHeaderItem::toDXF(const QString &filepath)
|
|
|
|
{
|
2020-09-07 21:41:45 +02:00
|
|
|
QRectF rect = m_current_rect;
|
|
|
|
QPolygonF poly(rect);
|
|
|
|
Createdxf::drawPolygon(filepath,mapToScene(poly),0);
|
|
|
|
|
|
|
|
//Draw vertical lines
|
|
|
|
auto offset= 0;
|
2025-02-14 16:17:58 +01:00
|
|
|
for(auto size : m_current_sections_width)
|
2020-09-07 21:41:45 +02:00
|
|
|
{
|
|
|
|
QPointF p1(offset+size, m_current_rect.top());
|
|
|
|
QPointF p2(offset+size, m_current_rect.bottom());
|
|
|
|
Createdxf::drawLine(
|
|
|
|
filepath,
|
|
|
|
QLineF(
|
|
|
|
mapToScene(p1),
|
|
|
|
mapToScene(p2)),
|
|
|
|
0);
|
|
|
|
offset += size;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Write text of each cell
|
|
|
|
auto margins_ = QETUtils::marginsFromString(
|
|
|
|
m_model->headerData(
|
|
|
|
0,
|
|
|
|
Qt::Horizontal,
|
|
|
|
Qt::UserRole+1).toString());
|
|
|
|
QPointF top_left(margins_.left(), margins_.top());
|
|
|
|
for (auto i= 0 ; i<m_model->columnCount() ; ++i)
|
|
|
|
{
|
|
|
|
QSize size(m_current_sections_width.at(i) - margins_.left() - margins_.right(),
|
|
|
|
m_section_height - margins_.top() - margins_.bottom());
|
|
|
|
|
|
|
|
QPointF qm = mapToScene(top_left);
|
|
|
|
qreal h = size.height();// * Createdxf::yScale;
|
|
|
|
qreal x = qm.x() * Createdxf::xScale;
|
|
|
|
qreal y = Createdxf::sheetHeight - ((qm.y() + h/2) * Createdxf::yScale);
|
|
|
|
qreal h1 = h * 0.5 * Createdxf::yScale;
|
|
|
|
|
|
|
|
int valign = 2;
|
|
|
|
|
|
|
|
Createdxf::drawTextAligned(
|
|
|
|
filepath,
|
|
|
|
m_model->headerData(
|
|
|
|
i,
|
|
|
|
Qt::Horizontal,
|
|
|
|
Qt::DisplayRole).toString(),
|
|
|
|
x,y,h1,0,0,0,valign,x,0,0);
|
|
|
|
|
|
|
|
top_left.setX(top_left.x() + m_current_sections_width.at(i));
|
|
|
|
}
|
|
|
|
return true;
|
2020-09-07 16:16:33 +10:00
|
|
|
}
|
2020-02-20 21:33:26 +01:00
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::rect
|
|
|
|
@return the current rect of the item aka the size of rectangle painted.
|
|
|
|
*/
|
2020-09-07 21:41:45 +02:00
|
|
|
QRect QetGraphicsHeaderItem::rect() const
|
|
|
|
{
|
2020-02-20 21:33:26 +01:00
|
|
|
return m_current_rect;
|
|
|
|
}
|
|
|
|
|
2020-03-08 10:38:49 +01:00
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::resizeSection
|
|
|
|
@param logicalIndex
|
|
|
|
@param size
|
|
|
|
*/
|
2020-02-20 21:33:26 +01:00
|
|
|
void QetGraphicsHeaderItem::resizeSection(int logicalIndex, int size)
|
2020-04-12 18:51:38 +02:00
|
|
|
{
|
|
|
|
if (!m_model)
|
|
|
|
{
|
|
|
|
m_current_sections_width.clear();
|
|
|
|
m_current_sections_width.append(no_model_width);
|
|
|
|
m_sections_minimum_width.clear();
|
|
|
|
m_sections_minimum_width.append(no_model_width);
|
|
|
|
m_current_rect.setWidth(no_model_width);
|
|
|
|
setUpBoundingRect();
|
|
|
|
update();
|
|
|
|
emit sectionResized(0, no_model_width);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-03-08 10:38:49 +01:00
|
|
|
if (logicalIndex >= m_current_sections_width.size() ||
|
|
|
|
m_current_sections_width.at(logicalIndex) == size) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_model &&
|
|
|
|
logicalIndex<m_model->columnCount() &&
|
|
|
|
size >= m_sections_minimum_width.at(logicalIndex))
|
2020-02-20 21:33:26 +01:00
|
|
|
{
|
|
|
|
prepareGeometryChange();
|
|
|
|
m_current_sections_width.replace(logicalIndex, size);
|
2020-09-07 21:41:45 +02:00
|
|
|
m_current_rect.setWidth(
|
|
|
|
std::accumulate(
|
|
|
|
m_current_sections_width.begin(),
|
|
|
|
m_current_sections_width.end(),
|
|
|
|
0));
|
2020-02-20 21:33:26 +01:00
|
|
|
setUpBoundingRect();
|
2020-03-08 10:38:49 +01:00
|
|
|
update();
|
|
|
|
emit sectionResized(logicalIndex, size);
|
2020-02-20 21:33:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::sectionSize
|
|
|
|
@param logical_index
|
|
|
|
@return the width (or height for vertical headers) of the given logicalIndex.
|
|
|
|
*/
|
2020-02-20 21:33:26 +01:00
|
|
|
int QetGraphicsHeaderItem::sectionSize(int logical_index) const
|
|
|
|
{
|
|
|
|
if (logical_index>=0 && logical_index<m_current_sections_width.size()) {
|
|
|
|
return m_current_sections_width.at(logical_index);
|
|
|
|
} else {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 18:40:28 +02:00
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::toXml
|
|
|
|
save the header to xml
|
|
|
|
@param document
|
|
|
|
@return
|
|
|
|
*/
|
2020-04-17 18:40:28 +02:00
|
|
|
QDomElement QetGraphicsHeaderItem::toXml(QDomDocument &document) const
|
|
|
|
{
|
|
|
|
auto dom_element = document.createElement(xmlTagName());
|
2020-05-08 00:08:57 +02:00
|
|
|
if (m_model) {
|
2020-09-07 21:41:45 +02:00
|
|
|
dom_element.appendChild(
|
|
|
|
QETXML::marginsToXml(
|
|
|
|
document,
|
|
|
|
QETUtils::marginsFromString(
|
|
|
|
m_model->headerData(
|
|
|
|
0,
|
|
|
|
Qt::Horizontal,
|
|
|
|
Qt::UserRole+1).toString())));
|
2020-05-08 00:08:57 +02:00
|
|
|
}
|
2020-04-17 18:40:28 +02:00
|
|
|
|
|
|
|
return dom_element;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::fromXml
|
|
|
|
Restore the header from xml
|
|
|
|
@param element
|
|
|
|
*/
|
2020-04-17 18:40:28 +02:00
|
|
|
void QetGraphicsHeaderItem::fromXml(const QDomElement &element)
|
|
|
|
{
|
2020-05-08 00:08:57 +02:00
|
|
|
if ((element.tagName() != xmlTagName()) || !m_model) {
|
2020-04-17 18:40:28 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-09-07 21:41:45 +02:00
|
|
|
auto margins_ = QETUtils::marginsToString(
|
|
|
|
QETXML::marginsFromXml(
|
|
|
|
element.firstChildElement("margins")));
|
|
|
|
m_model->setHeaderData(
|
|
|
|
0,
|
|
|
|
Qt::Horizontal,
|
|
|
|
QETUtils::marginsToString(
|
|
|
|
QETXML::marginsFromXml(
|
|
|
|
element.firstChildElement("margins"))),
|
|
|
|
Qt::UserRole+1);
|
2020-04-17 18:40:28 +02:00
|
|
|
}
|
|
|
|
|
2020-02-20 21:33:26 +01:00
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::setUpMinimumSectionsSize
|
|
|
|
Setup the minimum section size and height of the item.
|
|
|
|
Not that this function doesn't change the current size of this item.
|
|
|
|
*/
|
2020-02-20 21:33:26 +01:00
|
|
|
void QetGraphicsHeaderItem::setUpMinimumSectionsSize()
|
|
|
|
{
|
2020-04-12 18:51:38 +02:00
|
|
|
if (!m_model)
|
|
|
|
{
|
|
|
|
m_minimum_section_height = no_model_height;
|
|
|
|
m_sections_minimum_width.clear();
|
|
|
|
m_sections_minimum_width.append(no_model_width);
|
|
|
|
m_minimum_width = no_model_width;
|
2020-02-20 21:33:26 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-09-07 21:41:45 +02:00
|
|
|
QFontMetrics metrics(
|
|
|
|
m_model->headerData(
|
|
|
|
0,
|
|
|
|
Qt::Horizontal,
|
|
|
|
Qt::FontRole).value<QFont>());
|
|
|
|
auto margins_ = QETUtils::marginsFromString(
|
|
|
|
m_model->headerData(
|
|
|
|
0,
|
|
|
|
Qt::Horizontal,
|
|
|
|
Qt::UserRole+1).toString());
|
2020-02-20 21:33:26 +01:00
|
|
|
//Set the height of row;
|
2020-09-07 21:41:45 +02:00
|
|
|
m_minimum_section_height = metrics.boundingRect("HEIGHT TEST").height()
|
|
|
|
+ margins_.top() + margins_.bottom();
|
2020-02-20 21:33:26 +01:00
|
|
|
|
|
|
|
m_sections_minimum_width.clear();
|
|
|
|
m_sections_minimum_width.resize(m_model->columnCount());
|
|
|
|
|
|
|
|
for (auto i= 0 ; i<m_model->columnCount() ; ++i)
|
|
|
|
{
|
|
|
|
auto str = m_model->headerData(i, Qt::Horizontal).toString();
|
2020-09-07 21:41:45 +02:00
|
|
|
m_sections_minimum_width.replace(
|
|
|
|
i,
|
|
|
|
metrics.boundingRect(str).width()
|
|
|
|
+ margins_.left()
|
|
|
|
+ margins_.right());
|
2020-02-20 21:33:26 +01:00
|
|
|
}
|
|
|
|
|
2020-09-07 21:41:45 +02:00
|
|
|
m_minimum_width = std::accumulate(
|
|
|
|
m_sections_minimum_width.begin(),
|
|
|
|
m_sections_minimum_width.end(),
|
|
|
|
0);
|
2020-02-20 21:33:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::setUpBoundingRect
|
|
|
|
Setup the bounding rect of the item
|
|
|
|
*/
|
2020-09-07 21:41:45 +02:00
|
|
|
void QetGraphicsHeaderItem::setUpBoundingRect()
|
|
|
|
{
|
2020-02-20 21:33:26 +01:00
|
|
|
m_bounding_rect = m_current_rect.adjusted(-10, -10, 10, 10);
|
|
|
|
}
|
2020-03-08 10:38:49 +01:00
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::headerDataChanged
|
|
|
|
Update the header when data of displayed model change
|
|
|
|
@param orientation
|
|
|
|
@param first
|
|
|
|
@param last
|
|
|
|
*/
|
2020-09-07 21:41:45 +02:00
|
|
|
void QetGraphicsHeaderItem::headerDataChanged(
|
|
|
|
Qt::Orientations orientation, int first, int last)
|
2020-03-08 10:38:49 +01:00
|
|
|
{
|
|
|
|
Q_UNUSED(orientation)
|
|
|
|
Q_UNUSED(first)
|
|
|
|
Q_UNUSED(last)
|
|
|
|
|
|
|
|
setUpMinimumSectionsSize();
|
|
|
|
adjustSize();
|
2020-05-08 00:08:57 +02:00
|
|
|
update();
|
2020-03-08 10:38:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief QetGraphicsHeaderItem::adjustSize
|
|
|
|
If needed, this function resize the current height and section
|
|
|
|
according to there minimum
|
|
|
|
*/
|
2020-03-08 10:38:49 +01:00
|
|
|
void QetGraphicsHeaderItem::adjustSize()
|
|
|
|
{
|
|
|
|
if (m_section_height != m_minimum_section_height)
|
|
|
|
{
|
|
|
|
m_section_height = m_minimum_section_height;
|
|
|
|
m_current_rect.setHeight(m_section_height);
|
|
|
|
emit heightResized();
|
|
|
|
}
|
|
|
|
|
|
|
|
update();
|
|
|
|
}
|
2020-04-12 18:51:38 +02:00
|
|
|
|
|
|
|
void QetGraphicsHeaderItem::modelReseted()
|
|
|
|
{
|
|
|
|
setUpMinimumSectionsSize();
|
2020-11-02 19:31:52 +01:00
|
|
|
m_current_sections_width.clear();
|
|
|
|
m_current_sections_width.resize(m_sections_minimum_width.size());
|
2020-04-12 18:51:38 +02:00
|
|
|
adjustSize();
|
|
|
|
}
|