PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 12, 2022

[FIXED] What are QKeyEvent.nativeModifiers()?

 September 12, 2022     cross-platform, keyboard-events, modifier-key, pyside6, qt     No comments   

Issue

What are QKeyEvent.nativeModifiers()? The documentation doesn't say much (https://doc.qt.io/qtforpython/PySide6/QtGui/QKeyEvent.html#PySide6.QtGui.PySide6.QtGui.QKeyEvent.nativeModifiers). From what I understand, the integer that is returned by calling this method on a QKeyEvent object represents the full state of the modifier keys (Ctrl, Shift, Alt, etc.).

Moreover, I would assume that the mapping between these integers and their respective modifier states is systematic, so is there a way to test whether a given modifier state contains a specific modifier (e.g. by using the "&" operator)?

Importantly, are the native modifiers cross-platform such that a Left Ctrl keypress on a PC returns the same integer as a Left Command on a Mac (since Qt.Key_Control corresponds to the MacOS command keys)?


Solution

As name suggests native modifiers has different values on mac and on pc. On windows value is a combination of WindowsNativeModifiers, on macOS it is a combination of NSEventModifierFlags, both translated to Qt::KeyboardModifiers (windows macOS) which is same on both platforms.



Answered By - mugiseyebrows
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing