Wednesday, May 30, 2007
Bash Shell 快捷键的学习使用
from DBA notes by Fenng
作者:Fenng 发布在 dbanotes.net
这篇 Bash Shell Shortcuts 的快捷键总结的非常好。值得学习。下面内容大多数是拷贝粘贴与总结.
CTRL 键相关的快捷键:
Ctrl + a - Jump to the start of the line
Ctrl + b - Move back a char
Ctrl + c - Terminate the command //用的最多了吧?
Ctrl + d - Delete from under the cursor
Ctrl + e - Jump to the end of the line
Ctrl + f - Move forward a char
Ctrl + k - Delete to EOL
Ctrl + l - Clear the screen //清屏,类似 clear 命令
Ctrl + r - Search the history backwards //查找历史命令
Ctrl + R - Search the history backwards with multi occurrence
Ctrl + u - Delete backward from cursor // 密码输入错误的时候比较有用
Ctrl + xx - Move between EOL and current cursor position
Ctrl + x @ - Show possible hostname completions
Ctrl + z - Suspend/ Stop the command
补充:
Ctrl + h - 删除当前字符
Ctrl + w - 删除最后输入的单词
ALT 键相关的快捷键:
平时很少用。有些和远程登陆工具冲突。
Alt + < - Move to the first line in the history
Alt + > - Move to the last line in the history
Alt + ? - Show current completion list
Alt + * - Insert all possible completions
Alt + / - Attempt to complete filename
Alt + . - Yank last argument to previous command
Alt + b - Move backward
Alt + c - Capitalize the word
Alt + d - Delete word
Alt + f - Move forward
Alt + l - Make word lowercase
Alt + n - Search the history forwards non-incremental
Alt + p - Search the history backwards non-incremental
Alt + r - Recall command
Alt + t - Move words around
Alt + u - Make word uppercase
Alt + back-space - Delete backward from cursor // SecureCRT 如果没有配置好,这个就很管用了。
其他特定的键绑定:
输入 bind -P 可以查看所有的键盘绑定。这一系列我觉得更为实用。
Here "2T" means Press TAB twice
$ 2T - All available commands(common) //命令行补全,我认为是 Bash 最好用的一点
$ (string)2T - All available commands starting with (string)
$ /2T - Entire directory structure including Hidden one
$ 2T - Only Sub Dirs inside including Hidden one
$ *2T - Only Sub Dirs inside without Hidden one
$ ~2T - All Present Users on system from "/etc/passwd" //第一次见到,很好用
$ $2T - All Sys variables //写Shell脚本的时候很实用
$ @2T - Entries from "/etc/hosts" //第一次见到
$ =2T - Output like ls or dir //好像还不如 ls 快捷
补充:
Esc + T - 交换光标前面的两个单词
很多来自GNU 的 readline 库。另外一份总结也很好
记忆是所有技术人员的敌人。一次要把所有的都记住是不可能的。针对自己的使用习惯,对少数快捷键反复使用,短期内就会有效果。
中文分词模块 from Huang Jiahua
# -*- coding: UTF-8 -*-
# Author: Huang Jiahua
# Last modified: 2004-08-25
__revision__ = '0.1'
#切分关键字,要求预先转换为 Unicode 类型
# 分开中文,非中文 -> 按 seps 列表分隔 -> 对中文二元分词 -> 合并 -> 返回数组
import sys
##sys.setappdefaultencoding('utf8')
#分隔关键字列表 seps 设置
seps=[]
seps=[" ","\t","\n","\r",",","<",">","?","!",
";","\#",":",".","'",'"',"(",")","{","}","[","]","|","_","=",
" ",",","?","。","、",""",""","《","》","[","]","!","(",")"]
# Unicode 编码的分隔关键字列表
def _utuni(strr):return unicode(strr,'utf8')
seps=map(_utuni,seps)
##_alkeys={}
_zhkeys={}
_askeys={}
# _zhstr , _asstr 存储 中文,非中文 数组
_zhstr = []
_asstr = []
def _zhsplitkey(stri):
# 对 stri 二元分词法
#存入全局字典 _zhkeys
global _zhkeys
ln = len(stri)
if ln == 1:
return stri
#拆分中文关键字,二元分词法
n = 0
while n < ln-1:
_zhkeys[stri[n]+stri[n+1]] = ''
n = n+1
## return keyy.keys()
def _fenzhas(stri):
# 分开中文和非中文,
# 存入全局数组 _zhstr , _asstr
global _asstr
global _zhstr
ln = len(stri)
_zhstr = []
_asstr = []
n = 0
m = 0
try:
stri[n] >= u'\u4e00'
except:
return 0
while n < ln:
if stri[n] >= u'\u4e00':
if m==0:_zhstr.append(' ')
_zhstr.append(stri[n])
## print 'z:',stri[n]
m=1
else:
if m==1:_asstr.append(' ')
_asstr.append(stri[n])
## print 'a:',stri[n]
m=2
n+=1
## print 'zh:',''.join(_zhstr)
## print 'as:',''.join(_asstr)
def _fenseps(stri):
# 按 seps 列表分隔, 返回分隔后数组
global seps
alkeys={}
n = 0
m = 0
ln=stri.__len__()
while n
alkeys[stri[m:n]]=''
m=n+1
n+=1
if n>m:alkeys[stri[m:n]]=''
return alkeys.keys()
def splitkey(stri):
"""Split the keys
Split the keys."""
# 接受 str 返回分词后数组
global _zhstr
global _asstr
global _zhkeys
global _askeys
_zhkeys = {}
_askeys = {}
_zhstr = []
_asstr = []
_fenzhas(stri) #分开中文,非中文,存入数组 _zhstr , _asstr
zhstr= _fenseps(''.join(_zhstr))
asstr= _fenseps(''.join(_asstr)) #?
_zhstr = []
_asstr = []
for i in zhstr:
_zhsplitkey(i) #中文分词放入字典 _zhkeys
for i in asstr:
_askeys[i]=''
alkeys = {}
alkeys.update(_zhkeys)
alkeys.update(_askeys)
_zhkeys = {}
_askeys = {}
return alkeys.keys()
if __name__=="__main__":
# 命令行测试
import sys
# sys.setappdefaultencoding('unicode')
enc = sys.stdin.encoding
if len(sys.argv) > 1:
keyy = sys.argv[1]
else:
keyy = sys.stdin.read()
## keyyy = splitkey(keyy.decode(enc))
keyyy = splitkey(keyy.decode('utf8'))
for i in keyyy:
## print i.encode(enc),
print i.encode('utf8'),
Monday, May 28, 2007
FreezePython with QT4
Sunday, May 27, 2007
How to support input method in KDE/Qt application.
Sometimes additional code is necessary to support input method in KDE/Qt application. This document will explain what's input method and how to support input method.
What's input method?
Input method is system to help user's keyboard input. Using input method, user can input characters that can not input from keyboard directly, and reduce cost of keyboard input. Input method is necessary for the user wants to input CJK(Chinese, Japanese, and Korean) and other language's characters.
In X Window System, XIM(X Input Method) is standard input method. Qt and KDE support XIM. But XIM is legacy system and lacks some features modern input method should have.
So, the input method systems other than XIM are developing now. IIIMF(Internet Intranet Input Method Framework), UIM(Universal Input Method), and SCIM(Smart Common Input Method platform).
Gtk+ supports these input methods using immodule. Qt supports only XIM. But immodule for Qt project tries to introduce immodule to Qt.
What's immodule?
immodule is plugable module for input method. It supports several input methods and can change input method dynamically.
Original Qt(without immodule patch) supports XIM only. So, user has to use XIM-bridge(ex. htt, uim-xim) when user wants to use the other input method. But with immodule patched Qt, user can use favorite input method directly.
Qt4(next major version of Qt) will take the result of the immodule for Qt project, and support immodule. If developer wants to support input method correct, sometimes some input method related code is necessary.
When do you need writing code to support input method?
- case A)
Your application doesn't need input text.
You don't need to do anything.
- case B)
Your application need input text. And you use only input widget in KDE or Qt library. (ex. QLineEdit, QTextEdit, and more)
You don't need to do anything. KDE and QT library's input widget supports input method correct. There is no need of additional code.
- case C)
Your application need input text. And you want to support keyboard input in your own widget. (ex. kate, konsole, kolourpaint, koffice, and more)
You need writing code to support input method. See next section.
How to support input method in KDE/Qt application.
If you want to support keyboard input in your own widget(case C), you need writing code to support input method.
- Step A)
Set inputMethodEnabled property to ture. inputMethodEnabled property can enable/disable input method. And default is false except some input widgets. If your widget accepts input from input method, set it to true using QWidget::setInputMethodEnabled() method.
setInputMethodEnabled( true );
note: Original qt can use input method even when inputMethodEnabled property is false. (original qt ignore this property.) it's bug(maybe) and it confuses user. ( When widget doesn't accept text input(e.g. QLabel, QPushButton), I can open input method's window on that widget. ) So qt with immodule check this property to use input method. If your qt is without immodule, it seems to do not need this step. But this is needed.
- Step B)
Set microFocusHint for input method can get position of input place.
When widget shows or moves cursor, you should set microFocusHint using QWidget::setMicroFosucHint().
microFocusHint is a hint that input method get place of input. It's help for input method shows additional information at suitable place when user uses input method.
- Step C)
Accpet QKeyEvent's text.
Create your widget's keyPressEvent() event handler. And check QKeyEvent::text() for input method's input.
When QKeyEvent::text() is not empty, widget should accept it as user input.
note: QKeyEvent::text() is used when user uses XIM and OverTheSpot style. If user uses OnTheSpot style or other input method, we can't get input method's input using this way. See Step D).
- Step D)
Implement QIMEvent handlers.
Input method's inputs are sent by QIMEvent when user uses input method other than OverTheSpot style XIM.
Please see QIMEvent's document for detail. You should reimplement QWidget::imStartEvent(), QWidget::imComposeEvent(), and QWidget::imEndEvent().
- QWidget::imStartEvent()
- Remember cursor position to show composing string. (QIMEvent doesn't have it.)
- QWidget::imComposeEvent()
- Remember composing string(QIMEvent::text()) and cursor position(QIMEvent::cursorPos()) in it and selecting string length(QIMEvent::selectionLength). Then show it as composing(preedit) strings.
- QWidget::imEndEvent()
- In imEndEvent(), QIMEvent sends final text user commits. Accept QIMEvent::text() as final text.
Maybe that's all of input method support.
Please read and comment it.
Saturday, May 26, 2007
QCoreApplication::setLibraryPaths
void QCoreApplication::setLibraryPaths ( const QStringList & paths ) [static]
Sets the list of directories to search when loading libraries to paths. All existing paths will be deleted and the path list will consist of the paths given in paths.
See also libraryPaths(), addLibraryPath(), removeLibraryPath(), and QLibrary.
Friday, May 25, 2007
GIf support in Windows
Tuesday, May 22, 2007
MixIn
MixIn 技术 (感谢 limdou 的介绍)
def MixIn(pyClass, mixInClass):
print "Mix class:",mixInClass, " into: ",pyClass,'\n'
pyClass.__bases__ += (mixInClass,)
class A:
def __init__(self):
self.name = "Class A"
def fun(self):
print self.name
class B:
def __init__(self):
self.name = "Class B"
def add(self, a,b):
print 'function defined in B'
return a + b
obj_a = A()
print obj_a
print dir(obj_a),'\n'
MixIn(A,B)
print obj_a
print dir(obj_a),'\n'
print obj_a.add(3,5)
-----------------------------------------〉
执行结果:
>>>
<__main__.a>
['__doc__', '__init__', '__module__', 'fun', 'name']
Mix class: __main__.B into: __main__.A
<__main__.a>
['__doc__', '__init__', '__module__', 'add', 'fun', 'name']
function defined in B
8
解释一下 MixIn 技术,就是使 一个类成为另一个类的基类, 这样会使 被 MixIn 的那个类具有了新的特性。
在例子程序中, 我们将 B 类 MixIn 进 A 类, 成为 A 的基类,于是, A 类的实例便具有了 B 类的方法(add)
obj_a = A() obj_a 是 类 A 的一个实例
print obj_a <__main__.a>
print dir(obj_a),'\n' ['__doc__', '__init__', '__module__', 'fun', 'name']
MixIn(A,B) 将B MixIn 进 A
print obj_a <__main__.a>
print dir(obj_a),'\n' ['__doc__', '__init__', '__module__', 'add', 'fun', 'name']
注意,这时候,多了一个 add 方法(类B 中定义)
print obj_a.add(3,5) 现在 A 的实例可以使用 B 中的方法了
python中实现Single模式
#-*- coding:utf-8 -*-
class Singleton:
""" A python singleton """
class __impl:
""" Implementation of the singleton interface """
def spam(self):
""" Test method, return singleton id """
return id(Singleton.__instance)
# storage for the instance reference
__instance = None
def __init__(self):
""" Create singleton instance """
# Check whether we already have an instance
if Singleton.__instance is None:
# Create and remember instance
Singleton.__instance = Singleton.__impl()
# Store instance reference as the only member in the handle
self.__dict__['_Singleton__instance'] = Singleton.__instance
def __getattr__(self, attr):
""" Delegate access to implementation """
return getattr(self.__instance, attr)
def __setattr__(self, attr, value):
""" Delegate access to implementation """
return setattr(self.__instance, attr, value)
class SingletonType(type):
"""Singleton Metaclass"""
def __init__(cls, name, bases, dic):
super(SingletonType, cls).__init__(name, bases, dic)
cls.instance = None
def __call__(cls, *args, **kwargs):
if cls.instance is None:
cls.instance = super(SingletonType, cls).__call__(*args, **kwargs)
return cls.instance
class MyClass:
__metaclass__ = SingletonType
if __name__ == '__main__':
#print dir(MyClass)
ob1 = MyClass()
ob2 = MyClass()
print id(ob1), id(ob2)
#print dir(Singleton)
s1 = Singleton()
s2 = Singleton()
print id(s1), s1.spam()
print id(s2), s2.spam()
QThread::Priority
QThread QObject.thread (self)
Returns the thread in which the object lives.
See also moveToThread().
enum QThread::Priority
This enum type indicates how the operating system should schedule newly created threads.
Constant | Value | Description |
---|---|---|
QThread::IdlePriority | 0 | scheduled only when no other threads are running. |
QThread::LowestPriority | 1 | scheduled less often than LowPriority. |
QThread::LowPriority | 2 | scheduled less often than NormalPriority. |
QThread::NormalPriority | 3 | the default priority of the operating system. |
QThread::HighPriority | 4 | scheduled more often than NormalPriority. |
QThread::HighestPriority | 5 | scheduled more often than HighPriority. |
QThread::TimeCriticalPriority | 6 | scheduled as often as possible. |
QThread::InheritPriority | 7 | use the same priority as the creating thread. This is the default. |
单纯的通过线程解决不了假死问题是, 可以试着调整一下优先级.
Monday, May 21, 2007
QRegExp.indexIn
int QRegExp.indexIn (self, QString str, int offset = 0, CaretMode caretMode = QRegExp.CaretAtZero)
Attempts to find a match in str from position offset (0 by default). If offset is -1, the search starts at the last character; if -2, at the next to last character; etc.
Returns the position of the first match, or -1 if there was no match.
The caretMode parameter can be used to instruct whether ^ should match at index 0 or at offset.
You might prefer to use QString.indexOf(), QString.contains(), or even QStringList.filter(). To replace matches use QString.replace().
Example:
QString str = "offsets: 1.23 .50 71.00 6.00";
QRegExp rx("\\d*\\.\\d+"); // primitive floating point matching
int count = 0;
int pos = 0;
while ((pos = rx.indexIn(str, pos)) != -1) {
++count;
pos += rx.matchedLength();
}
// pos will be 9, 14, 18 and finally 24; count will end up as 4
Thursday, May 17, 2007
QEvent::Type
Member Type Documentation
enum QEvent::Type
This enum type defines the valid event types in Qt. The event types and the specialized classes for each type are as follows:
Constant | Value | Description |
---|---|---|
QEvent::None | 0 | Not an event. |
QEvent::AccessibilityDescription | 130 | Used to query accessibility description texts (QAccessibleEvent). |
QEvent::AccessibilityHelp | 119 | Used to query accessibility help texts (QAccessibleEvent). |
QEvent::AccessibilityPrepare | 86 | Accessibility information is requested. |
QEvent::ActionAdded | 114 | A new action has been added (QActionEvent). |
QEvent::ActionChanged | 113 | An action has been changed (QActionEvent). |
QEvent::ActionRemoved | 115 | An action has been removed (QActionEvent). |
QEvent::ActivationChange | 99 | A widget's top-level window activation state has changed. |
QEvent::ApplicationActivated | 121 | The application has been made available to the user. |
QEvent::ApplicationDeactivated | 122 | The application has been suspended, and is unavailable to the user. |
QEvent::ApplicationFontChange | 36 | The default application font has changed. |
QEvent::ApplicationLayoutDirectionChange | 37 | The default application layout direction has changed. |
QEvent::ApplicationPaletteChange | 38 | The default application palette has changed. |
QEvent::ApplicationWindowIconChange | 35 | The application's icon has changed. |
QEvent::ChildAdded | 68 | An object gets a child (QChildEvent). |
QEvent::ChildPolished | 69 | A widget child gets polished (QChildEvent). |
QEvent::ChildRemoved | 71 | An object loses a child (QChildEvent). |
QEvent::Clipboard | 40 | The clipboard contents have changed (QClipboardEvent). |
QEvent::Close | 19 | Widget was closed (QCloseEvent). |
QEvent::ContextMenu | 82 | Context popup menu (QContextMenuEvent). |
QEvent::DeferredDelete | 52 | The object will be deleted after it has cleaned up. |
QEvent::DragEnter | 60 | The cursor enters a widget during a drag and drop operation (QDragEnterEvent). |
QEvent::DragLeave | 62 | The cursor leaves a widget during a drag and drop operation (QDragLeaveEvent). |
QEvent::DragMove | 61 | A drag and drop operation is in progress (QDragMoveEvent). |
QEvent::Drop | 63 | A drag and drop operation is completed (QDropEvent). |
QEvent::EnabledChange | 98 | Widget's enabled state has changed. |
QEvent::Enter | 10 | Mouse enters widget's boundaries. |
QEvent::EnterEditFocus | 150 | An editor widget gains focus for editing. |
QEvent::EnterWhatsThisMode | 124 | Send to toplevel widgets when the application enters "What's This?" mode. |
QEvent::FileOpen | 116 | File open request (QFileOpenEvent). |
QEvent::FocusIn | 8 | Widget gains keyboard focus (QFocusEvent). |
QEvent::FocusOut | 9 | Widget loses keyboard focus (QFocusEvent). |
QEvent::FontChange | 97 | Widget's font has changed. |
QEvent::GraphicsSceneContextMenu | 159 | Context popup menu over a graphics scene (QGraphicsSceneContextMenuEvent). |
QEvent::GraphicsSceneDragEnter | 164 | The cursor enters a graphics scene during a drag and drop operation. |
QEvent::GraphicsSceneDragLeave | 166 | The cursor leaves a graphics scene during a drag and drop operation. |
QEvent::GraphicsSceneDragMove | 165 | A drag and drop operation is in progress over a scene. |
QEvent::GraphicsSceneDrop | 167 | A drag and drop operation is completed over a scene. |
QEvent::GraphicsSceneHelp | 163 | The user requests help for a graphics scene (QHelpEvent). |
QEvent::GraphicsSceneHoverEnter | 160 | The mouse cursor enters a hover item in a graphics scene (QGraphicsSceneHoverEvent). |
QEvent::GraphicsSceneHoverLeave | 162 | The mouse cursor leaves a hover item in a graphics scene (QGraphicsSceneHoverEvent). |
QEvent::GraphicsSceneHoverMove | 161 | The mouse cursor moves inside a hover item in a graphics scene (QGraphicsSceneHoverEvent). |
QEvent::GraphicsSceneMouseDoubleClick | 158 | Mouse press again (double click) in a graphics scene (QGraphicsSceneMouseEvent). |
QEvent::GraphicsSceneMouseMove | 155 | Move mouse in a graphics scene (QGraphicsSceneMouseEvent). |
QEvent::GraphicsSceneMousePress | 156 | Mouse press in a graphics scene (QGraphicsSceneMouseEvent). |
QEvent::GraphicsSceneMouseRelease | 157 | Mouse release in a graphics scene (QGraphicsSceneMouseEvent). |
QEvent::GraphicsSceneWheel | 168 | Mouse wheel rolled in a graphics scene (QGraphicsSceneWheelEvent). |
QEvent::Hide | 18 | Widget was hidden (QHideEvent). |
QEvent::HideToParent | 27 | A child widget has been hidden. |
QEvent::HoverEnter | 127 | The mouse cursor enters a hover widget (QHoverEvent). |
QEvent::HoverLeave | 128 | The mouse cursor leaves a hover widget (QHoverEvent). |
QEvent::HoverMove | 129 | The mouse cursor moves inside a hover widget (QHoverEvent). |
QEvent::IconDrag | 96 | The main icon of a window has been dragged away (QIconDragEvent). |
QEvent::IconTextChange | 101 | Widget's icon text has been changed. |
QEvent::InputMethod | 83 | An input method is being used (QInputMethodEvent). |
QEvent::KeyPress | 6 | Key press (QKeyEvent). |
QEvent::KeyRelease | 7 | Key release (QKeyEvent). |
QEvent::LanguageChange | 89 | The application translation changed. |
QEvent::LayoutDirectionChange | 90 | The direction of layouts changed. |
QEvent::LayoutRequest | 76 | Widget layout needs to be redone. |
QEvent::Leave | 11 | Mouse leaves widget's boundaries. |
QEvent::LeaveEditFocus | 151 | An editor widget loses focus for editing. |
QEvent::LeaveWhatsThisMode | 125 | Send to toplevel widgets when the application leaves "What's This?" mode. |
QEvent::LocaleChange | 88 | The system locale has changed. |
QEvent::MenubarUpdated | 153 | The window's menu bar has been updated. |
QEvent::MetaCall | 43 | An asynchronous method invocation via QMetaObject::invokeMethod(). |
QEvent::ModifiedChange | 102 | Widgets modification state has been changed. |
QEvent::MouseButtonDblClick | 4 | Mouse press again (QMouseEvent). |
QEvent::MouseButtonPress | 2 | Mouse press (QMouseEvent). |
QEvent::MouseButtonRelease | 3 | Mouse release (QMouseEvent). |
QEvent::MouseMove | 5 | Mouse move (QMouseEvent). |
QEvent::MouseTrackingChange | 109 | The mouse tracking state has changed. |
QEvent::Move | 13 | Widget's position changed (QMoveEvent). |
QEvent::Paint | 12 | Screen update necessary (QPaintEvent). |
QEvent::PaletteChange | 39 | Palette of the widget changed. |
QEvent::ParentAboutToChange | 131 | The widget parent is about to change. |
QEvent::ParentChange | 21 | The widget parent has changed. |
QEvent::Polish | 75 | The widget is polished. |
QEvent::PolishRequest | 74 | The widget should be polished. |
QEvent::QueryWhatsThis | 123 | The widget should accept the event if it has "What's This?" help. |
QEvent::Resize | 14 | Widget's size changed (QResizeEvent). |
QEvent::Shortcut | 117 | Key press in child for shortcut key handling (QShortcutEvent). |
QEvent::ShortcutOverride | 51 | Key press in child, for overriding shortcut key handling (QKeyEvent). |
QEvent::Show | 17 | Widget was shown on screen (QShowEvent). |
QEvent::ShowToParent | 26 | A child widget has been shown. |
QEvent::SockAct | 50 | Socket activated, used to implement QSocketNotifier. |
QEvent::StatusTip | 112 | A status tip is requested (QStatusTipEvent). |
QEvent::StyleChange | 100 | Widget's style has been changed. |
QEvent::TabletMove | 87 | Wacom tablet move (QTabletEvent). |
QEvent::TabletPress | 92 | Wacom tablet press (QTabletEvent). |
QEvent::TabletRelease | 93 | Wacom tablet release (QTabletEvent). |
QEvent::TabletEnterProximity | 171 | Wacom tablet enter proximity event (QTabletEvent), sent to QApplication. |
QEvent::TabletLeaveProximity | 172 | Wacom tablet leave proximity event (QTabletEvent), sent to QApplication. |
QEvent::Timer | 1 | Regular timer events (QTimerEvent). |
QEvent::ToolBarChange | 120 | The toolbar button is toggled on Mac OS X. |
QEvent::ToolTip | 110 | A tooltip was requested (QHelpEvent). |
QEvent::UpdateLater | 78 | The widget should be queued to be repainted at a later time. |
QEvent::UpdateRequest | 77 | The widget should be repainted. |
QEvent::WhatsThis | 111 | The widget should reveal "What's This?" help (QHelpEvent). |
QEvent::WhatsThisClicked | 118 | A link in a widget's "What's This?" help was clicked. |
QEvent::Wheel | 31 | Mouse wheel rolled (QWheelEvent). |
QEvent::WinEventAct | 132 | A Windows-specific activation event has occurred. |
QEvent::WindowActivate | 24 | Window was activated. |
QEvent::WindowBlocked | 103 | The window is blocked by a modal dialog. |
QEvent::WindowDeactivate | 25 | Window was deactivated. |
QEvent::WindowIconChange | 34 | The window's icon has changed. |
QEvent::WindowStateChange | 105 | The window's state (minimized, maximized or full-screen) has changed (QWindowStateChangeEvent). |
QEvent::WindowTitleChange | 33 | The window title has changed. |
QEvent::WindowUnblocked | 104 | The window is unblocked after a modal dialog exited. |
QEvent::ZOrderChange | 126 | The widget's z-order has changed. This event is never sent to top level windows. |
QEvent::KeyboardLayoutChange | 169 | The keyboard layout has changed. |
QEvent::DynamicPropertyChange | 170 | A dynamic property was added, changed or removed from the object. |
User events should have values between User and MaxUser:
Constant | Value | Description |
---|---|---|
QEvent::User | 1000 | User-defined event. |
QEvent::MaxUser | 65535 | Last user event ID. |
Qt::Key
enum Qt::Key
The key names used by Qt.
Constant | Value | Description |
---|---|---|
Qt::Key_Escape | 0x01000000 | |
Qt::Key_Tab | 0x01000001 | |
Qt::Key_Backtab | 0x01000002 | |
Qt::Key_Backspace | 0x01000003 | |
Qt::Key_Return | 0x01000004 | |
Qt::Key_Enter | 0x01000005 | |
Qt::Key_Insert | 0x01000006 | |
Qt::Key_Delete | 0x01000007 | |
Qt::Key_Pause | 0x01000008 | |
Qt::Key_Print | 0x01000009 | |
Qt::Key_SysReq | 0x0100000a | |
Qt::Key_Clear | 0x0100000b | |
Qt::Key_Home | 0x01000010 | |
Qt::Key_End | 0x01000011 | |
Qt::Key_Left | 0x01000012 | |
Qt::Key_Up | 0x01000013 | |
Qt::Key_Right | 0x01000014 | |
Qt::Key_Down | 0x01000015 | |
Qt::Key_PageUp | 0x01000016 | |
Qt::Key_PageDown | 0x01000017 | |
Qt::Key_Shift | 0x01000020 | |
Qt::Key_Control | 0x01000021 | On Mac OS X, this corresponds to the Command keys. |
Qt::Key_Meta | 0x01000022 | On Mac OS X, this corresponds to the Control keys. |
Qt::Key_Alt | 0x01000023 | |
Qt::Key_AltGr | 0x01001103 | |
Qt::Key_CapsLock | 0x01000024 | |
Qt::Key_NumLock | 0x01000025 | |
Qt::Key_ScrollLock | 0x01000026 | |
Qt::Key_F1 | 0x01000030 | |
Qt::Key_F2 | 0x01000031 | |
Qt::Key_F3 | 0x01000032 | |
Qt::Key_F4 | 0x01000033 | |
Qt::Key_F5 | 0x01000034 | |
Qt::Key_F6 | 0x01000035 | |
Qt::Key_F7 | 0x01000036 | |
Qt::Key_F8 | 0x01000037 | |
Qt::Key_F9 | 0x01000038 | |
Qt::Key_F10 | 0x01000039 | |
Qt::Key_F11 | 0x0100003a | |
Qt::Key_F12 | 0x0100003b | |
Qt::Key_F13 | 0x0100003c | |
Qt::Key_F14 | 0x0100003d | |
Qt::Key_F15 | 0x0100003e | |
Qt::Key_F16 | 0x0100003f | |
Qt::Key_F17 | 0x01000040 | |
Qt::Key_F18 | 0x01000041 | |
Qt::Key_F19 | 0x01000042 | |
Qt::Key_F20 | 0x01000043 | |
Qt::Key_F21 | 0x01000044 | |
Qt::Key_F22 | 0x01000045 | |
Qt::Key_F23 | 0x01000046 | |
Qt::Key_F24 | 0x01000047 | |
Qt::Key_F25 | 0x01000048 | |
Qt::Key_F26 | 0x01000049 | |
Qt::Key_F27 | 0x0100004a | |
Qt::Key_F28 | 0x0100004b | |
Qt::Key_F29 | 0x0100004c | |
Qt::Key_F30 | 0x0100004d | |
Qt::Key_F31 | 0x0100004e | |
Qt::Key_F32 | 0x0100004f | |
Qt::Key_F33 | 0x01000050 | |
Qt::Key_F34 | 0x01000051 | |
Qt::Key_F35 | 0x01000052 | |
Qt::Key_Super_L | 0x01000053 | |
Qt::Key_Super_R | 0x01000054 | |
Qt::Key_Menu | 0x01000055 | |
Qt::Key_Hyper_L | 0x01000056 | |
Qt::Key_Hyper_R | 0x01000057 | |
Qt::Key_Help | 0x01000058 | |
Qt::Key_Direction_L | 0x01000059 | |
Qt::Key_Direction_R | 0x01000060 | |
Qt::Key_Space | 0x20 | |
Qt::Key_Any | Key_Space | |
Qt::Key_Exclam | 0x21 | |
Qt::Key_QuoteDbl | 0x22 | |
Qt::Key_NumberSign | 0x23 | |
Qt::Key_Dollar | 0x24 | |
Qt::Key_Percent | 0x25 | |
Qt::Key_Ampersand | 0x26 | |
Qt::Key_Apostrophe | 0x27 | |
Qt::Key_ParenLeft | 0x28 | |
Qt::Key_ParenRight | 0x29 | |
Qt::Key_Asterisk | 0x2a | |
Qt::Key_Plus | 0x2b | |
Qt::Key_Comma | 0x2c | |
Qt::Key_Minus | 0x2d | |
Qt::Key_Period | 0x2e | |
Qt::Key_Slash | 0x2f | |
Qt::Key_0 | 0x30 | |
Qt::Key_1 | 0x31 | |
Qt::Key_2 | 0x32 | |
Qt::Key_3 | 0x33 | |
Qt::Key_4 | 0x34 | |
Qt::Key_5 | 0x35 | |
Qt::Key_6 | 0x36 | |
Qt::Key_7 | 0x37 | |
Qt::Key_8 | 0x38 | |
Qt::Key_9 | 0x39 | |
Qt::Key_Colon | 0x3a | |
Qt::Key_Semicolon | 0x3b | |
Qt::Key_Less | 0x3c | |
Qt::Key_Equal | 0x3d | |
Qt::Key_Greater | 0x3e | |
Qt::Key_Question | 0x3f | |
Qt::Key_At | 0x40 | |
Qt::Key_A | 0x41 | |
Qt::Key_B | 0x42 | |
Qt::Key_C | 0x43 | |
Qt::Key_D | 0x44 | |
Qt::Key_E | 0x45 | |
Qt::Key_F | 0x46 | |
Qt::Key_G | 0x47 | |
Qt::Key_H | 0x48 | |
Qt::Key_I | 0x49 | |
Qt::Key_J | 0x4a | |
Qt::Key_K | 0x4b | |
Qt::Key_L | 0x4c | |
Qt::Key_M | 0x4d | |
Qt::Key_N | 0x4e | |
Qt::Key_O | 0x4f | |
Qt::Key_P | 0x50 | |
Qt::Key_Q | 0x51 | |
Qt::Key_R | 0x52 | |
Qt::Key_S | 0x53 | |
Qt::Key_T | 0x54 | |
Qt::Key_U | 0x55 | |
Qt::Key_V | 0x56 | |
Qt::Key_W | 0x57 | |
Qt::Key_X | 0x58 | |
Qt::Key_Y | 0x59 | |
Qt::Key_Z | 0x5a | |
Qt::Key_BracketLeft | 0x5b | |
Qt::Key_Backslash | 0x5c | |
Qt::Key_BracketRight | 0x5d | |
Qt::Key_AsciiCircum | 0x5e | |
Qt::Key_Underscore | 0x5f | |
Qt::Key_QuoteLeft | 0x60 | |
Qt::Key_BraceLeft | 0x7b | |
Qt::Key_Bar | 0x7c | |
Qt::Key_BraceRight | 0x7d | |
Qt::Key_AsciiTilde | 0x7e | |
Qt::Key_nobreakspace | 0x0a0 | |
Qt::Key_exclamdown | 0x0a1 | |
Qt::Key_cent | 0x0a2 | |
Qt::Key_sterling | 0x0a3 | |
Qt::Key_currency | 0x0a4 | |
Qt::Key_yen | 0x0a5 | |
Qt::Key_brokenbar | 0x0a6 | |
Qt::Key_section | 0x0a7 | |
Qt::Key_diaeresis | 0x0a8 | |
Qt::Key_copyright | 0x0a9 | |
Qt::Key_ordfeminine | 0x0aa | |
Qt::Key_guillemotleft | 0x0ab | |
Qt::Key_notsign | 0x0ac | |
Qt::Key_hyphen | 0x0ad | |
Qt::Key_registered | 0x0ae | |
Qt::Key_macron | 0x0af | |
Qt::Key_degree | 0x0b0 | |
Qt::Key_plusminus | 0x0b1 | |
Qt::Key_twosuperior | 0x0b2 | |
Qt::Key_threesuperior | 0x0b3 | |
Qt::Key_acute | 0x0b4 | |
Qt::Key_mu | 0x0b5 | |
Qt::Key_paragraph | 0x0b6 | |
Qt::Key_periodcentered | 0x0b7 | |
Qt::Key_cedilla | 0x0b8 | |
Qt::Key_onesuperior | 0x0b9 | |
Qt::Key_masculine | 0x0ba | |
Qt::Key_guillemotright | 0x0bb | |
Qt::Key_onequarter | 0x0bc | |
Qt::Key_onehalf | 0x0bd | |
Qt::Key_threequarters | 0x0be | |
Qt::Key_questiondown | 0x0bf | |
Qt::Key_Agrave | 0x0c0 | |
Qt::Key_Aacute | 0x0c1 | |
Qt::Key_Acircumflex | 0x0c2 | |
Qt::Key_Atilde | 0x0c3 | |
Qt::Key_Adiaeresis | 0x0c4 | |
Qt::Key_Aring | 0x0c5 | |
Qt::Key_AE | 0x0c6 | |
Qt::Key_Ccedilla | 0x0c7 | |
Qt::Key_Egrave | 0x0c8 | |
Qt::Key_Eacute | 0x0c9 | |
Qt::Key_Ecircumflex | 0x0ca | |
Qt::Key_Ediaeresis | 0x0cb | |
Qt::Key_Igrave | 0x0cc | |
Qt::Key_Iacute | 0x0cd | |
Qt::Key_Icircumflex | 0x0ce | |
Qt::Key_Idiaeresis | 0x0cf | |
Qt::Key_ETH | 0x0d0 | |
Qt::Key_Ntilde | 0x0d1 | |
Qt::Key_Ograve | 0x0d2 | |
Qt::Key_Oacute | 0x0d3 | |
Qt::Key_Ocircumflex | 0x0d4 | |
Qt::Key_Otilde | 0x0d5 | |
Qt::Key_Odiaeresis | 0x0d6 | |
Qt::Key_multiply | 0x0d7 | |
Qt::Key_Ooblique | 0x0d8 | |
Qt::Key_Ugrave | 0x0d9 | |
Qt::Key_Uacute | 0x0da | |
Qt::Key_Ucircumflex | 0x0db | |
Qt::Key_Udiaeresis | 0x0dc | |
Qt::Key_Yacute | 0x0dd | |
Qt::Key_THORN | 0x0de | |
Qt::Key_ssharp | 0x0df | |
Qt::Key_division | 0x0f7 | |
Qt::Key_ydiaeresis | 0x0ff | |
Qt::Key_Multi_key | 0x01001120 | |
Qt::Key_Codeinput | 0x01001137 | |
Qt::Key_SingleCandidate | 0x0100113c | |
Qt::Key_MultipleCandidate | 0x0100113d | |
Qt::Key_PreviousCandidate | 0x0100113e | |
Qt::Key_Mode_switch | 0x0100117e | |
Qt::Key_Kanji | 0x01001121 | |
Qt::Key_Muhenkan | 0x01001122 | |
Qt::Key_Henkan | 0x01001123 | |
Qt::Key_Romaji | 0x01001124 | |
Qt::Key_Hiragana | 0x01001125 | |
Qt::Key_Katakana | 0x01001126 | |
Qt::Key_Hiragana_Katakana | 0x01001127 | |
Qt::Key_Zenkaku | 0x01001128 | |
Qt::Key_Hankaku | 0x01001129 | |
Qt::Key_Zenkaku_Hankaku | 0x0100112a | |
Qt::Key_Touroku | 0x0100112b | |
Qt::Key_Massyo | 0x0100112c | |
Qt::Key_Kana_Lock | 0x0100112d | |
Qt::Key_Kana_Shift | 0x0100112e | |
Qt::Key_Eisu_Shift | 0x0100112f | |
Qt::Key_Eisu_toggle | 0x01001130 | |
Qt::Key_Hangul | 0x01001131 | |
Qt::Key_Hangul_Start | 0x01001132 | |
Qt::Key_Hangul_End | 0x01001133 | |
Qt::Key_Hangul_Hanja | 0x01001134 | |
Qt::Key_Hangul_Jamo | 0x01001135 | |
Qt::Key_Hangul_Romaja | 0x01001136 | |
Qt::Key_Hangul_Jeonja | 0x01001138 | |
Qt::Key_Hangul_Banja | 0x01001139 | |
Qt::Key_Hangul_PreHanja | 0x0100113a | |
Qt::Key_Hangul_PostHanja | 0x0100113b | |
Qt::Key_Hangul_Special | 0x0100113f | |
Qt::Key_Dead_Grave | 0x01001250 | |
Qt::Key_Dead_Acute | 0x01001251 | |
Qt::Key_Dead_Circumflex | 0x01001252 | |
Qt::Key_Dead_Tilde | 0x01001253 | |
Qt::Key_Dead_Macron | 0x01001254 | |
Qt::Key_Dead_Breve | 0x01001255 | |
Qt::Key_Dead_Abovedot | 0x01001256 | |
Qt::Key_Dead_Diaeresis | 0x01001257 | |
Qt::Key_Dead_Abovering | 0x01001258 | |
Qt::Key_Dead_Doubleacute | 0x01001259 | |
Qt::Key_Dead_Caron | 0x0100125a | |
Qt::Key_Dead_Cedilla | 0x0100125b | |
Qt::Key_Dead_Ogonek | 0x0100125c | |
Qt::Key_Dead_Iota | 0x0100125d | |
Qt::Key_Dead_Voiced_Sound | 0x0100125e | |
Qt::Key_Dead_Semivoiced_Sound | 0x0100125f | |
Qt::Key_Dead_Belowdot | 0x01001260 | |
Qt::Key_Dead_Hook | 0x01001261 | |
Qt::Key_Dead_Horn | 0x01001262 | |
Qt::Key_Back | 0x01000061 | |
Qt::Key_Forward | 0x01000062 | |
Qt::Key_Stop | 0x01000063 | |
Qt::Key_Refresh | 0x01000064 | |
Qt::Key_VolumeDown | 0x01000070 | |
Qt::Key_VolumeMute | 0x01000071 | |
Qt::Key_VolumeUp | 0x01000072 | |
Qt::Key_BassBoost | 0x01000073 | |
Qt::Key_BassUp | 0x01000074 | |
Qt::Key_BassDown | 0x01000075 | |
Qt::Key_TrebleUp | 0x01000076 | |
Qt::Key_TrebleDown | 0x01000077 | |
Qt::Key_MediaPlay | 0x01000080 | |
Qt::Key_MediaStop | 0x01000081 | |
Qt::Key_MediaPrevious | 0x01000082 | |
Qt::Key_MediaNext | 0x01000083 | |
Qt::Key_MediaRecord | 0x01000084 | |
Qt::Key_HomePage | 0x01000090 | |
Qt::Key_Favorites | 0x01000091 | |
Qt::Key_Search | 0x01000092 | |
Qt::Key_Standby | 0x01000093 | |
Qt::Key_OpenUrl | 0x01000094 | |
Qt::Key_LaunchMail | 0x010000a0 | |
Qt::Key_LaunchMedia | 0x010000a1 | |
Qt::Key_Launch0 | 0x010000a2 | |
Qt::Key_Launch1 | 0x010000a3 | |
Qt::Key_Launch2 | 0x010000a4 | |
Qt::Key_Launch3 | 0x010000a5 | |
Qt::Key_Launch4 | 0x010000a6 | |
Qt::Key_Launch5 | 0x010000a7 | |
Qt::Key_Launch6 | 0x010000a8 | |
Qt::Key_Launch7 | 0x010000a9 | |
Qt::Key_Launch8 | 0x010000aa | |
Qt::Key_Launch9 | 0x010000ab | |
Qt::Key_LaunchA | 0x010000ac | |
Qt::Key_LaunchB | 0x010000ad | |
Qt::Key_LaunchC | 0x010000ae | |
Qt::Key_LaunchD | 0x010000af | |
Qt::Key_LaunchE | 0x010000b0 | |
Qt::Key_LaunchF | 0x010000b1 | |
Qt::Key_MediaLast | 0x0100ffff | |
Qt::Key_unknown | 0x01ffffff | |
Qt::Key_Call | 0x01100004 | |
Qt::Key_Context1 | 0x01100000 | |
Qt::Key_Context2 | 0x01100001 | |
Qt::Key_Context3 | 0x01100002 | |
Qt::Key_Context4 | 0x01100003 | |
Qt::Key_Flip | 0x01100006 | |
Qt::Key_Hangup | 0x01100005 | |
Qt::Key_No | 0x01010002 | |
Qt::Key_Select | 0x01010000 | |
Qt::Key_Yes | 0x01010001 | |
Qt::Key_Execute | 0x01020003 | |
Qt::Key_Printer | 0x01020002 | |
Qt::Key_Play | 0x01020005 | |
Qt::Key_Sleep | 0x01020004 | |
Qt::Key_Zoom | 0x01020006 | |
Qt::Key_Cancel | 0x01020001 |
See also QKeyEvent::key