In PyQt5, using stylesheets, you can style a QCommandLinkButton for combined states like checked and hover using the :checked and :hover pseudo-states respectively.
Here's how you can set a specific style for a QCommandLinkButton when it is both checked and being hovered over:
Basic QCommandLinkButton Setup: First, let's set up a basic QCommandLinkButton in a PyQt5 application.
import sys from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QCommandLinkButton app = QApplication(sys.argv) window = QWidget() layout = QVBoxLayout() button = QCommandLinkButton("Click me!") button.setCheckable(True) # Make the button checkable layout.addWidget(button) window.setLayout(layout) window.show() sys.exit(app.exec_()) Style with Stylesheet: Use the :checked and :hover pseudo-states together to detect when the QCommandLinkButton is both checked and hovered over. Here's how:
button.setStyleSheet(""" QCommandLinkButton:checked:hover { border: 3px solid blue; } """) Incorporate this into the previous code:
import sys from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QCommandLinkButton app = QApplication(sys.argv) window = QWidget() layout = QVBoxLayout() button = QCommandLinkButton("Click me!") button.setCheckable(True) # Make the button checkable button.setStyleSheet(""" QCommandLinkButton:checked:hover { border: 3px solid blue; } """) layout.addWidget(button) window.setLayout(layout) window.show() sys.exit(app.exec_()) With this setup, the QCommandLinkButton will show a blue 3px border when it is both checked and hovered over. You can adjust the colors and sizes as desired.
drawerlayout android-paging ngx-charts mediatr imagebackground properties real-time-clock uiimagepickercontroller tty bundling-and-minification