Questions tagged [metaobject]

26 questions
14
votes
4 answers

How do I get the type (class) of a property of a Grails domain object?

I'm trying to dynamically create domain objects in Grails and encountered the problem that for any property referencing another domain object the metaproperty tells me its type is "java.lang.Object" and not the expected type. For example: class…
Peter Becker
  • 8,795
  • 7
  • 41
  • 64
12
votes
2 answers

How to get function name in function Qt

I try to make log when something is wrong, so I want to write the class info and function name like this: void MainWindowTest::testMethod() { qDebug()<
Jack
  • 161
  • 1
  • 13
  • 20
8
votes
1 answer

Metaobject Protocol (MOP) in Groovy

I am new to the Groovy programming language and I am trying to fully understand the dynamic nature and capabilities it has. What I do know is that every class created in Groovy in its most basic form looks like this (implements GroovyObject and…
Dan Vega
  • 1,097
  • 1
  • 14
  • 23
7
votes
2 answers

Is there a way of getting the classname of a QObject derived class without creating an instantiation of that class?

I'm looking for something like this: MyClass::metaObject()->className() which doesn't work because at the point where this code is executed, there exists no instantiation of MyClass. If this is somehow possible, is there a way of getting all names…
Marc
  • 767
  • 1
  • 10
  • 23
6
votes
5 answers

Is it possible in Qt to unit test (access) private methods?

I'm writing unit tests for my app, and now I've stumbled on a class in which I should test private methods. This could be result of poor design of particular class, but I must do it. Is there any way in Qt to call private methods, maybe using…
xx77aBs
  • 4,678
  • 9
  • 53
  • 77
6
votes
2 answers

Does Ruby have a Metaobject protocol and if not, is it possible to implement one?

Pardon my ignorance, but What is a Metaobject protocol, and does Ruby have one? If not, is it possible to implement one for Ruby? What features might a Metaobject protocol possess if Ruby was to have one?
horseyguy
  • 29,455
  • 20
  • 103
  • 145
5
votes
2 answers

I can not get methods from QMetaObject, methods offset and count are equals

i have a class that inherits from QObject and have the Q_OBJECT macro: class SomeClass: public QObject { Q_OBJECT public: SomeClass(QObject *parent = 0); void method1(); void method2(); ... }; in another class in the same header…
4
votes
1 answer

Is it ok to use Qt metatype system before QApplication is created?

I use following code whenever I need to register a type in Qt metaobject system: *.h file class MyClass { //..... class MyType {.....}; static const int metaType_MyType; class MetaClerk { public: MetaClerk(void); …
ScumCoder
  • 690
  • 1
  • 8
  • 20
4
votes
1 answer

Qt - invoking slots that take custom pointers as arguments

I'm trying to hack with Qt's signals and slots, and I ran into an issue where QMetaType::invokeMethod won't properly pass pointer arguments to the slot being called. call(QObject *receiver, const char *slot, const QList &args) { …
ak.
  • 3,329
  • 3
  • 38
  • 50
3
votes
2 answers

In python, What does it mean if I assign a variable to a method?

Reading the CherryPy tutorial I run into this class HelloWorld(object): def index(self): return "Hello World!" index.exposed = True So was does it mean? is exposed a variable in the local scope of the method index? If so, can I the…
PuercoPop
  • 6,707
  • 4
  • 30
  • 40
2
votes
1 answer

How to create a qt plugin that inherits from QWidget

I was just reading up about QWidgets and I would like to create plugins that are widgets which will be loaded during runtime. When I was looking at the sample code and the requirements, the plugin seems to inherit from the interface and QObject. How…
chikuba
  • 4,229
  • 6
  • 43
  • 75
2
votes
1 answer

How Do I Get MetaObject Values On Single MetaObject Page In Shopify

I am using metaObjects in shopify. I have created a metaObject name "Projects" . I created a page "Projects" to display those saved projects through liquid code. It is working as per the requirement on Projects page but now i want to display each…
MA-2016
  • 653
  • 3
  • 10
  • 30
2
votes
1 answer

Groovy Copying / Combining MetaMethods From Multiple Objects

I have two classes. At runtime, I want to "clone" the methods of one object, over to another. Is this possible? My failed attempt using leftshift is shown below. (Note: I also tried currMethod.clone() with the same result.) class…
solvingJ
  • 1,321
  • 1
  • 19
  • 30
2
votes
1 answer

Why does Qt reimplement RTTI in qobject_cast, event type, etc?

Why does Qt bother reimplementing what amounts to a custom RTTI system and a their own dynamic_cast in the QObject hierarchy, in QEvent, etc?
Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
2
votes
1 answer

overloading qt properties

I've got a property of a custom type. class foo : public QObject { Q_OBJECT Q_PROPERTY(Custom x READ x WRITE set_x) public: void set_x(Custom &x) { /*whatnot*/} } QJson effectively invokes the following dynamic…
qdot
  • 6,195
  • 5
  • 44
  • 95
1
2