資源簡介
Qt之密碼框不可選中、復制、粘貼無右鍵菜單等,多種實現(xiàn)方式!

代碼片段和文件信息
#include?“event_filter.h“
#include?
#include?
#include?
EventFilter::EventFilter(Qobject?*parent)
????:?Qobject(parent)
{
}
EventFilter::~EventFilter()
{
}
bool?EventFilter::eventFilter(Qobject?*obj?QEvent?*event)
{
????QLineEdit?*pLineEdit?=?qobject_cast(obj);
????if?(pLineEdit?!=?NULL)
????{
????????switch?(event->type())
????????{
????????case?QEvent::MouseMove:
????????case?QEvent::MouseButtondblclick:
????????????return?true;
????????case?QEvent::KeyPress:
????????{
????????????QKeyEvent?*pKeyEvent?=?static_cast(event);
????????????if(pKeyEvent->matches(QKeySequence::SelectAll)
????????????????????||?pKeyEvent->matches(QKeySequence::Copy)
????????????????????||?pKeyEvent->matches(QKeySequence::Paste))
????????????{
????????????????return?true;
????????????}
????????}
????????}
????}
????return?Qobject::eventFilter(obj?event);
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-12-18?15:08??PasswordLineEdit\
?????文件?????????456??2015-12-18?10:51??PasswordLineEdit\PasswordLineEdit.pro
?????文件?????????949??2015-12-18?14:38??PasswordLineEdit\event_filter.cpp
?????文件?????????291??2015-12-18?10:53??PasswordLineEdit\event_filter.h
?????文件?????????175??2015-12-18?10:19??PasswordLineEdit\main.cpp
?????文件????????1090??2015-12-18?15:03??PasswordLineEdit\password_line_edit.cpp
?????文件?????????450??2015-12-18?13:56??PasswordLineEdit\password_line_edit.h
?????文件????????1603??2015-12-18?15:08??PasswordLineEdit\widget.cpp
?????文件?????????195??2015-12-18?10:19??PasswordLineEdit\widget.h
- 上一篇:TranslateLanguage
- 下一篇:SecrchLineEdit
評論
共有 條評論