ruby-qt6-rice 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -5
- data/include/bando/common.hpp +16 -19
- data/include/bando/qobject/qdbusabstractadaptor.hpp +15 -13
- data/include/bando/qobject/qdbusabstractinterface.hpp +12 -10
- data/include/bando/qobject/qitemdelegate.hpp +37 -35
- data/include/bando/qobject/qlayout.hpp +40 -38
- data/include/bando/qobject/qwebenginepage.hpp +170 -0
- data/include/bando/qobject.hpp +61 -12
- data/include/bando/qwidget/qspinbox.hpp +22 -20
- data/include/bando/qwidget.hpp +82 -20
- data/include/rice/core/api.hpp +261 -0
- data/include/rice/{rice.hpp → core/rice.hpp} +2693 -1921
- data/include/rice/{stl.hpp → core/stl.hpp} +607 -668
- data/include/rice/qt6/qdbusreply.hpp +2 -5
- data/include/rice/qt6/qenum.hpp +26 -10
- data/include/rice/qt6/qflags.hpp +18 -22
- data/include/rice/qt6/qlist.hpp +19 -41
- data/include/rice/qt6/qmap.hpp +158 -0
- data/include/rice/qt6.hpp +39 -0
- data/lib/mkmf-rice.rb +2 -2
- data/lib/mkmf-rubyqt6.rb +43 -10
- data/lib/qt6/rice/version.rb +1 -1
- metadata +8 -7
- data/lib/qt6/rspec/bando_file_parser.rb +0 -102
- data/lib/qt6/rspec/qlass_file_parser.rb +0 -255
- data/lib/qt6/rspec.rb +0 -275
|
@@ -22,12 +22,9 @@
|
|
|
22
22
|
#ifndef RICE_QDBUSREPLY_HPP
|
|
23
23
|
#define RICE_QDBUSREPLY_HPP
|
|
24
24
|
|
|
25
|
-
#include <rice/rice.hpp>
|
|
26
|
-
#include <rice/stl.hpp>
|
|
27
|
-
|
|
28
25
|
#include <QDBusReply>
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
RICE4RUBYQT6_USE_NAMESPACE
|
|
31
28
|
|
|
32
29
|
template <typename Value_T>
|
|
33
30
|
void define_qdbusreply_under(Module module)
|
|
@@ -45,7 +42,7 @@ void define_qdbusreply_under(Module module)
|
|
|
45
42
|
.define_constructor(Constructor<QDBusReply_T, const QDBusPendingCall &>(), Arg("pcall"))
|
|
46
43
|
.define_constructor(Constructor<QDBusReply_T, const QDBusPendingReply_T &>(), Arg("reply"))
|
|
47
44
|
.define_constructor(Constructor<QDBusReply_T, const QDBusReply_T &>(), Arg("other"))
|
|
48
|
-
.template define_method<const QDBusError &(QDBusReply_T::*)()>("error", &QDBusReply_T::error)
|
|
45
|
+
.template define_method<const QDBusError &(QDBusReply_T::*)() const>("error", &QDBusReply_T::error)
|
|
49
46
|
.template define_method("valid?", &QDBusReply_T::isValid)
|
|
50
47
|
.template define_method("value", &QDBusReply_T::value);
|
|
51
48
|
};
|
data/include/rice/qt6/qenum.hpp
CHANGED
|
@@ -22,22 +22,38 @@
|
|
|
22
22
|
#ifndef RICE_QENUM_HPP
|
|
23
23
|
#define RICE_QENUM_HPP
|
|
24
24
|
|
|
25
|
-
#include <rice/rice.hpp>
|
|
26
|
-
#include <rice/stl.hpp>
|
|
27
|
-
|
|
28
25
|
#include <QVariant>
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
RICE4RUBYQT6_USE_NAMESPACE
|
|
28
|
+
|
|
29
|
+
template<typename Enum_T>
|
|
30
|
+
VALUE qenum_to_i(VALUE self)
|
|
31
|
+
{
|
|
32
|
+
auto rb_return = (int)detail::From_Ruby<Enum_T>().convert(self);
|
|
33
|
+
return detail::To_Ruby<int>().convert(rb_return);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
template<typename Enum_T>
|
|
37
|
+
VALUE qenum_from_int(VALUE self, VALUE i)
|
|
38
|
+
{
|
|
39
|
+
auto rb_return = static_cast<Enum_T>(detail::From_Ruby<int>().convert(i));
|
|
40
|
+
return detail::To_Ruby<Enum_T>().convert(rb_return);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
template<typename Enum_T>
|
|
44
|
+
VALUE qenum_qvariant_register_metatype(VALUE self)
|
|
45
|
+
{
|
|
46
|
+
auto rb_return = qRegisterMetaType<Enum_T>();
|
|
47
|
+
return detail::To_Ruby<int>().convert(rb_return);
|
|
48
|
+
}
|
|
31
49
|
|
|
32
50
|
template<typename Enum_T>
|
|
33
51
|
Data_Type<Enum_T> define_qenum_under(Module module, char const* name)
|
|
34
52
|
{
|
|
35
|
-
Data_Type<Enum_T> qenum =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.define_singleton_function("_qvariant_from_value", [](const Enum_T &value) -> QVariant { return QVariant::fromValue(value); })
|
|
40
|
-
.define_singleton_function("_qvariant_to_value", [](const QVariant &qvariant) -> Enum_T { return qvariant.value<Enum_T>(); });
|
|
53
|
+
Data_Type<Enum_T> qenum = define_class_under<Enum_T>(module, name);
|
|
54
|
+
detail::protect(rb_define_method, qenum, "to_i", (RUBY_METHOD_FUNC)qenum_to_i<Enum_T>, 0);
|
|
55
|
+
detail::protect(rb_define_singleton_method, qenum, "from_int", (RUBY_METHOD_FUNC)qenum_from_int<Enum_T>, 1);
|
|
56
|
+
detail::protect(rb_define_singleton_method, qenum, "_qvariant_register_metatype", (RUBY_METHOD_FUNC)qenum_qvariant_register_metatype<Enum_T>, 0);
|
|
41
57
|
return qenum;
|
|
42
58
|
}
|
|
43
59
|
|
data/include/rice/qt6/qflags.hpp
CHANGED
|
@@ -22,36 +22,32 @@
|
|
|
22
22
|
#ifndef RICE_QFLAGS_HPP
|
|
23
23
|
#define RICE_QFLAGS_HPP
|
|
24
24
|
|
|
25
|
-
#include <rice/rice.hpp>
|
|
26
|
-
#include <rice/stl.hpp>
|
|
27
|
-
|
|
28
25
|
#include <QFlags>
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
RICE4RUBYQT6_USE_NAMESPACE
|
|
28
|
+
|
|
29
|
+
template<typename QFlags_T>
|
|
30
|
+
VALUE qflags_to_i(VALUE self)
|
|
31
|
+
{
|
|
32
|
+
auto rb_return = (int)detail::From_Ruby<QFlags_T>().convert(self);
|
|
33
|
+
return detail::To_Ruby<int>().convert(rb_return);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
template<typename QFlags_T>
|
|
37
|
+
VALUE qflags_from_int(VALUE self, VALUE i)
|
|
38
|
+
{
|
|
39
|
+
auto rb_return = static_cast<QFlags_T>(detail::From_Ruby<int>().convert(i));
|
|
40
|
+
return detail::To_Ruby<QFlags_T>().convert(rb_return);
|
|
41
|
+
}
|
|
31
42
|
|
|
32
43
|
template<typename Enum_T>
|
|
33
44
|
Data_Type<QFlags<Enum_T>> define_qflags_under(Module module, char const* name)
|
|
34
45
|
{
|
|
35
46
|
using QFlags_T = QFlags<Enum_T>;
|
|
36
47
|
|
|
37
|
-
Data_Type<QFlags_T> qflags = define_class_under<QFlags_T>(module, name)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
.template define_method("to_i", [](QFlags_T *self) -> int { return (int)(*self); })
|
|
41
|
-
.template define_method("~", &QFlags_T::operator~)
|
|
42
|
-
.template define_method<QFlags_T (QFlags_T::*)(Enum_T) const noexcept>("&", &QFlags_T::operator&, Arg("mask"))
|
|
43
|
-
.template define_method<QFlags_T (QFlags_T::*)(QFlags_T) const noexcept>("&", &QFlags_T::operator&, Arg("mask"))
|
|
44
|
-
.template define_method<QFlags_T &(QFlags_T::*)(Enum_T) noexcept>("&=", &QFlags_T::operator&=, Arg("mask"))
|
|
45
|
-
.template define_method<QFlags_T &(QFlags_T::*)(QFlags_T) noexcept>("&=", &QFlags_T::operator&=, Arg("mask"))
|
|
46
|
-
.template define_method<QFlags_T (QFlags_T::*)(Enum_T) const noexcept>("^", &QFlags_T::operator^, Arg("other"))
|
|
47
|
-
.template define_method<QFlags_T (QFlags_T::*)(QFlags_T) const noexcept>("^", &QFlags_T::operator^, Arg("other"))
|
|
48
|
-
.template define_method<QFlags_T &(QFlags_T::*)(Enum_T) noexcept>("^=", &QFlags_T::operator^=, Arg("other"))
|
|
49
|
-
.template define_method<QFlags_T &(QFlags_T::*)(QFlags_T) noexcept>("^=", &QFlags_T::operator^=, Arg("other"))
|
|
50
|
-
.template define_method<QFlags_T (QFlags_T::*)(Enum_T) const noexcept>("|", &QFlags_T::operator|, Arg("other"))
|
|
51
|
-
.template define_method<QFlags_T (QFlags_T::*)(QFlags_T) const noexcept>("|", &QFlags_T::operator|, Arg("other"))
|
|
52
|
-
.template define_method<QFlags_T &(QFlags_T::*)(Enum_T) noexcept>("|=", &QFlags_T::operator|=, Arg("other"))
|
|
53
|
-
.template define_method<QFlags_T &(QFlags_T::*)(QFlags_T) noexcept>("|=", &QFlags_T::operator|=, Arg("other"))
|
|
54
|
-
.template define_singleton_function("from_int", [](int i) -> QFlags_T { return QFlags_T::fromInt(i); }, Arg("i"));
|
|
48
|
+
Data_Type<QFlags_T> qflags = define_class_under<QFlags_T>(module, name);
|
|
49
|
+
detail::protect(rb_define_method, qflags, "to_i", (RUBY_METHOD_FUNC)qflags_to_i<QFlags_T>, 0);
|
|
50
|
+
detail::protect(rb_define_singleton_method, qflags, "from_int", (RUBY_METHOD_FUNC)qflags_from_int<QFlags_T>, 1);
|
|
55
51
|
return qflags;
|
|
56
52
|
}
|
|
57
53
|
|
data/include/rice/qt6/qlist.hpp
CHANGED
|
@@ -22,12 +22,9 @@
|
|
|
22
22
|
#ifndef RICE_QLIST_HPP
|
|
23
23
|
#define RICE_QLIST_HPP
|
|
24
24
|
|
|
25
|
-
#include <rice/rice.hpp>
|
|
26
|
-
#include <rice/stl.hpp>
|
|
27
|
-
|
|
28
25
|
#include <QList>
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
RICE4RUBYQT6_USE_NAMESPACE
|
|
31
28
|
|
|
32
29
|
template<typename QList_T>
|
|
33
30
|
class DefineQListMethods
|
|
@@ -39,16 +36,13 @@ public:
|
|
|
39
36
|
DefineQListMethods(Data_Type<QList_T> klass) : klass_(klass)
|
|
40
37
|
{
|
|
41
38
|
this->define_constructors();
|
|
42
|
-
this->define_constructable_methods();
|
|
43
39
|
this->define_capacity_methods();
|
|
44
40
|
this->define_access_methods();
|
|
45
41
|
this->define_comparable_methods();
|
|
46
42
|
this->define_insert_methods();
|
|
47
43
|
this->define_remove_methods();
|
|
48
|
-
this->define_replace_methods();
|
|
49
44
|
this->define_enumerable();
|
|
50
45
|
this->define_to_array();
|
|
51
|
-
this->define_to_s();
|
|
52
46
|
}
|
|
53
47
|
|
|
54
48
|
private:
|
|
@@ -60,20 +54,10 @@ private:
|
|
|
60
54
|
klass_.define_constructor(Constructor<QList_T, const QList_T&>(), Arg("other"));
|
|
61
55
|
}
|
|
62
56
|
|
|
63
|
-
void define_constructable_methods()
|
|
64
|
-
{
|
|
65
|
-
klass_.template define_method<void (QList_T::*)(qsizetype)>("resize", &QList_T::resize, Arg("size"));
|
|
66
|
-
klass_.template define_method<void (QList_T::*)(qsizetype, Parameter_T)>("resize", &QList_T::resize, Arg("size"), Arg("value"));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
57
|
void define_capacity_methods()
|
|
70
58
|
{
|
|
71
|
-
klass_.define_method("capacity", &QList_T::capacity);
|
|
72
59
|
klass_.define_method("empty?", &QList_T::isEmpty);
|
|
73
|
-
klass_.define_method("length", &QList_T::
|
|
74
|
-
klass_.define_method("max_size", &QList_T::max_size);
|
|
75
|
-
klass_.define_method("reserve", &QList_T::reserve);
|
|
76
|
-
klass_.define_method("shrink_to_fit", &QList_T::shrink_to_fit);
|
|
60
|
+
klass_.define_method("length", &QList_T::size);
|
|
77
61
|
klass_.define_method("size", &QList_T::size);
|
|
78
62
|
}
|
|
79
63
|
|
|
@@ -109,6 +93,7 @@ private:
|
|
|
109
93
|
klass_.define_method("count", [](QList_T *self) -> qsizetype {
|
|
110
94
|
return self->size();
|
|
111
95
|
});
|
|
96
|
+
|
|
112
97
|
klass_.define_method("count", [](QList_T *self, Parameter_T element) -> qsizetype {
|
|
113
98
|
return self->count(element);
|
|
114
99
|
});
|
|
@@ -149,6 +134,21 @@ private:
|
|
|
149
134
|
return std::nullopt;
|
|
150
135
|
});
|
|
151
136
|
|
|
137
|
+
klass_.define_method("[]=", [](QList_T*self, qsizetype index, Parameter_T element) -> Parameter_T {
|
|
138
|
+
if (index < 0) {
|
|
139
|
+
index = index + self->size();
|
|
140
|
+
if (index < 0) throw std::out_of_range("index " + std::to_string(index - self->size()) + " too small for array; minimum: -" + std::to_string(self->size()));
|
|
141
|
+
} else if (index > self->size()) {
|
|
142
|
+
throw std::out_of_range("index " + std::to_string(index) + " too big");
|
|
143
|
+
}
|
|
144
|
+
if (index == self->size()) {
|
|
145
|
+
self->push_back(element);
|
|
146
|
+
} else {
|
|
147
|
+
self->replace(index, element);
|
|
148
|
+
}
|
|
149
|
+
return element;
|
|
150
|
+
});
|
|
151
|
+
|
|
152
152
|
rb_define_alias(klass_, "<<", "push");
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -180,30 +180,12 @@ private:
|
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
void define_replace_methods()
|
|
184
|
-
{
|
|
185
|
-
klass_.define_method("[]=", [](QList_T*self, qsizetype index, Parameter_T element) -> Parameter_T {
|
|
186
|
-
if (index < 0) {
|
|
187
|
-
index = index + self->size();
|
|
188
|
-
if (index < 0) throw std::out_of_range("index " + std::to_string(index - self->size()) + " too small for array; minimum: -" + std::to_string(self->size()));
|
|
189
|
-
} else if (index > self->size()) {
|
|
190
|
-
throw std::out_of_range("index " + std::to_string(index) + " too big");
|
|
191
|
-
}
|
|
192
|
-
if (index == self->size()) {
|
|
193
|
-
self->push_back(element);
|
|
194
|
-
} else {
|
|
195
|
-
self->replace(index, element);
|
|
196
|
-
}
|
|
197
|
-
return element;
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
183
|
void define_enumerable()
|
|
202
184
|
{
|
|
203
185
|
klass_.include_module(rb_mEnumerable);
|
|
204
186
|
klass_.define_method("each", [](QList_T *self) -> QList_T* {
|
|
205
187
|
for (qsizetype i = 0; i < self->size(); i++) {
|
|
206
|
-
|
|
188
|
+
detail::protect(rb_yield, detail::to_ruby(self->at(i)));
|
|
207
189
|
}
|
|
208
190
|
return self;
|
|
209
191
|
});
|
|
@@ -214,10 +196,6 @@ private:
|
|
|
214
196
|
rb_define_alias(klass_, "to_ary", "to_a");
|
|
215
197
|
}
|
|
216
198
|
|
|
217
|
-
void define_to_s()
|
|
218
|
-
{
|
|
219
|
-
}
|
|
220
|
-
|
|
221
199
|
private:
|
|
222
200
|
Data_Type<QList_T> klass_;
|
|
223
201
|
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// This file is part of [RubyQt6](https://github.com/souk4711/ruby-qt6).
|
|
2
|
+
//
|
|
3
|
+
// It is licensed under the LGPLv3, included below.
|
|
4
|
+
//
|
|
5
|
+
// As a special exception to the GNU Lesser General Public License version 3
|
|
6
|
+
// ("LGPL3"), the copyright holders of this Library give you permission to
|
|
7
|
+
// convey to a third party a Combined Work that links statically or dynamically
|
|
8
|
+
// to this Library without providing any Minimal Corresponding Source or
|
|
9
|
+
// Minimal Application Code as set out in 4d or providing the installation
|
|
10
|
+
// information set out in section 4e, provided that you comply with the other
|
|
11
|
+
// provisions of LGPL3 and provided that you meet, for the Application the
|
|
12
|
+
// terms and conditions of the license(s) which apply to the Application.
|
|
13
|
+
//
|
|
14
|
+
// Except as stated in this special exception, the provisions of LGPL3 will
|
|
15
|
+
// continue to comply in full to this Library. If you modify this Library, you
|
|
16
|
+
// may apply this exception to your version of this Library, but you are not
|
|
17
|
+
// obliged to do so. If you do not wish to do so, delete this exception
|
|
18
|
+
// statement from your version. This exception does not (and cannot) modify any
|
|
19
|
+
// license terms which apply to the Application, with which you must still
|
|
20
|
+
// comply.
|
|
21
|
+
|
|
22
|
+
#ifndef RICE_QMAP_HPP
|
|
23
|
+
#define RICE_QMAP_HPP
|
|
24
|
+
|
|
25
|
+
#include <QMap>
|
|
26
|
+
|
|
27
|
+
RICE4RUBYQT6_USE_NAMESPACE
|
|
28
|
+
|
|
29
|
+
template<typename QMap_T>
|
|
30
|
+
class DefineQMapMethods
|
|
31
|
+
{
|
|
32
|
+
using Key_T = typename QMap_T::key_type;
|
|
33
|
+
using Mapped_T = typename QMap_T::mapped_type;
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
DefineQMapMethods(Data_Type<QMap_T> klass) : klass_(klass)
|
|
37
|
+
{
|
|
38
|
+
this->define_constructors();
|
|
39
|
+
this->define_capacity_methods();
|
|
40
|
+
this->define_access_methods();
|
|
41
|
+
this->define_comparable_methods();
|
|
42
|
+
this->define_insert_methods();
|
|
43
|
+
this->define_remove_methods();
|
|
44
|
+
this->define_enumerable();
|
|
45
|
+
this->define_to_hash();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private:
|
|
49
|
+
void define_constructors()
|
|
50
|
+
{
|
|
51
|
+
klass_.define_constructor(Constructor<QMap_T>());
|
|
52
|
+
klass_.define_constructor(Constructor<QMap_T, const QMap_T&>(), Arg("other"));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
void define_capacity_methods()
|
|
56
|
+
{
|
|
57
|
+
klass_.define_method("empty?", &QMap_T::isEmpty);
|
|
58
|
+
klass_.define_method("length", &QMap_T::size);
|
|
59
|
+
klass_.define_method("size", &QMap_T::size);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void define_access_methods()
|
|
63
|
+
{
|
|
64
|
+
klass_.define_method("[]", [](QMap_T *self, Key_T &key) -> std::optional<Mapped_T> {
|
|
65
|
+
auto iter = self->find(key);
|
|
66
|
+
if (iter != self->end())
|
|
67
|
+
return iter.value();
|
|
68
|
+
return std::nullopt;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
klass_.define_method("keys", [](QMap_T *self) -> QList<Key_T> {
|
|
72
|
+
return self->keys();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
klass_.define_method("values", [](QMap_T *self) -> QList<Mapped_T> {
|
|
76
|
+
return self->values();
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
void define_comparable_methods()
|
|
81
|
+
{
|
|
82
|
+
klass_.define_method("has_key?", [](QMap_T *self, Key_T &key) -> bool {
|
|
83
|
+
return self->contains(key);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
klass_.define_method("has_value?", [](QMap_T *self, Mapped_T &value) -> bool {
|
|
87
|
+
for (auto i = self->cbegin(), end = self->cend(); i != end; ++i)
|
|
88
|
+
if (i.value() == value)
|
|
89
|
+
return true;
|
|
90
|
+
return false;
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
rb_define_alias(klass_, "key?", "has_key?");
|
|
94
|
+
rb_define_alias(klass_, "value?", "has_value?");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
void define_insert_methods()
|
|
98
|
+
{
|
|
99
|
+
klass_.define_method("insert", [](QMap_T *self, Key_T &key, Mapped_T &value) -> Mapped_T {
|
|
100
|
+
self->insert(key, value);
|
|
101
|
+
return value;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
rb_define_alias(klass_, "[]=", "insert");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
void define_remove_methods()
|
|
108
|
+
{
|
|
109
|
+
klass_.define_method("clear", [](QMap_T *self) -> QMap_T* {
|
|
110
|
+
self->clear();
|
|
111
|
+
return self;
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
klass_.define_method("delete", [](QMap_T *self, Key_T &key) -> std::optional<Mapped_T> {
|
|
115
|
+
auto iter = self->find(key);
|
|
116
|
+
if (iter != self->cend()) {
|
|
117
|
+
Mapped_T result = iter.value();
|
|
118
|
+
self->erase(iter);
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
return std::nullopt;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
void define_enumerable()
|
|
126
|
+
{
|
|
127
|
+
klass_.include_module(rb_mEnumerable);
|
|
128
|
+
klass_.define_method("each", [](QMap_T *self) -> QMap_T* {
|
|
129
|
+
for (auto i = self->cbegin(), end = self->cend(); i != end; ++i) {
|
|
130
|
+
detail::protect(rb_yield_values, 2, detail::to_ruby(i.key()), detail::to_ruby(i.value()));
|
|
131
|
+
}
|
|
132
|
+
return self;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
void define_to_hash()
|
|
137
|
+
{
|
|
138
|
+
rb_define_alias(klass_, "to_hash", "to_h");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private:
|
|
142
|
+
Data_Type<QMap_T> klass_;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
template <typename Key_T, typename Mapped_T>
|
|
146
|
+
void define_qmap_under(Module module)
|
|
147
|
+
{
|
|
148
|
+
using QMap_T = QMap<Key_T, Mapped_T>;
|
|
149
|
+
|
|
150
|
+
detail::TypeMapper<QMap_T> typeMapper;
|
|
151
|
+
std::string klassName = typeMapper.rubyName();
|
|
152
|
+
Identifier id(klassName);
|
|
153
|
+
|
|
154
|
+
Data_Type<QMap_T> qmap = define_class_under<QMap_T>(module, id);
|
|
155
|
+
DefineQMapMethods<QMap_T> qmap_(qmap);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
#endif
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// This file is part of [RubyQt6](https://github.com/souk4711/ruby-qt6).
|
|
2
|
+
//
|
|
3
|
+
// It is licensed under the LGPLv3, included below.
|
|
4
|
+
//
|
|
5
|
+
// As a special exception to the GNU Lesser General Public License version 3
|
|
6
|
+
// ("LGPL3"), the copyright holders of this Library give you permission to
|
|
7
|
+
// convey to a third party a Combined Work that links statically or dynamically
|
|
8
|
+
// to this Library without providing any Minimal Corresponding Source or
|
|
9
|
+
// Minimal Application Code as set out in 4d or providing the installation
|
|
10
|
+
// information set out in section 4e, provided that you comply with the other
|
|
11
|
+
// provisions of LGPL3 and provided that you meet, for the Application the
|
|
12
|
+
// terms and conditions of the license(s) which apply to the Application.
|
|
13
|
+
//
|
|
14
|
+
// Except as stated in this special exception, the provisions of LGPL3 will
|
|
15
|
+
// continue to comply in full to this Library. If you modify this Library, you
|
|
16
|
+
// may apply this exception to your version of this Library, but you are not
|
|
17
|
+
// obliged to do so. If you do not wish to do so, delete this exception
|
|
18
|
+
// statement from your version. This exception does not (and cannot) modify any
|
|
19
|
+
// license terms which apply to the Application, with which you must still
|
|
20
|
+
// comply.
|
|
21
|
+
|
|
22
|
+
#ifndef RICE_QT6_HPP
|
|
23
|
+
#define RICE_QT6_HPP
|
|
24
|
+
|
|
25
|
+
// include rice stuffs
|
|
26
|
+
#include <rice/core/rice.hpp>
|
|
27
|
+
#include <rice/core/stl.hpp>
|
|
28
|
+
|
|
29
|
+
// ruby/win32.h has a few defines that conflict with libQt6
|
|
30
|
+
#ifdef _WIN32
|
|
31
|
+
# undef access
|
|
32
|
+
# undef stat
|
|
33
|
+
# undef truncate
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
// macros
|
|
37
|
+
#define RICE4RUBYQT6_USE_NAMESPACE using namespace ::Rice4RubyQt6;
|
|
38
|
+
|
|
39
|
+
#endif
|
data/lib/mkmf-rice.rb
CHANGED
|
@@ -61,8 +61,8 @@ end
|
|
|
61
61
|
# to make this easy
|
|
62
62
|
path = File.expand_path(File.join(__dir__, '../include'))
|
|
63
63
|
|
|
64
|
-
unless find_header('rice/rice.hpp', path)
|
|
65
|
-
raise("Could not find rice/rice.hpp header")
|
|
64
|
+
unless find_header('rice/core/rice.hpp', path)
|
|
65
|
+
raise("Could not find rice/core/rice.hpp header")
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
if !IS_DARWIN && !IS_MSWIN && !have_library('stdc++fs')
|
data/lib/mkmf-rubyqt6.rb
CHANGED
|
@@ -5,24 +5,57 @@ require_relative "mkmf-rice"
|
|
|
5
5
|
def qmake
|
|
6
6
|
return @qmake if @qmake
|
|
7
7
|
|
|
8
|
+
r = (ENV["QMAKE"] || "").strip
|
|
9
|
+
return @qmake = r if r != ""
|
|
10
|
+
|
|
8
11
|
["qmake6", "qmake"].each do |qmake|
|
|
9
12
|
`#{qmake} -v`
|
|
10
13
|
return @qmake = qmake if $?.success?
|
|
11
14
|
end
|
|
12
|
-
|
|
15
|
+
|
|
16
|
+
raise "Could not find qmake, " \
|
|
17
|
+
"please add qmake to your PATH environment variable"
|
|
13
18
|
end
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
qmake_persistent_props = {}
|
|
21
|
+
%w[QT_INSTALL_HEADERS QT_INSTALL_LIBS].each do |name|
|
|
22
|
+
define_method(name.downcase) do
|
|
23
|
+
return qmake_persistent_props[name] if qmake_persistent_props[name]
|
|
17
24
|
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
r = (ENV[name] || "").strip
|
|
26
|
+
return qmake_persistent_props[name] = r if r != ""
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
r = `#{qmake} -query #{name}`.strip
|
|
29
|
+
return qmake_persistent_props[name] = r if r != ""
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
raise "Could not determine #{name} folder"
|
|
32
|
+
end
|
|
25
33
|
end
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
def rubyqt6_extconf(mod, depends:)
|
|
36
|
+
# Add custom cxxflags
|
|
37
|
+
r = (ENV["RUBYQT6_CXXFLAGS"] || "").strip
|
|
38
|
+
append_cppflags(r) if r != ""
|
|
39
|
+
|
|
40
|
+
# Add rubyqt6 cxxflag
|
|
41
|
+
r = "RUBYQT6_BUILD_#{mod.upcase}_LIB"
|
|
42
|
+
append_cppflags("-D#{r}")
|
|
43
|
+
|
|
44
|
+
# Add qt6 included directories
|
|
45
|
+
append_cppflags("-I#{qt_install_headers}")
|
|
46
|
+
(Array(depends) + Array(mod)).each do |name|
|
|
47
|
+
includedir = File.join(qt_install_headers, name)
|
|
48
|
+
append_cppflags("-I#{includedir}")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Add qt6 libraries
|
|
52
|
+
(Array(depends) + Array(mod)).each do |name|
|
|
53
|
+
library = name.sub("Qt", "Qt6")
|
|
54
|
+
message = "Could not find lib#{library}, please install qt6 package"
|
|
55
|
+
raise message unless find_library(library, nil, qt_install_libs)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Create Makefile
|
|
59
|
+
name = mod.downcase
|
|
60
|
+
create_makefile("qt6/#{name}/#{name}")
|
|
61
|
+
end
|
data/lib/qt6/rice/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-qt6-rice
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Doe
|
|
@@ -27,21 +27,22 @@ files:
|
|
|
27
27
|
- include/bando/qobject/qdbusabstractinterface.hpp
|
|
28
28
|
- include/bando/qobject/qitemdelegate.hpp
|
|
29
29
|
- include/bando/qobject/qlayout.hpp
|
|
30
|
+
- include/bando/qobject/qwebenginepage.hpp
|
|
30
31
|
- include/bando/qwidget.hpp
|
|
31
32
|
- include/bando/qwidget/qspinbox.hpp
|
|
33
|
+
- include/rice/core/api.hpp
|
|
34
|
+
- include/rice/core/rice.hpp
|
|
35
|
+
- include/rice/core/stl.hpp
|
|
36
|
+
- include/rice/qt6.hpp
|
|
32
37
|
- include/rice/qt6/qdbusreply.hpp
|
|
33
38
|
- include/rice/qt6/qenum.hpp
|
|
34
39
|
- include/rice/qt6/qflags.hpp
|
|
35
40
|
- include/rice/qt6/qlist.hpp
|
|
36
|
-
- include/rice/
|
|
37
|
-
- include/rice/stl.hpp
|
|
41
|
+
- include/rice/qt6/qmap.hpp
|
|
38
42
|
- lib/mkmf-rice.rb
|
|
39
43
|
- lib/mkmf-rubyqt6.rb
|
|
40
44
|
- lib/qt6/rice.rb
|
|
41
45
|
- lib/qt6/rice/version.rb
|
|
42
|
-
- lib/qt6/rspec.rb
|
|
43
|
-
- lib/qt6/rspec/bando_file_parser.rb
|
|
44
|
-
- lib/qt6/rspec/qlass_file_parser.rb
|
|
45
46
|
homepage: https://github.com/souk4711/ruby-qt6
|
|
46
47
|
licenses: []
|
|
47
48
|
metadata:
|
|
@@ -55,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
55
56
|
requirements:
|
|
56
57
|
- - ">="
|
|
57
58
|
- !ruby/object:Gem::Version
|
|
58
|
-
version: 3.
|
|
59
|
+
version: 3.3.0
|
|
59
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
61
|
requirements:
|
|
61
62
|
- - ">="
|