Bug 50584 - Malplaced focus rectangle for checkboxes with no text
Summary: Malplaced focus rectangle for checkboxes with no text
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kstyle (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Karol Szwed
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-11 23:08 UTC by Morten Hustveit
Modified: 2003-02-22 19:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Morten Hustveit 2002-11-11 23:08:22 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

This bugs applies to the Qt styles as well as the KDE styles.  It was confirmed to be an actual bug by Volker Hilsheimer of Trolltech, and he says he'll fix it in the Qt styles when he has the time.  The current behaviour is that the focus rectangle of unlabelled checkboxes appears next to them, rather than around the actual checkbox.  See http://kde.ping.uio.no/focusrect.png for the current behaviour.
Comment 1 Maksim Orlovich 2002-12-28 21:40:05 UTC
Qt3.1.1 mostly fixed it, but now the focus rectangle is cutting accross the checkbox bevel with 
Keramik. Investigating.  
Comment 2 Maksim Orlovich 2003-02-12 03:28:40 UTC
I've fixed it up in all of the styles; but didn't backport some of it yet; when I do that, I'll close 
this. 
 
Thanks a lot for your help with this. 
 
Comment 3 Maksim Orlovich 2003-02-22 19:11:04 UTC
Subject: KDE_3_1_BRANCH: kdelibs/kstyles/keramik

CVS commit by orlovich: 


Backport the adjustments to positioning of the focus indicator for labelless 
checkbox.


CCMAIL: 50584-done@bugs.kde.org


  M +23 -1     keramik.cpp   1.88.2.2


--- kdelibs/kstyles/keramik/keramik.cpp  #1.88.2.1:1.88.2.2
@@ -34,4 +34,5 @@
 
 #include <qbitmap.h>
+#include <qcheckbox.h>
 #include <qcombobox.h>
 #include <qdrawutil.h>
@@ -208,4 +209,25 @@ QRect KeramikStyle::subRect(SubRect r, c
                 {
                         return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField );
+                }
+
+                case SR_CheckBoxFocusRect:
+                {
+                        const QCheckBox* cb = static_cast<const QCheckBox*>(widget);
+
+                        //Only checkbox, no label
+                        if (cb->text().isEmpty() && (cb->pixmap() == 0) )
+                        {
+                                QRect bounding = cb->rect();
+                                QSize checkDim = Keramik::PixmapLoader::the().size( keramik_checkbox_on);
+                                int   cw = checkDim.width();;
+                                int   ch = checkDim.height();
+
+                                QRect checkbox(bounding.x() + 1, bounding.y() + 1 + (bounding.height() - ch)/2,
+                                                                cw - 3, ch - 4);
+
+                                return checkbox;
+                        }
+
+                        //Fallthrough intentional
                 }