Use existing Qt functionality to get cursor position

Might resolve issues with cursor position detection on non-X windows on
Linux
This commit is contained in:
WarmUpTill
2022-11-27 12:43:49 +01:00
committed by WarmUpTill
parent cc3ce3f0e0
commit 05fce566f4
6 changed files with 8 additions and 46 deletions

View File

@@ -15,6 +15,7 @@
#include <QJsonDocument>
#include <QSystemTrayIcon>
#include <QGuiApplication>
#include <QCursor>
#include <unordered_map>
#include <regex>
#include <set>
@@ -980,3 +981,9 @@ int findIdxInRagne(QComboBox *list, int start, int stop,
}
return foundIdx;
}
std::pair<int, int> getCursorPos()
{
auto cursorPos = QCursor::pos();
return {cursorPos.x(), cursorPos.y()};
}

View File

@@ -88,3 +88,4 @@ void addSelectionGroup(QComboBox *selection, const QStringList &group,
bool addSeparator = true);
int findIdxInRagne(QComboBox *list, int start, int stop,
const std::string &value);
std::pair<int, int> getCursorPos();