| 202 | } |
| 203 | |
| 204 | void SpreadsheetHeaderView::refresh() { |
| 205 | int width = sectionSize(count() - 1); |
| 206 | |
| 207 | m_commentSlave->setStretchLastSection(true); |
| 208 | m_commentSlave->updateGeometry(); |
| 209 | m_commentSlave->setStretchLastSection(false); |
| 210 | |
| 211 | m_sparklineSlave->setStretchLastSection(true); |
| 212 | m_sparklineSlave->updateGeometry(); |
| 213 | m_sparklineSlave->setStretchLastSection(false); |
| 214 | int totalHeight = QHeaderView::sizeHint().height(); |
| 215 | if (m_showSparklines) |
| 216 | totalHeight += m_sparklineSlave->sizeHint().height(); |
| 217 | if (m_showComments) |
| 218 | totalHeight += m_commentSlave->sizeHint().height(); |
| 219 | |
| 220 | QSize sizeHint = QHeaderView::sizeHint(); |
| 221 | sizeHint.setHeight(totalHeight); |
| 222 | |
| 223 | setMinimumHeight(sizeHint.height()); |
| 224 | setMaximumHeight(sizeHint.height()); |
| 225 | setStretchLastSection(true); |
| 226 | updateGeometry(); |
| 227 | setStretchLastSection(false); |
| 228 | |
| 229 | resizeSection(count() - 1, width); |
| 230 | update(); // Ensure the header view is updated after resizing |
| 231 | } |
| 232 | |
| 233 | /*! |
| 234 | Reacts to a header data change. |