Toolbar drag handles disabled depending on Qt theme

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
trallafitti
Posts: 5
Joined: Fri May 07, 2021 4:01 pm

Toolbar drag handles disabled depending on Qt theme

Post by trallafitti »

Hi there,
I would have written this as a bug report, but maybe there is something I am missing, so I'm writing here first.
Depending on the Qt theme I use, the toolbars do not have drag handles, so I cannot adjust the workspace layout.
I first suspected this might be caused by the Kvantum Qt theme engine I use, but as far as I understand, this happens with some other themes as well.

According to the Kvantum maintainer/creator, this happens because the movability of a QToolbar is determined by the Qt theme if it is not set explicitly via `QToolbar.setMovable()` or via the .ui files.
Since none of the QToolbars I have found in FreeCAD code specify anything, it should be an easy fix to just `setMovable(true)` for all of them, but I am not sure if this would interfere with the PersistentToolbars functionality that was added in 0.17.

I would appreciate it if someone familiar with the GUI code base could share their thoughts on this.

Version information:
OS: Arch Linux (i3/i3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: makepkg
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.9.3
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/Ireland (en_IE)
Last edited by trallafitti on Sun May 09, 2021 2:48 pm, edited 1 time in total.
trallafitti
Posts: 5
Joined: Fri May 07, 2021 4:01 pm

Re: Toolbar drag handles disabled depending on Qt theme

Post by trallafitti »

This manjaro user seems to have had the same problem in 0.18 and the answer was to just use the AppImage of 0.19. Of course this worked since the AppImage version does not honor Qt platform themes and the default Qt theme assumes `movable=true`.
trallafitti
Posts: 5
Joined: Fri May 07, 2021 4:01 pm

Re: Toolbar drag handles disabled depending on Qt theme

Post by trallafitti »

Since nobody has an answer, is it recommended to file this as a bug report now?
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: Toolbar drag handles disabled depending on Qt theme

Post by heda »

meanwhile this should work,
since I don't have this it is hard to test if it works when toolbars starts out as non movable, at least the .setMovable toggles movability if it is there to begin with.

Code: Select all

# run as start-up macro to ensure movable toolbars
# assumes that gui is present

from PySide.QtGui import QToolBar

mw = Gui.getMainWindow()

for tbw in mw.findChildren(QToolBar):
    if not tbw.isMovable():
        tbw.setMovable(True)
blazini36
Posts: 81
Joined: Wed Apr 18, 2018 10:21 am

Re: Toolbar drag handles disabled depending on Qt theme

Post by blazini36 »

heda wrote: Thu May 13, 2021 5:16 am meanwhile this should work,
since I don't have this it is hard to test if it works when toolbars starts out as non movable, at least the .setMovable toggles movability if it is there to begin with.

Code: Select all

# run as start-up macro to ensure movable toolbars
# assumes that gui is present

from PySide.QtGui import QToolBar

mw = Gui.getMainWindow()

for tbw in mw.findChildren(QToolBar):
    if not tbw.isMovable():
        tbw.setMovable(True)
How do I set that up? I went to the macro selection and created a new macro, copied this into it and saved it. There is now a .FCMacro file in ~/.FreeCAD/Macro. Doesn't seem to have done anything.
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: Toolbar drag handles disabled depending on Qt theme

Post by heda »

did you run it as a regular macro and it made the toolbars movable again? (just to make sure)

Macro_at_Startup

even if you have it in auto startup, one would imagine that you have to run the script when you load new wb's anyways, since those tb's are likely not loaded at time of start-up (or tell fc to load selected wb's, and hope that the script is running afterwards).

btw, it is easier to read threads which does not include quotes which are complete posts (especially when it is just above any ways), either by marking text before quoting (think that works), or by deleting the unneeded.
Post Reply