ORE Studio 0.0.4
Loading...
Searching...
No Matches
ColumnMetadata.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_COLUMN_METADATA_HPP
21#define ORES_QT_COLUMN_METADATA_HPP
22
23#include <array>
24#include <cstddef>
25#include <string_view>
26#include <vector>
27#include <QVector>
28#include "ores.qt/export.hpp"
29
30namespace ores::qt {
31
38inline constexpr int kColumnWidthAuto = -1;
39
54
75
97template <std::size_t N>
98[[nodiscard]] inline QVector<int>
99defaultHiddenColumns(const std::array<ColumnMetadata, N>& columns) {
100 QVector<int> result;
101 for (std::size_t i = 0; i < N; ++i)
102 if (columns[i].hidden_by_default)
103 result.push_back(columns[i].column);
104 return result;
105}
106
107}
108
109#endif
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
QVector< int > defaultHiddenColumns(const std::array< ColumnMetadata, N > &columns)
Builds a QVector of hidden column indices from a metadata array.
Definition ColumnMetadata.hpp:99
constexpr int kColumnWidthAuto
Sentinel value for column default width meaning "auto-size to contents".
Definition ColumnMetadata.hpp:38
column_style
Column rendering style for table delegates.
Definition ColumnMetadata.hpp:43
@ mono_center
Monospace, centered.
@ badge_centered
Coloured badge pill, centered.
@ text_left
Proportional font, left-aligned (default).
@ mono_bold_left
Monospace bold, left-aligned.
@ mono_right
Monospace, right-aligned.
@ icon_centered
Centered DecorationRole icon (flag columns).
@ mono_bold_center
Monospace bold, centered.
@ mono_left
Monospace, left-aligned.
@ text_center
Proportional font, centered.
Metadata for a table column.
Definition ColumnMetadata.hpp:63
int default_width
Definition ColumnMetadata.hpp:73
bool hidden_by_default
Definition ColumnMetadata.hpp:71
int column
Definition ColumnMetadata.hpp:65
column_style style
Definition ColumnMetadata.hpp:69
std::string_view header
Definition ColumnMetadata.hpp:67