Qt - Reddit – Telegram
Qt - Reddit
14 subscribers
241 photos
30 videos
4.05K links
News and discussion for the Qt Framework.

Subreddit: https://www.reddit.com/r/QtFramework

Powered by : @r_channels & @reddit2telegram
Download Telegram
real geographic map via MapLibre, the effect is striking: a navigable labyrinth superimposed on actual terrain.

# Bidirectional A* for Efficient Pathfinding

While standard A\* search efficiently finds optimal paths by expanding nodes in order of f(n) = g(n) + h(n), Bidirectional A\* can dramatically reduce search space by simultaneously searching from both start and goal. The two search frontiers meet somewhere in the middle, ideally requiring each to explore only half the nodes that unidirectional search would examine.

The key challenge in Bidirectional A\* is determining termination and path extraction. The algorithm cannot simply stop when the two frontiers first meet, as this meeting point might not lie on the optimal path. Instead, we must continue until we can prove no better path exists.

For hexagonal grids, the heuristic function uses the H3 grid distance, which counts the minimum number of cells between two points:

int64_t hexDistance(H3Index a, H3Index b) {
int64_t distance;
gridDistance(a, b, &distance);
return distance;
}

double heuristic(H3Index current, H3Index goal) {
return static_cast<double>(hexDistance(current, goal));
}


The bidirectional search maintains two open sets and two closed sets:

struct SearchState {
std::priority_queue<Node, std::vector<Node>, NodeComparator> openSet;
std::unordered_map<H3Index, double> gScore;
std::unordered_map<H3Index, H3Index> cameFrom;
};

std::vector<H3Index> bidirectionalAStar(H3Index start, H3Index goal,
const MazeGraph& maze) {
SearchState forward, backward;

forward.openSet.push({start, 0, heuristic(start, goal)});
forward.gScore[start] = 0;

backward.openSet.push({goal, 0, heuristic(goal, start)});
backward.gScore[goal] = 0;

double bestPathLength = std::numeric_limits<double>::infinity();
H3Index meetingPoint = 0;

while (!forward.openSet.empty() && !backward.openSet.empty()) {
// Expand from the direction with smaller minimum f-value
if (forward.openSet.top().f <= backward.openSet.top().f) {
expandNode(forward, backward, goal, maze, bestPathLength, meetingPoint);
} else {
expandNode(backward, forward, start, maze, bestPathLength, meetingPoint);
}

// Termination check
if (forward.openSet.top().f + backward.openSet.top().f >= bestPathLength) {
break;
}
}

return reconstructPath(forward, backward, meetingPoint);
}


This bidirectional approach is particularly effective for maze navigation where the optimal path might wind through many cells. By searching from both ends, we exploit the symmetry of the problem and often find the meeting point quickly.

# Multi-Waypoint Routing: Extending Beyond Point-to-Point

Real-world navigation rarely involves simple point-to-point journeys. qHexWalker extends its pathfinding capabilities to handle multiple waypoints, finding efficient routes that visit all specified locations. This transforms the problem into a variant of the Traveling Salesman Problem (TSP), which we solve using a combination of precomputed pairwise distances and heuristic optimization.

The implementation first computes optimal paths between all pairs of waypoints using our Bidirectional A\* implementation. These distances form a complete graph where waypoint ordering can be optimized. For small numbers of waypoints (typical in interactive applications), a greedy nearest-neighbor approach with 2-opt improvement produces good results quickly:

std::vector<int> optimizeWaypointOrder(const std::vector<std::vector<double>>& distances) {
int n = distances.size();
std::vector<int> tour = nearestNeighborTour(distances);

bool improved = true;
while (improved) {
improved = false;
for
(int i = 0; i < n - 1; ++i) {
for (int j = i + 2; j < n; ++j) {
double delta = distances[tour[i]][tour[j]] +
distances[tour[i+1]][tour[(j+1) % n]] -
distances[tour[i]][tour[i+1]] -
distances[tour[j]][tour[(j+1) % n]];
if (delta < -1e-9) {
std::reverse(tour.begin() + i + 1, tour.begin() + j + 1);
improved = true;
}
}
}
}

return tour;
}


The final route is assembled by concatenating the precomputed paths between consecutive waypoints in the optimized order, providing a complete navigation solution through the hexagonal maze.

# Real-Time Visualization with Qt 6 and MapLibre

Bringing algorithmic computation to life requires effective visualization. qHexWalker leverages Qt 6's QML capabilities alongside MapLibre Native Qt to render hexagonal cells and paths on interactive vector maps.

MapLibre provides the mapping foundation, rendering OpenStreetMap-style tiles with smooth pan, zoom, and rotation. The Qt integration through `QMapLibre::Location` allows seamless embedding of the map view in QML interfaces:

import QtQuick
import QtLocation
import QtPositioning
import MapLibre 3.0

