panzi / qjoypad

fork of qjoypad http://qjoypad.sourceforge.net/
GNU General Public License v2.0
120 stars 25 forks source link

On some DEs the button flash doesn't work #37

Open LeXofLeviafan opened 4 years ago

LeXofLeviafan commented 4 years ago

When trying to run QJoyPad in LXQT, regardless of widget theme selected, the button flashing (highlighting gamepad input) appears to have no effect. I managed to find a patch that somewhat fixes it (for those cases):

// flash.cpp, FlashButton::FlashButton
  setAutoDefault( false );
+ setAutoFillBackground( true );
  setFocusPolicy(Qt::NoFocus);

// flash.cpp, FlashButton::flash
  if (flashing)
  {
+     setFlat( false );
      setPalette( normalPalette );
      flashing = false;
  }
  else
  {
+     setFlat( true );
      setPalette( flashPalette );
      flashing = true;
  }

Without setAutoFillBackground, recoloring doesn't affect background (no idea how to make it affect text as well); without setFlat, the change only affects borders (and in some themes borders aren't affected either).

I'd suggest to perhaps add this as a build option (directive for cmake?) for those who have a similar problem. Or maybe someone who knows Qt can come up with a proper fix instead…

MagnusVesper commented 2 years ago

Thank you for posting this! I'm running Linux Mint with the Cinnamon DE. Adding those 3 lines and recompiling made the button flashes show.

panzi commented 2 years ago

Thank you!