Important: Please read the Qt Code of Conduct -

Sth hard to explain ...

  • Hi all

    I have strange issue to solve...

    I have many buttons on a Qdialog... The buttons are checkable and every button have this kind of stylesheet..

    #thebutton {
    background-color: transparent;
    border-image: url(:/images/buton_off.png);
    background: none;
    border: none;
    background-repeat: none;
    border-image: url(:/images/buton_on.png);
    border-image: url(:/images/buton_off.png);

    Every button has an id becouse I use QsignalMapper to collect them so I need the buttons to be clickable but when I press on them they change the state to checked..
    I don't want the button get the checked state from the click.. I want to give the checked state from QDataWidgetMapper

    How can I do that..

    Any way to do ?

  • Lifetime Qt Champion

    You could remove the checkable flag so click dont change it and then
    set the border-image: to _on/_off yourself at a later time and simply not use
    #thebutton::checked/#thebutton::unchecked but rather just
    change the default image in the #thebutton section.

  • Thanks @mrjj

    I solved it by using :flat flag :)

Log in to reply