MapView {
id: mapView
anchors.fill: parent

map.plugin: Plugin {
name: "maplibre"
PluginParameter {
name: "maplibre.map.styles"
value: "https://demotiles.maplibre.org/style.json"
}
}

map.center: QtPositioning.coordinate(55.751244, 37.618423)
map.zoomLevel: 14
}


Hexagonal cells from H3 are rendered as GeoJSON polygons. The cell boundary retrieval and conversion to Qt coordinate types happens in C++, exposed to QML through Qt's property system:

QVariantList HexGridModel::getCellBoundary(qint64 cellIndex) const {
CellBoundary boundary;
H3Index h3Index = static_cast<H3Index>(cellIndex);
cellToBoundary(h3Index, &boundary);

QVariantList coordinates;
for (int i = 0; i < boundary.numVerts; ++i) {
QVariantMap point;
point["latitude"] = radsToDegs(boundary.verts[i].lat);
point["longitude"] = radsToDegs(boundary.verts[i].lng);
coordinates.append(point);
}

return coordinates;
}


Animation of pathfinding progress uses Qt's timer mechanism to progressively reveal explored cells, creating engaging visualizations that help users understand algorithmic behavior. The search frontier expansion, meeting point discovery, and final path extraction all become visible stages in the visualization.

# Conclusion

qHexWalker demonstrates the power of combining modern geospatial libraries with classical algorithms. The synergy between H3's hierarchical hexagonal indexing, Randomized Prim's maze generation, and Bidirectional A\* pathfinding creates an application that is both technically sophisticated and visually compelling.

The choice of Qt 6 with QML provides a clean separation between algorithmic C++ code and declarative user interface definitions. MapLibre's open-source mapping capabilities ensure the application works without proprietary dependencies, while vcpkg simplifies cross-platform dependency management.

For developers interested in geospatial computing, game development, or algorithmic visualization, the techniques presented here offer a foundation for building sophisticated location-aware applications. The hexagonal grid paradigm, while requiring more initial investment than square grids, pays dividends in path quality and computational efficiency.

# Call to Action

