On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: > Le 05/06/2010 18:45, Jens Nöckel a écrit : >> So my question to the LyX dev team would be: could you add a preference item >> that lets the user set some flag, so that the call >> setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); >> can be made dependent on that flag? Maybe the simplest place to put this in >> would be not in the Preferences, but in the Mac-only part of the LyX menu. >> But on the other hand, that wouldn't look very consistent - so the >> Preferences, under "Keyboard/Mouse" would perhaps be the most logical >> location where to add such a flag. Any ideas on that would be great - I'm >> sure it should be possible to add a little extra button somewhere. > > This should be done in a way that does not break with qt < 4.6. > > JMarc
I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and successfully connected it to a checkbox in the Keyboard Preferences. The default value is false (meaning the current standard behavior - this follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the line setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); in GuiApplication::execBatchCommands() right after #ifdef Q_WS_MACX Everything is working great. I can set the preference and it gets applied when the application is re-launched (maybe one could apply it immediately, but I wasn't sure how I can then make sure that the menu shortcuts are updated to display the correct modifier keys). If anyone sees something wrong with this approach, please let me know. To avoid problems with earlier Qt versions, I will (but haven't yet) enclose all my code in: #if QT_VERSION > 0x040600 ... #endif and if it isn't already there, I'll also put in #ifdef Q_WS_MACX ... #endif All my testing was done with the official lyx-1.6.1 source release, so my next hurdle will be to get an SVN version to build. I haven't tried that for several years, so I may have some questions tomorrow... if all else fails, I could perhaps just send the diffs to the official release. Jens