Qt text window search
Fix the strangeness where typing ':' in a menu window initiated the menu search operation but typing ':' in a text window saw the shift key be pressed but not the ';' that went with it, even though they both called the same key decoding routine. That made typing ':' to initiate text search be impossible. Menu windows did more input focus manipulation in their constructor. Mimicking that in text windows fixes the problem with keys not being seen by the text window's keystroke handler.
This commit is contained in:
+7
-10
@@ -999,6 +999,8 @@ NetHackQtTextWindow::NetHackQtTextWindow(QWidget *parent) :
|
|||||||
// we don't want keystrokes being sent to the main window for use as
|
// we don't want keystrokes being sent to the main window for use as
|
||||||
// commands while this text window is popped up
|
// commands while this text window is popped up
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
|
// needed so that keystrokes get sent to our keyPressEvent()
|
||||||
|
lines->setFocusPolicy(Qt::NoFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetHackQtTextWindow::doUpdate()
|
void NetHackQtTextWindow::doUpdate()
|
||||||
@@ -1183,11 +1185,12 @@ void NetHackQtTextWindow::Search()
|
|||||||
// Force text window to be on top. Without this, it moves behind
|
// Force text window to be on top. Without this, it moves behind
|
||||||
// the map after the string requestor completes. Then it can't
|
// the map after the string requestor completes. Then it can't
|
||||||
// be seen or accessed (unless the game window is minimized or
|
// be seen or accessed (unless the game window is minimized or
|
||||||
// possibly dragged out of the way). Unfortunately the window
|
// dragged out of the way). Unfortunately the window noticeably
|
||||||
// noticeably vanishes and then immediately gets redrawn.
|
// vanishes and then immediately gets redrawn.
|
||||||
if (!this->isActiveWindow())
|
if (!this->isActiveWindow()) {
|
||||||
this->activateWindow();
|
this->activateWindow();
|
||||||
this->raise();
|
this->raise();
|
||||||
|
}
|
||||||
|
|
||||||
if (get_a_line) {
|
if (get_a_line) {
|
||||||
int linecount = lines->count();
|
int linecount = lines->count();
|
||||||
@@ -1226,12 +1229,6 @@ void NetHackQtTextWindow::keyPressEvent(QKeyEvent *key_event)
|
|||||||
{
|
{
|
||||||
uchar key = keyValue(key_event);
|
uchar key = keyValue(key_event);
|
||||||
|
|
||||||
//
|
|
||||||
// FIXME:
|
|
||||||
// Typing ':' doesn't produce ':' so key won't match MENU_SEARCH,
|
|
||||||
// despite the fact that it does produce ':' for menu input and
|
|
||||||
// we're calling the exact same code for both types of window...?
|
|
||||||
//
|
|
||||||
if (key == MENU_SEARCH) {
|
if (key == MENU_SEARCH) {
|
||||||
if (!use_rip)
|
if (!use_rip)
|
||||||
Search();
|
Search();
|
||||||
|
|||||||
Reference in New Issue
Block a user