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
29namespace ores::qt {
30
37inline constexpr int kColumnWidthAuto = -1;
38
53
74
96template <std::size_t N>
97[[nodiscard]] inline QVector<int>
98defaultHiddenColumns(const std::array<ColumnMetadata, N>& columns) {
99 QVector<int> result;
100 for (std::size_t i = 0; i < N; ++i)
101 if (columns[i].hidden_by_default)
102 result.push_back(columns[i].column);
103 return result;
104}
105
106}
107
108#endif
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
QVector< int > defaultHiddenColumns(const std::array< ColumnMetadata, N > &columns)
Builds a QVector of hidden column indices from a metadata array.
Definition ColumnMetadata.hpp:98
constexpr int kColumnWidthAuto
Sentinel value for column default width meaning "auto-size to contents".
Definition ColumnMetadata.hpp:37
column_style
Column rendering style for table delegates.
Definition ColumnMetadata.hpp:42
@ 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:62
int default_width
Definition ColumnMetadata.hpp:72
bool hidden_by_default
Definition ColumnMetadata.hpp:70
int column
Definition ColumnMetadata.hpp:64
column_style style
Definition ColumnMetadata.hpp:68
std::string_view header
Definition ColumnMetadata.hpp:66