]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/QLyXKeySym.C
Some string(widget->text()) fixes. Weirdness
[lyx.git] / src / frontends / qt2 / QLyXKeySym.C
index abc25247988f64d9ea447e48c4b6c63ad3992345..afe75d39a923b1365f62255327e3b60ce8346acd 100644 (file)
@@ -1,10 +1,12 @@
 /**
  * \file QLyXKeySym.C
- * Copyright 2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author Asger and Juergen
- * \author John Levon <moz@compsoc.man.ac.uk>
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 #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)
 {
@@ -39,12 +44,12 @@ 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
 {
@@ -64,17 +69,20 @@ string QLyXKeySym::getSymbolName() 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();
+
 }