Attached a patch which removes the usage of
QT3_SUPPORT functions in GuiWorkArea.


Summary:

* Different types for mouse buttons and keys:
-key_modifier::state q_key_state(Qt::ButtonState state)
+key_modifier::state q_key_state(Qt::KeyboardModifiers state)

-mouse_button::state q_button_state(Qt::ButtonState button)
+mouse_button::state q_button_state(Qt::MouseButton button)



* Timer::start does not take two arguments any more:
                // Start the timer, one-shot.
-               step_timer_.start(50, true);
+               step_timer_.setSingleShot(true);
+               step_timer_.start(50);


* renaming: setLineStep -> setSingleStep:
-       verticalScrollBar()->setLineStep(scroll_line_step);
+       verticalScrollBar()->setSingleStep(scroll_line_step);


* renaming: QMouseEvent state->button:
        FuncRequest cmd(LFUN_MOUSE_MOTION, e->x(), e->y(),
-                             q_motion_state(e->state()));
+                             q_motion_state(e->button()));


* remove C-style cast:
                << " count=" << e->count()
-               << " text=" << (const char *) e->text()
+               << " text=" << fromqstr(e->text())
                << " isAutoRepeat=" << e->isAutoRepeat()


* renaming: QKeyEvent state->modifiers
-               processKeySym(sym, q_key_state(e->state()));
+               processKeySym(sym, q_key_state(e->modifiers()));
        }
 }


* QKeyEvent ctor does not take the ascii any more:
-               QKeyEvent ev(QEvent::KeyPress, key, *text.ascii(), 0, text);
+               QKeyEvent ev(QEvent::KeyPress, key, 0, text);
                keyPressEvent(&ev);
        
Index: GuiWorkArea.C
===================================================================
--- GuiWorkArea.C       (revision 14539)
+++ GuiWorkArea.C       (working copy)
@@ -9,6 +9,8 @@
  * Full author contact details are available in file CREDITS.
  */
 
+#undef QT3_SUPPORT
+
 #include <config.h>
 
 
@@ -55,7 +57,7 @@
 namespace {
 
 /// return the LyX key state from Qt's
-key_modifier::state q_key_state(Qt::ButtonState state)
+key_modifier::state q_key_state(Qt::KeyboardModifiers state)
 {
        key_modifier::state k = key_modifier::none;
        if (state & Qt::ControlModifier)
@@ -69,7 +71,7 @@
 
 
 /// return the LyX mouse button state from Qt's
-mouse_button::state q_button_state(Qt::ButtonState button)
+mouse_button::state q_button_state(Qt::MouseButton button)
 {
        mouse_button::state b = mouse_button::none;
        switch (button) {
@@ -90,7 +92,7 @@
 
 
 /// return the LyX mouse button state from Qt's
-mouse_button::state q_motion_state(Qt::ButtonState state)
+mouse_button::state q_motion_state(Qt::MouseButton state)
 {
        mouse_button::state b = mouse_button::none;
        if (state & Qt::LeftButton)
@@ -167,7 +169,8 @@
                        lyxerr[Debug::GUI] << "ERROR: keyeventTimeout cannot 
connect!" << endl;
 
                // Start the timer, one-shot.
-               step_timer_.start(50, true);
+               step_timer_.setSingleShot(true);
+               step_timer_.start(50);
        }
 
        // Enables input methods for asian languages.
@@ -188,7 +191,7 @@
 
        verticalScrollBar()->setRange(0, scroll_max_);
        verticalScrollBar()->setSliderPosition(scroll_pos);
-       verticalScrollBar()->setLineStep(scroll_line_step);
+       verticalScrollBar()->setSingleStep(scroll_line_step);
 }
 
 
@@ -265,7 +268,7 @@
 void GuiWorkArea::mouseMoveEvent(QMouseEvent * e)
 {
        FuncRequest cmd(LFUN_MOUSE_MOTION, e->x(), e->y(),
-                             q_motion_state(e->state()));
+                             q_motion_state(e->button()));
 
        // If we're above or below the work area...
        if (e->y() <= 20 || e->y() >= viewport()->height() - 20) {
@@ -329,7 +332,7 @@
        // documentation of QWheelEvent)
        int const lines = qApp->wheelScrollLines() * e->delta() / 120;
        verticalScrollBar()->setValue(verticalScrollBar()->value() -
-                       lines *  verticalScrollBar()->lineStep());
+                       lines *  verticalScrollBar()->singleStep());
        adjustViewWithScrollBar();
 }
 
@@ -357,7 +360,7 @@
 {
        lyxerr[Debug::KEY] << BOOST_CURRENT_FUNCTION
                << " count=" << e->count()
-               << " text=" << (const char *) e->text()
+               << " text=" << fromqstr(e->text())
                << " isAutoRepeat=" << e->isAutoRepeat()
                << " key=" << e->key()
                << endl;
@@ -368,7 +371,7 @@
        else {
                boost::shared_ptr<QLyXKeySym> sym(new QLyXKeySym);
                sym->set(e);
-               processKeySym(sym, q_key_state(e->state()));
+               processKeySym(sym, q_key_state(e->modifiers()));
        }
 }
 
@@ -393,19 +396,20 @@
 
                lyxerr[Debug::GUI] << BOOST_CURRENT_FUNCTION
                                   << " count=" << ev->count()
-                                  << " text=" << (const char *) ev->text()
+                                  << " text=" <<  fromqstr(ev->text())
                                   << " isAutoRepeat=" << ev->isAutoRepeat()
                                   << " key=" << ev->key()
                                   << endl;
 
-               processKeySym(sym, q_key_state(ev->state()));
+               processKeySym(sym, q_key_state(ev->modifiers()));
                keyeventQueue_.pop();
 
                handle_autos = false;
        }
 
        // Restart the timer.
-       step_timer_.start(25, true);
+       step_timer_.setSingleShot(true);
+       step_timer_.start(25);
 }
 
 
@@ -600,8 +604,8 @@
        if (!text.isEmpty()) {
 
                lyxerr[Debug::KEY] << BOOST_CURRENT_FUNCTION
-                       << " preeditString =" << (const char *) 
e->preeditString()
-                       << " commitString  =" << (const char *) 
e->commitString()
+                       << " preeditString =" << fromqstr(e->preeditString())
+                       << " commitString  =" << fromqstr(e->commitString())
                        << endl;
 
                int key = 0;
@@ -609,7 +613,7 @@
                // ideally, such special coding should not be necessary
                if (text == "^")
                        key = Qt::Key_AsciiCircum;
-               QKeyEvent ev(QEvent::KeyPress, key, *text.ascii(), 0, text);
+               QKeyEvent ev(QEvent::KeyPress, key, 0, text);
                keyPressEvent(&ev);
        }
        e->accept();
Index: GuiWorkArea.h
===================================================================
--- GuiWorkArea.h       (revision 14539)
+++ GuiWorkArea.h       (working copy)
@@ -54,7 +54,7 @@
 public:
        int x;
        int y;
-       Qt::ButtonState state;
+       Qt::MouseButton state;
        bool active;
 
        bool operator==(QMouseEvent const & e) {

Reply via email to