Skip to content

Commit 32c5c1f

Browse files
Fixed #355
1 parent d8ee8e5 commit 32c5c1f

File tree

3 files changed

+19
-28
lines changed

3 files changed

+19
-28
lines changed

qtgui/exe/src/DmsViewArea.cpp

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ LRESULT CALLBACK DataViewWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa
4141
SetWindowLongPtr(hWnd, 0, (LONG_PTR)view);
4242
}
4343
if (uMsg >= WM_KEYFIRST && uMsg <= WM_KEYLAST) {
44-
if (uMsg == WM_KEYDOWN && wParam == 'W')
45-
if (GetKeyState(VK_CONTROL) & 0x8000)
46-
if (not (GetKeyState(VK_SHIFT) & 0x8000))
47-
if (not (GetKeyState(VK_MENU) & 0x8000))
48-
wParam = VK_F4;
49-
5044
HWND parent = (HWND)GetWindowLongPtr(hWnd, GWLP_HWNDPARENT);
5145
if (parent)
5246
return SendMessage(parent, uMsg, wParam, lParam);
@@ -319,13 +313,11 @@ QDmsViewArea::~QDmsViewArea()
319313

320314
bool QDmsViewArea::nativeEvent(const QByteArray& eventType, void* message, qintptr* result)
321315
{
322-
if (auto main_window = MainWindow::TheOne())
323-
{
324-
if (auto mdi_area = main_window->m_mdi_area.get())
325-
{
326-
MSG* msg = static_cast<MSG*>(message);
327-
UInt32 received_message_type = msg->message;
328-
if (received_message_type == WM_QT_ACTIVATENOTIFIERS) {
316+
MSG* msg = static_cast<MSG*>(message);
317+
UInt32 received_message_type = msg->message;
318+
if (received_message_type == WM_QT_ACTIVATENOTIFIERS)
319+
if (auto main_window = MainWindow::TheOne())
320+
if (auto mdi_area = main_window->m_mdi_area.get())
329321
while (true) {
330322
auto current_active_subwindow = mdi_area->activeSubWindow();
331323
if (!current_active_subwindow)
@@ -336,9 +328,6 @@ bool QDmsViewArea::nativeEvent(const QByteArray& eventType, void* message, qintp
336328

337329
mdi_area->activateNextSubWindow();
338330
}
339-
}
340-
}
341-
}
342331
return false;
343332
}
344333

@@ -397,17 +386,6 @@ auto QDmsViewArea::contentsRectInPixelUnits()->QRect {
397386
return QRect(topLeft, botRight);
398387
}
399388

400-
void QDmsViewArea::keyPressEvent(QKeyEvent* keyEvent) {
401-
auto dv = getDataView();
402-
if (!dv)
403-
return;
404-
405-
if (keyEvent->key() == Qt::Key_W && keyEvent->modifiers() == Qt::ControlModifier)
406-
this->close();
407-
408-
QMdiSubWindow::keyPressEvent(keyEvent);
409-
}
410-
411389
void QDmsViewArea::UpdatePosAndSize() {
412390
auto rect = contentsRectInPixelUnits();
413391

qtgui/exe/src/DmsViewArea.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public slots:
6868
void resizeEvent(QResizeEvent* event) override;
6969
void paintEvent(QPaintEvent* event) override;
7070
auto contentsRectInPixelUnits() -> QRect;
71-
void keyPressEvent(QKeyEvent* keyEvent) override;
7271

7372
std::weak_ptr<DataView> m_DataView;
7473
void* m_DataViewHWnd = nullptr;

qtgui/exe/src/main_qt.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,20 @@ bool CustomEventFilter::nativeEventFilter(const QByteArray& /*eventType*/, void*
257257
}
258258
return true; // Stop further processing of the message
259259

260+
case WM_KEYDOWN:
261+
if (msg->wParam == 'W' || msg->wParam == VK_F4)
262+
if (GetKeyState(VK_CONTROL) & 0x8000)
263+
if (not (GetKeyState(VK_SHIFT) & 0x8000))
264+
if (not (GetKeyState(VK_MENU) & 0x8000))
265+
if (auto main_window = MainWindow::TheOne())
266+
if (auto mdi_area = main_window->m_mdi_area.get())
267+
if (auto current_active_subwindow = mdi_area->activeSubWindow())
268+
{
269+
current_active_subwindow->close();
270+
return true;
271+
}
272+
break;
273+
260274
case UM_PROCESS_MAINTHREAD_OPERS:
261275
if (auto mw = MainWindow::TheOne())
262276
mw->ProcessAppOpers();

0 commit comments

Comments
 (0)