refactoring.

git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@284 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
This commit is contained in:
sinamas 2011-10-17 22:44:02 +00:00
parent 438aa67b7d
commit e44d196606

View File

@ -22,6 +22,7 @@
#include <QMenu>
#include <QContextMenuEvent>
#include <QKeyEvent>
#include <memory>
static const char* keyToString(int key) {
switch (key) {
@ -356,16 +357,13 @@ InputBox::InputBox(QWidget *nextFocus)
}
void InputBox::contextMenuEvent(QContextMenuEvent *event) {
QMenu *const menu = new QMenu(this);
const std::auto_ptr<QMenu> menu(new QMenu(this));
menu->addAction(tr("&Copy"), this, SLOT(copy()))->setEnabled(hasSelectedText());
menu->addSeparator();
menu->addAction(tr("&Select All"), this, SLOT(selectAll()))->setEnabled(!displayText().isEmpty());
menu->addSeparator();
menu->addAction(tr("C&lear"), this, SLOT(clearData()))->setEnabled(getData().value != NULL_VALUE);
menu->exec(event->globalPos());
delete menu;
}
void InputBox::focusInEvent(QFocusEvent *event) {