droneone
8th December 2012, 16:56
Hi all, I'm having an issue with a discrepancy between Windows and OSX in stylesheet (QSS) handling.
Namely, for QSlider-derived widgets, using the 'border-image' property requires me to have a negative border offset for the image to ensure that my custom handle is positioned correctly relative to the border image. Without negative border offsets, the handle is drawn inside the groove (both groove and handle have same heights, but groove has greater width than the range of the handle), and does not look as I intend it to. With a negative border offset, the handle is drawn relative to the groove as intended, but generates the following errors on windows (with crash on some widgets) :
QPainter::drawPixmapFragments - the source rect is not contained by the pixmap's rectangle
ASSERT: "v1 >= 0 && v1 < max" in file painting\qdrawhelper.cpp, line 734
Invalid parameter passed to C runtime function.
It does not generate an errors on OSX, and works as expected there.
Here is the offending QSS:
SlideToggle::groove:horizontal {
border-image: url(:/core/toggle-bg.png);
/* border-left: -9px transparent;
border-right: -8px transparent;
border-bottom: -5px transparent;
border-top: 0px transparent;*/
border: 0px transparent;
padding: 0px;
margin: 0px;
}
SlideToggle::handle:horizontal {
margin:0px;
padding:0px;
image: url(:/core/slider-handle-dark.png);
}
SlideToggle {
margin:4px;
}
Un-commenting the commented code generates a crash 100% of the time on Windows 7, using Qt 4.8.0.
I intend to re-design this element that causes the crash to use something other than a slider (like a QButton, since it only has two states), which is no big deal, but I have other sliders that have required negative offsets (for example, drop-shadows below or above groove) that generate thousands of warnings at run-time using them. Is there any ability to change the relationship between the groove border image and the handle that won't generate these problems on Windows?
Thanks in advance!
Namely, for QSlider-derived widgets, using the 'border-image' property requires me to have a negative border offset for the image to ensure that my custom handle is positioned correctly relative to the border image. Without negative border offsets, the handle is drawn inside the groove (both groove and handle have same heights, but groove has greater width than the range of the handle), and does not look as I intend it to. With a negative border offset, the handle is drawn relative to the groove as intended, but generates the following errors on windows (with crash on some widgets) :
QPainter::drawPixmapFragments - the source rect is not contained by the pixmap's rectangle
ASSERT: "v1 >= 0 && v1 < max" in file painting\qdrawhelper.cpp, line 734
Invalid parameter passed to C runtime function.
It does not generate an errors on OSX, and works as expected there.
Here is the offending QSS:
SlideToggle::groove:horizontal {
border-image: url(:/core/toggle-bg.png);
/* border-left: -9px transparent;
border-right: -8px transparent;
border-bottom: -5px transparent;
border-top: 0px transparent;*/
border: 0px transparent;
padding: 0px;
margin: 0px;
}
SlideToggle::handle:horizontal {
margin:0px;
padding:0px;
image: url(:/core/slider-handle-dark.png);
}
SlideToggle {
margin:4px;
}
Un-commenting the commented code generates a crash 100% of the time on Windows 7, using Qt 4.8.0.
I intend to re-design this element that causes the crash to use something other than a slider (like a QButton, since it only has two states), which is no big deal, but I have other sliders that have required negative offsets (for example, drop-shadows below or above groove) that generate thousands of warnings at run-time using them. Is there any ability to change the relationship between the groove border image and the handle that won't generate these problems on Windows?
Thanks in advance!