ToolBar shortcuts only work when i move the TooBbar out of any dock site
-
When I move the toolbar so that it floats in the window, the shortcuts work, but as soon as I dock it anywhere they stop working.
This odd behaviour only occur on WebAssembly, on Desktop it works as intended.Maybe could I make my graphicView able to accept the ToolBar as its dock site ? How could I achieve that ? For the moment my code is very basic, it's a standard Qt 6.8 Desktop C++ project (I'm on Windows 11 and use latest Qt Creator version with MSVC and WebAssembly). It does the same on WAsm single thread and multi thread and with or without Asyncify.
At least, as it doesn't seem possible to dock a ToolBar to anything else than its MainWindow borders, is there a way to make this ToolBar undocked or will the user need to undock it at each start ? I'm looking at QToolBar doc and don't see anything that could do so. During my investigation about this problem, I managed to create toolbars for my GraphicViews by putting them into vertical layouts and adding the ToolBars into the MainWindow constructor, maybe such a design would work (during my tests it didn't but I suspect that I did something wrong with the project then using design editor).
Apparently my usecase / problem is not inspiring, but even if those posts get no help at all, I hope they could first help me find ways to resolve them, and later help others who could have the same problem.
I just tried to add the ToolBar to my GraphicView layout, but then, the shortcut doesn't work and as it is impossible to undock the ToolBar, I cannot test that. I found a way to make the keyboard shortcuts respond, for that I need to click on the GraphicView then press TAB key, and the keyboard shortcut work, but if I leave the mouse cursor on a toolbutton and it activate its tooltip, the keyboard shortcuts don't work and I need to press TAB again to make them work. Does someone have any idea ? Can I reliably conclude that it's a bug ? How do others users of Qt Web Assembly cope with their design concerning keyboard shortcuts ?
-
Well, I got rid of the MainWindow MenuBar and replaced it by a ToolBar with icons, and now when the WAsm application starts, after a model is loaded, keyboard shortcut immediately work. The problem when tooltips are shown is still there but it's only annoying. I must find self explanatory icons but it's only what is called a "hobby" application so it's no big deal.
-
I amost got it, now I only need to press TAB after I clicked on a new color to be able to use keyboard shortcuts to rotate my 3d model. It breaks the working flow, but is usable. I'm using code (on the cellpress event handler of my TableWidget) to try to give the focus to my GraphicsView, but on WASM it doesn't seem to do anything. To be able to have the selected row showing the row color instead of its negative, I needed to add a label widget and add it to the first cell of the row, I added noTextInteraction to its TextInteractionFlags otherwise it has the focus when I click on it and handle keystrokes. Is there anything I can do ? is it possible to send a TAB keystroke at the end of my code so that the user doesn't need to do it ?
ui->tableCouleurs->releaseKeyboard(); ui->vue3d->setFocus(Qt::OtherFocusReason);