I use MacOX High Sierra 10.13.6 and LyX 2.3.2.

The problem is the outline items(sections in the document) can only be
selected by mouse click. However, the same LyX 2.3.2 on RollApp(cloud
version of LyX) doesn’t not have this problem.

After looking at the source code, I thought of two solutions but none of
them worked.

*Solution 1*. I added the following function to the TocWidget.cpp file to
specifically handle the keyPressEvent:


---------------------------------------------------------------------------------------------------------------
void TocWidget::keyPressEvent(QKeyEvent *event)
{
if(event->key() == Qt::Key_Enter)
{
QModelIndex const & curIdx = tocTV->currentIndex();
goTo(curIdx);
gui_view_.setFocus();
gui_view_.activateWindow();
}
}
---------------------------------------------------------------------------------------------------------------

But it doesn’t work after compiling against Qt5



*Solution 2.* I tried to hack the original function on_tocTV_pressed by
adding a keyboardModifier flag check:

___________________________________________________________________
void TocWidget::on_tocTV_pressed(QModelIndex const & index)
{

Qt::MouseButtons const button = QApplication::mouseButtons();
Qt::KeyboardModifiers const modifier = QApplication::keyboardModifiers();
if ((button & Qt::LeftButton) || modifier.testFlag(Qt::ShiftModifier)) {
goTo(index);
gui_view_.setFocus();
gui_view_.activateWindow();
}
}
___________________________________________________________________

But still to no avail. I am not sure what is the problem here. I need some
help/guidance in making this work on MacOS since this is the only place
that requires mouse input. If this could be solved, I can 100% write my
document mouse free which is a huge improvement considering the going back
and forth in a large document using a mouse causes some inconvenience.

I also tried the same thing on 2.4 development build and the problem
persists. I don’t even know how to debug the program. It would be very
helpful if someone can tell me how to see(or print to status bar) all the
variables or at least the QtIndices when navigating through the tocTV
variable on GUI.



Jason Sun
Ph.D Candidate
Department of Statistical Science
Cornell University
105 Malott Hall
Ithaca, NY 14853-3201

Reply via email to