* Licence details can be found in the file COPYING.
*
* \author Asger and Juergen
- * \author John Levon
+ * \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#include "QLyXKeySym.h"
#include "qlkey.h"
#include "debug.h"
-
+
#include <qevent.h>
using std::endl;
+
QLyXKeySym::QLyXKeySym()
: LyXKeySym(), key_(0)
{
}
-
-
+
+
void QLyXKeySym::set(QKeyEvent * ev)
{
key_ = ev->key();
- text_ = ev->text();
+ text_ = ev->text();
}
-
+
void QLyXKeySym::init(string const & symbolname)
{
lyxerr[Debug::KEY] << "Init key to " << key_ << ", " << text_ << endl;
}
-
+
bool QLyXKeySym::isOK() const
{
return ! key_ == 0;
}
-
+
bool QLyXKeySym::isModifier() const
{
return sym;
}
-
+
char QLyXKeySym::getISOEncoded() const
{
lyxerr[Debug::KEY] << "getISO returning " << text_.latin1()[0] << endl;
- return text_.latin1()[0];
+ return text_.latin1()[0];
}
-
-bool QLyXKeySym::operator==(LyXKeySym const & k) const
+
+bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
{
- QLyXKeySym const & o = static_cast<QLyXKeySym const &>(k);
- // ignore text_ !
- return o.key_ == key_;
+ // note we ignore text_ here (non-strict ==), because
+ // text_ is not filled out by keymap initialisation
+
+ return static_cast<QLyXKeySym const &>(k1).key()
+ == static_cast<QLyXKeySym const &>(k2).key();
+
}