diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2021-02-19 19:25:53 -0500 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2021-03-16 20:40:13 -0400 |
| commit | e43222c3e8da9f42d0d95207fa94335165a27d9d (patch) | |
| tree | e8f64b54dafd7c75f48c95bd7c7e62fed0c904a2 /examples | |
| parent | a327eb06173d0aa814460842e5280a6bf1edddf1 (diff) | |
Compatibility with Qt 6
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/triage/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | examples/triage/byte.cpp | 8 | ||||
| -rw-r--r-- | examples/triage/entropy.cpp | 2 | ||||
| -rw-r--r-- | examples/triage/exports.cpp | 2 | ||||
| -rw-r--r-- | examples/triage/files.h | 4 | ||||
| -rw-r--r-- | examples/triage/imports.cpp | 2 | ||||
| -rw-r--r-- | examples/uinotification/CMakeLists.txt | 22 |
7 files changed, 34 insertions, 12 deletions
diff --git a/examples/triage/CMakeLists.txt b/examples/triage/CMakeLists.txt index 4b55bc8f..05dd03ce 100644 --- a/examples/triage/CMakeLists.txt +++ b/examples/triage/CMakeLists.txt @@ -1,8 +1,12 @@ cmake_minimum_required(VERSION 3.9 FATAL_ERROR) +option(QT6 "Target Qt 6" OFF) + project(triage) -set(CMAKE_OSX_ARCHITECTURES x86_64) +if(NOT QT6) + set(CMAKE_OSX_ARCHITECTURES x86_64) +endif() file(GLOB SOURCES *.cpp diff --git a/examples/triage/byte.cpp b/examples/triage/byte.cpp index 58835ed7..c3a91372 100644 --- a/examples/triage/byte.cpp +++ b/examples/triage/byte.cpp @@ -1064,8 +1064,8 @@ void ByteView::mousePressEvent(QMouseEvent* event) { if (event->button() != Qt::LeftButton) return; - int x = (event->x() - 2) / m_render.getFontWidth() - ((int)m_addrWidth + 2); - int y = (event->y() - 2) / m_render.getFontHeight(); + int x = (event->pos().x() - 2) / m_render.getFontWidth() - ((int)m_addrWidth + 2); + int y = (event->pos().y() - 2) / m_render.getFontHeight(); m_lastMouseX = x; m_lastMouseY = y; m_cursorAddr = addressFromLocation(x, y); @@ -1081,8 +1081,8 @@ void ByteView::mouseMoveEvent(QMouseEvent* event) { if (event->buttons() != Qt::LeftButton) return; - int x = (event->x() - 2) / m_render.getFontWidth() - ((int)m_addrWidth + 2); - int y = (event->y() - 2) / m_render.getFontHeight(); + int x = (event->pos().x() - 2) / m_render.getFontWidth() - ((int)m_addrWidth + 2); + int y = (event->pos().y() - 2) / m_render.getFontHeight(); if ((x == m_lastMouseX) && (y == m_lastMouseY)) return; m_lastMouseX = x; diff --git a/examples/triage/entropy.cpp b/examples/triage/entropy.cpp index 87849dcc..72ca0a92 100644 --- a/examples/triage/entropy.cpp +++ b/examples/triage/entropy.cpp @@ -111,7 +111,7 @@ void EntropyWidget::mousePressEvent(QMouseEvent* event) { if (event->button() != Qt::LeftButton) return; - float frac = (float)event->x() / (float)rect().width(); + float frac = (float)event->pos().x() / (float)rect().width(); uint64_t offset = (uint64_t)(frac * m_width * m_blockSize); m_view->navigateToFileOffset(offset); } diff --git a/examples/triage/exports.cpp b/examples/triage/exports.cpp index 6d7a3de7..4ff46eec 100644 --- a/examples/triage/exports.cpp +++ b/examples/triage/exports.cpp @@ -247,7 +247,7 @@ void ExportsTreeView::closeFilter() void ExportsTreeView::keyPressEvent(QKeyEvent* event) { - if ((event->text().size() == 1) && (event->text()[0] > ' ') && (event->text()[0] < 127)) + if ((event->text().size() == 1) && (event->text()[0] > ' ') && (event->text()[0] <= '~')) { m_parent->showFilter(event->text()); event->accept(); diff --git a/examples/triage/files.h b/examples/triage/files.h index 6919c614..9874691c 100644 --- a/examples/triage/files.h +++ b/examples/triage/files.h @@ -2,7 +2,11 @@ #include <QtWidgets/QWidget> #include <QtWidgets/QTreeView> +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include <QtWidgets/QFileSystemModel> +#else +#include <QtGui/QFileSystemModel> +#endif #include "action.h" #include "menus.h" diff --git a/examples/triage/imports.cpp b/examples/triage/imports.cpp index 01e379f8..d15b2c40 100644 --- a/examples/triage/imports.cpp +++ b/examples/triage/imports.cpp @@ -273,7 +273,7 @@ void ImportsTreeView::closeFilter() void ImportsTreeView::keyPressEvent(QKeyEvent* event) { - if ((event->text().size() == 1) && (event->text()[0] > ' ') && (event->text()[0] < 127)) + if ((event->text().size() == 1) && (event->text()[0] > ' ') && (event->text()[0] <= '~')) { m_parent->showFilter(event->text()); event->accept(); diff --git a/examples/uinotification/CMakeLists.txt b/examples/uinotification/CMakeLists.txt index 9858dd68..df9bdbdc 100644 --- a/examples/uinotification/CMakeLists.txt +++ b/examples/uinotification/CMakeLists.txt @@ -1,18 +1,32 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) +option(QT6 "Target Qt 6" OFF) + project(uinotification) -set(CMAKE_OSX_ARCHITECTURES x86_64) +if(NOT QT6) + set(CMAKE_OSX_ARCHITECTURES x86_64) +endif() -find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) +if(QT6) + find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED) +else() + find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) +endif() file(GLOB SOURCES *.cpp *.h) add_library(uinotification SHARED ${SOURCES}) -target_link_libraries(uinotification binaryninjaapi binaryninjaui - Qt5::Core Qt5::Gui Qt5::Widgets) + +if(QT6) + target_link_libraries(uinotification binaryninjaapi binaryninjaui + Qt6::Core Qt6::Gui Qt6::Widgets) +else() + target_link_libraries(uinotification binaryninjaapi binaryninjaui + Qt5::Core Qt5::Gui Qt5::Widgets) +endif() set_target_properties(uinotification PROPERTIES CXX_STANDARD 17 |
