9

In KDE 5 (Kubuntu 15.04 / Plasma 5.2) disabled Qt-Buttons (Qt4) are indistinguishable from non-disabled buttons. This problem does not exist in KDE 4.14 as the following screen-shot shows:

Disabled buttons: KDE 4 versus KDE 5

The program source for this dialog is written in Python with PyQt4:

from PyQt4 import QtGui
import sys


if __name__ == "__main__":
    # main function

    app = QtGui.QApplication(sys.argv)

    qw = QtGui.QWidget()
    qw.resize(150, 120)
    qw.setWindowTitle("KDE 4")
    #qw.setWindowTitle("KDE 5")

    b1, b2 = QtGui.QPushButton(qw), QtGui.QPushButton(qw)
    for b, y, e in zip([b1, b2], [30, 60], [False, True]):
        b.move(30, y)
        b.setEnabled(e)
        b.setText("Enabled" if e else "Disabled")

    qw.show()
    sys.exit(app.exec_())

How can I make disabled Buttons in KDE 5 recognizable?

Update 2015-07-17:

It seems to be a problem of themes: In Debian/sid using the Oxygen-Theme avoids this problem.

Also Bug 343930 addresses this problem.

Dietrich
  • 5,241
  • 3
  • 24
  • 36
  • As a work around set a stylesheet for the button's text. – ngulam May 05 '15 at 07:22
  • @ngulam Thanks - I guess I will end up in doing customized stylesheets - goodbye portability... – Dietrich May 06 '15 at 18:22
  • @Dietrich It's not the most elegant of solutions, but you should be able to store your stylesheet within the script using a triple-quoted string, and just load from the string. It would solve the portability issue, at least. – Darth Vader May 09 '15 at 03:30
  • @DarthVader Shipping stylesheets is not the main issue in my case. The annoyance is that I need to test on every platform. Though I my case, the GUI is just used to be in one lab, I need to support four platforms (KDE 4,5, Win 7,8). – Dietrich May 10 '15 at 21:50
  • @Dietrich You could find the platform it's being run on, and enable or disable the style sheet based on the results (I know you can't tell the exact GUI toolkit, but you can assume that it's safe to leave the default styles on Windows and OSX, and just enable them on all Linux variants, leaving you with significantly fewer platforms to test). – Darth Vader May 11 '15 at 01:05
  • 1
    Well, it is probably not what you want, but it works beautifully in PyQt5. – Andrzej Pronobis May 14 '15 at 06:19
  • @DarthVader Thanks for the idea - For me, it's probably sufficient to install the proper stylesheet manually. – Dietrich May 15 '15 at 14:30
  • @Andrzej Thanks for testing in PyQt5. That will probably be the solution: Switch to PyQt5 as soon it is shipped with WinPython. – Dietrich May 15 '15 at 14:32

1 Answers1

1

This was a bug in the Breeze theme used by KDE/Plasma5. It has now been resolved. Below are the screenshots of enabled and disabled buttons using Qt5 and PyQt5.

Using C++/Qt5

Using Python/Qt5

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Marcus
  • 1,685
  • 1
  • 18
  • 33