mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-13 22:54:47 -04:00
UEFITool 0.18.7
- EFI11/Tiano compression code reverted back to 0.17.x implementation because of higher compression ratio - delete and backspace work properly for GUID search field
This commit is contained in:
parent
41448ea49f
commit
754f9c5b13
7 changed files with 1863 additions and 1377 deletions
61
guidlineedit.cpp
Normal file
61
guidlineedit.cpp
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* guidlineedit.cpp
|
||||
|
||||
Copyright (c) 2014, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
|
||||
#include "guidlineedit.h"
|
||||
|
||||
GuidLineEdit::GuidLineEdit(QWidget * parent)
|
||||
:QLineEdit(parent)
|
||||
{
|
||||
}
|
||||
|
||||
GuidLineEdit::GuidLineEdit(const QString & contents, QWidget * parent)
|
||||
:QLineEdit(contents, parent)
|
||||
{
|
||||
}
|
||||
|
||||
GuidLineEdit::~GuidLineEdit()
|
||||
{
|
||||
}
|
||||
|
||||
void GuidLineEdit::keyPressEvent(QKeyEvent * event)
|
||||
{
|
||||
if (event == QKeySequence::Delete || event->key() == Qt::Key_Backspace)
|
||||
{
|
||||
int pos = cursorPosition();
|
||||
if (event->key() == Qt::Key_Backspace && pos > 0) {
|
||||
cursorBackward(false);
|
||||
pos = cursorPosition();
|
||||
}
|
||||
|
||||
QString txt = text();
|
||||
QString selected = selectedText();
|
||||
|
||||
if (!selected.isEmpty()) {
|
||||
pos = QLineEdit::selectionStart();
|
||||
for (int i = pos; i < pos + selected.count(); i++)
|
||||
if (txt[i] != QChar('-'))
|
||||
txt[i] = QChar('.');
|
||||
}
|
||||
else
|
||||
txt[pos] = QChar('.');
|
||||
|
||||
setCursorPosition(0);
|
||||
insert(txt);
|
||||
setCursorPosition(pos);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Call original event handler
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue