Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add QLocale #1086

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/cxx-qt-lib-extras/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fn main() {
"core/qelapsedtimer",
"core/qcommandlineoption",
"core/qcommandlineparser",
"core/qlocale",
"gui/qapplication",
];

Expand All @@ -67,6 +68,7 @@ fn main() {
"core/qelapsedtimer",
"core/qcommandlineoption",
"core/qcommandlineparser",
"core/qlocale",
"gui/qapplication",
];

Expand Down
28 changes: 28 additions & 0 deletions crates/cxx-qt-lib-extras/include/core/qlocale.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// clang-format off
// SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
// clang-format on
// SPDX-FileContributor: Nicolas Fella <[email protected]>
//
// SPDX-License-Identifier: MIT OR Apache-2.0
#pragma once

#include <QtCore/QLocale>

#include "rust/cxx.h"

namespace rust {

template<>
struct IsRelocatable<QLocale> : ::std::true_type
{};

namespace cxxqtlib1 {

using QLocaleTagSeparator = QLocale::TagSeparator;
using QLocaleCurrencySymbolFormat = QLocale::CurrencySymbolFormat;
using QLocaleFormatType = QLocale::FormatType;
using QLocaleLanguage = QLocale::Language;
using QLocaleMeasurementSystem = QLocale::MeasurementSystem;

}
}
6 changes: 6 additions & 0 deletions crates/cxx-qt-lib-extras/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ pub use qcommandlineoption::QCommandLineOption;

mod qcommandlineparser;
pub use qcommandlineparser::QCommandLineParser;

mod qlocale;
pub use qlocale::{
QLocale, QLocaleCurrencySymbolFormat, QLocaleFormatType, QLocaleLanguage,
QLocaleMeasurementSystem, QLocaleTagSeparator,
};
17 changes: 17 additions & 0 deletions crates/cxx-qt-lib-extras/src/core/qlocale.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// clang-format off
// SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
// clang-format on
// SPDX-FileContributor: Nicolas Fella <[email protected]>
//
// SPDX-License-Identifier: MIT OR Apache-2.0
#include "cxx-qt-lib-extras/qlocale.h"
#include <cxx-qt-lib/assertion_utils.h>

assert_alignment_and_size(QLocale, { ::std::size_t a0; });

static_assert(!::std::is_trivially_copy_assignable<QLocale>::value);
static_assert(!::std::is_trivially_copy_constructible<QLocale>::value);

static_assert(!::std::is_trivially_destructible<QLocale>::value);

nicolasfella marked this conversation as resolved.
Show resolved Hide resolved
static_assert(QTypeInfo<QLocale>::isRelocatable);
Loading
Loading