Results 1 to 2 of 2

Thread: Checkbox and Radiobutton are not alligned with stylesheet

  1. #1
    Join Date
    Jan 2013
    Posts
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default Checkbox and Radiobutton are not alligned with stylesheet

    Hi all, i need some help solving this weird thing happening in my Designer.

    I made some images to replace the Radiobutton and Checkbox and applied them to QRadioButton and QCheckBox via stylesheet.
    The images are exactly the same size and the checkbox and radiobutton are in the same location in the image, but in designer, the radiobutton is slightly to the right.

    See this image:
    radiocheck.png

    I use the following stylesheet:
    Qt Code:
    1. QRadioButton::indicator { image: url(:/images/radiobutton_default.png) }
    2. QCheckBox::indicator { image: url(:images/checkbox_default.png); }
    To copy to clipboard, switch view to plain text mode 

    If i remove the stylesheet and look at the default radiobutton/checkbox, i can see they are aligned.
    unstyled.png

    Anyone knows why this happens? If the images are the same size and are applied the same way, shouldn't they align as well?

    -edit-
    Well, here's a self fix i guess:
    I removed the images from the resource file and re-added them. Rebuild the project and now it's working fine. Don't know what changed, but it works now i guess.
    Last edited by Nyte; 5th June 2014 at 13:35.

  2. #2
    Join Date
    Jun 2014
    Location
    Cracow
    Posts
    6
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Checkbox and Radiobutton are not alligned with stylesheet

    I noticed that sometimes when you add/change icons or you add a pixmap they dont look nice and are not aligned, but after running the app it works well. A rebuild helped me as well.

Similar Threads

  1. stylesheet of radiobutton
    By DEEPADEV in forum Qt Programming
    Replies: 2
    Last Post: 4th June 2012, 14:27
  2. Replies: 4
    Last Post: 1st June 2011, 15:54
  3. QTableView checkbox center with stylesheet
    By quiet in forum Qt Programming
    Replies: 2
    Last Post: 10th March 2011, 14:52
  4. checkbox and radiobutton in treeview
    By ErmandoFerrari in forum Qt Programming
    Replies: 1
    Last Post: 8th May 2010, 20:33
  5. How to set StyleSheet for checkbox in QTreeView;
    By visor_ua in forum Qt Programming
    Replies: 3
    Last Post: 7th April 2009, 12:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.