Ready to explore hexagonal pathfinding yourself? The complete qHexWalker source code is available on GitHub at [https://github.com/wecand0/qHexWalker](https://github.com/wecand0/qHexWalker). The project welcomes
contributions, whether you're interested in adding new maze generation algorithms, optimizing pathfinding performance, or extending the visualization capabilities.

To get started, clone the repository and follow the build instructions in the README. You'll need Qt 6.5+, vcpkg for dependency management, and MapLibre Native Qt installed on your system. The project supports Linux, macOS, and Windows, making it accessible to developers across platforms.

Have questions or ideas? Open an issue on GitHub or submit a pull request. Together, we can push the boundaries of what's possible with hexagonal geospatial computing.

https://redd.it/1pw9rdx
@qt_reddit
new to this and im having an issue (first time) Arch linux-KDE Plasma (if that matters)

So im trying to open an app that used the "xcb" program plug in but when i check the system logs it says that it can find xcb but not initialize? these are all the qt packages (from pacman) that i have installed. i can look at the logs if you need more info at any time.

qt6-base

qt6

xcb-util-cursor

polkit-qt6

qt6-noscript

qt6-declarative

xcb-util

https://redd.it/1pwil9k
@qt_reddit
Delayed response to mouse pad clicks

I'm noticing a delayed response to clicks in my QML application when using the track pad, whether its on a button, text field, list item, etc. However, the problem does not apply when using the mouse button, or in other applications using the track pad, so I don't think it's related to my OS settings.

Has anyone else encountered similar?

I'm running Windows 11.

https://redd.it/1pwn135
@qt_reddit
Discover What Qt Learning Achieved in 2025 and How to Learn Qt in 2026
https://redd.it/1pylj0d
@qt_reddit
G-Pilot G-Code Sender - looking for help

Main window

Main window - light mode

Hi. I’m working on a G-Pilot G-Code Sender application (early stage project). It is a GRBL controller app with a G-code visualizer. It’s written in Qt 6.8.

The app can:

load, edit, save and send g-code to your machine,
visualise the toolpath,
control a GRBL-based machine via console and UI buttons,
show machine state,
support joystick / controller input,
run in virtual mode without real hardware.

Right now it’s very early stage and I’m looking for anyone who wants to help with development, ideas, testing or contributions.

https://github.com/etet100/G-Pilot-GCode-Sender

https://redd.it/1pzqq6k
@qt_reddit
onCurrentItemChanged is not called when proxy model is sorted

onCurrentItemChanged isn't being called on my ListView when the proxy model is sorted. As such, it is becoming very difficult for me to track the currently selected item. Is there an acceptable workaround?

https://redd.it/1pzz5tl
@qt_reddit
Why is installation this slow

https://preview.redd.it/n1421x6pnwag1.png?width=1624&format=png&auto=webp&s=753b7de534898529be7e62b0a67449879644dade

I have tried changing mirrors but to no luck
this is only really happening when I try to install CDB debugger and debug symbols
other times its fine

https://redd.it/1q1ucer
@qt_reddit
Very confused with setting up lsp for QML in Neovim

Hello! I apologize if that is a silly question, but I've tried to search on this sub and elsewhere and I am still very confused. I can not get my QML LSP work fully in Neovim. I posted it in Neovim sub, but maybe people here know what my problem is. Hope it is OK.

I have tried different methods, recently got Lazyvim hoping it would be easier to set up it there. But there is so much information on how to set this stuff up and they are all different and I am honestly lost. Regardless, in every case, I do not manage to get definitions working. I get warnings or notifications of unused imports, and basic autocompletion even, but not definitions

Also, regardless if I try via mason or the sever installed with qt6 locally, and in general in every way i tried, in lspInfo it says
-version ? (no serverInfo.version response)
- root directory: nil

I do have language server installed, I checked - it is recognized by nvim, I have .qmlls.ini file in my project directory.

>.qmlls.ini
[General]
no-cmake-calls=true
buildDir="/run/user/1000/quickshell/vfs/7f02b536a7df0cbbf1960731c71d372b"
importPaths="/usr/bin:/usr/lib/qt6/qml"

Bellow, on the screenshots, there is one of my setups via config/lsp.lua.

Later I installed LazyDistro for nvim, hoping it would be simpler, but it ended up even more confusing, and if in the beginning, I understood what I was doing, now I am completely lost and confused already. I am not a programmer, just want to do some stuff as a hobby and I really love vim for everything but this lsp is a pain.
Maybe, if it is some silly stuipid mistake, can anybody just tell me what to do exactly or what to follow? I am just desperate already, please help

init.lua

config\/lsp.lua

checkhealth lsp

https://redd.it/1q20wes
@qt_reddit
qTbot - qt library for working with Telegram bots.

Hey, guys! How are you enjoying 2026? The air has gotten cleaner, no not... oh well. 😁

A few years ago, I wrote a library for building chatbots using Qt. Currently, I have several Telegram bots running on it, and they've been working quite stably. So, I think it's ready to be used beyond just my own projects.

I'm leaving the GitHub link here. The library is built on the principle of a unified interface — essentially, you can implement any other platform, like Facebook or others. If you like the idea, feel free to join in, use it, or help with development!

https://redd.it/1q280cv
@qt_reddit
KodoTerm - a terminal widget for QT6

I was looking for a good terminal widget for Qt, and so far I only found https://github.com/lxqt/qtermwidget \- but: no windows support, and as a project it is licensed under the GPLv2.

So, I wrote my own.

This widget is based on the same code that QtCreator uses internally - [libvterm](https://github.com/neovim/libvterm/commits/nvim/).
The build system will be a statically link a libterm version internally - so consuming this library should be "easy" using CMake (its cloned using FetchContent_Declare so no extra steps are needed from your point of view).
It is [MIT ](https://github.com/diegoiast/KodoTerm/blob/main/LICENSE)licensed. All code is new - not copied from other projects.
Works on Windows and Linux. I can actually use PowerShell, cmd and bash.exe on the same Window (kinda bonkers...).

Code is quite "new", its only 3-4 days old... so use with cause. I am using it as my main terminal on Windows, so it is usable. On Linux its even better, as drawing is not as slow. I know it compiles on macOS, but I have not tested it. I assume *BSD will work, but again, untested and github provides no runners - so I cannot compile it on the CICD.

Pull requests are welcomed. Missing features are welcomed.

KodoShell - example of a full blown terminal emulator based on KodoTerm running on Windows 11

PS: native Windows theme Qt6 provides is borderline unusable, everything is too "white" and washed out. I wish something better existed.

https://redd.it/1q2ba9s
@qt_reddit
Which tech stack should I choose to build a full-fledged billing app?



Hey everyone 👋

I’m planning to build a full-fledged desktop billing/invoicing application (think inventory, invoices, GST/VAT, reports, maybe offline support, etc.), and I’m a bit confused about which technology/stack would be the best long-term choice.

I’ve come across several options so far:

ElectronJS

Tauri

.NET (WPF / WinUI / MAUI)

PySide6

PyQt6

(open to other suggestions too)

What I’m mainly concerned about:

Performance & resource usage

Cross-platform support (Windows/Linux/macOS)

Ease of maintenance & scalability

UI/UX flexibility

Long-term viability for a commercial product

If you’ve built something similar or have experience with these stacks:

Which one would you recommend and why?

Any pitfalls I should be aware of?

Would you choose differently for a solo developer?

Thanks in advance! really appreciate any guidance or real-world experiences 🙏


https://redd.it/1q2oxhs
@qt_reddit