I've recently implemented a command design pattern in Java with the use of:
private HashMap<Component, CommandInterface> commands;
Where Component
is any Java Component (JButton
, JMenuItem
, ...) and CommandInterface
is an interface for my Command-Classes.
So my question is: How can I accomplish this with C++/Qt ?
I've already used QMap
and QHash
, but both of them need an overloaded operator (operator<
or operator==
) for their Key
-values.
Is the only possible way to derive from QObject
and overload operator<
?
Thanks in advance.