Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Sth hard to explain ...
QtWS25 Last Chance

Sth hard to explain ...

Scheduled Pinned Locked Moved Solved General and Desktop
qpushbuttonstyesheet
3 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zeroptr
    wrote on last edited by
    #1

    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;
    }
    #thebutton::checked
    {
    border-image: url(:/images/buton_on.png);
    }
    #thebutton::unchecked
    {
    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..
    ok
    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 ?

    Linux Mint 20.04 64 Bit QT6.0.1

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      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.

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zeroptr
        wrote on last edited by
        #3

        Thanks @mrjj

        I solved it by using :flat flag :)

        Linux Mint 20.04 64 Bit QT6.0.1

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved