| 5534 | } |
| 5535 | |
| 5536 | QVariant EventBrowser::persistData() |
| 5537 | { |
| 5538 | QVariantMap state; |
| 5539 | |
| 5540 | // temporarily turn off stretching the last section so we can get the real sizes. |
| 5541 | ui->events->header()->setStretchLastSection(false); |
| 5542 | |
| 5543 | QVariantList columns; |
| 5544 | for(int i = 0; i < COL_COUNT; i++) |
| 5545 | { |
| 5546 | QVariantMap col; |
| 5547 | |
| 5548 | bool hidden = ui->events->header()->isSectionHidden(i); |
| 5549 | |
| 5550 | // we temporarily make the section visible to get its size, since otherwise it returns 0. |
| 5551 | // There's no other way to access the 'hidden section sizes' which are transient and will be |
| 5552 | // lost otherwise. |
| 5553 | ui->events->header()->showSection(i); |
| 5554 | int size = ui->events->header()->sectionSize(i); |
| 5555 | if(hidden) |
| 5556 | ui->events->header()->hideSection(i); |
| 5557 | |
| 5558 | // name is just informative |
| 5559 | col[lit("name")] = ui->events->model()->headerData(i, Qt::Horizontal); |
| 5560 | col[lit("index")] = ui->events->header()->visualIndex(i); |
| 5561 | col[lit("hidden")] = hidden; |
| 5562 | col[lit("size")] = size; |
| 5563 | columns.push_back(col); |
| 5564 | } |
| 5565 | |
| 5566 | ui->events->header()->setStretchLastSection(true); |
| 5567 | |
| 5568 | state[lit("columns")] = columns; |
| 5569 | |
| 5570 | return state; |
| 5571 | } |
| 5572 | |
| 5573 | void EventBrowser::setPersistData(const QVariant &persistData) |
| 5574 | { |
nothing calls this directly
no test coverage detected