]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/Qt2BC.C
better selection and scrolling behaviour
[lyx.git] / src / frontends / qt2 / Qt2BC.C
index 51a7beb92992c0fefc154acad6a0044ac0f4203a..cd152b3c4a0771a95495efeff8937a65496fb45c 100644 (file)
@@ -1,10 +1,12 @@
 /**
  * \file Qt2BC.C
- * Copyright 2001 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 Allan Rae <rae@lyx.org>
- * \author Angus Leeming <a.leeming@ic.ac.uk>
+ * \author Allan Rae
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
@@ -17,6 +19,8 @@
 #include "debug.h"
 
 #include <qbutton.h>
+#include <qlineedit.h>
+
 
 Qt2BC::Qt2BC(string const & cancel, string const & close)
        : GuiBC<QButton, QWidget>(cancel, close)
@@ -31,9 +35,16 @@ void Qt2BC::setButtonEnabled(QButton * obj, bool enabled)
 
 void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled)
 {
-       obj->setEnabled(enabled);
+       // yuck, rtti, but the user comes first
+       if (obj->inherits("QLineEdit")) {
+               QLineEdit * le(static_cast<QLineEdit*>(obj));
+               le->setReadOnly(!enabled);
+       } else {
+               obj->setEnabled(enabled);
+       }
+
        QWidget::FocusPolicy const p =
-               (enabled) ? QWidget::StrongFocus : QWidget::NoFocus; 
+               (enabled) ? QWidget::StrongFocus : QWidget::NoFocus;
        obj->setFocusPolicy(p);
 }