Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CarlaStyle.cpp 185KB

11 years ago
11 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
10 years ago
10 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
Frontend widget enhancements (#767) * optimization: MainWindow resize event (no more issue #148) minimap: Brightness-aware shading on side gaps * CarlaStyle: more careful rounded corner drawing Rounded rectangles have transparent corners even with opaque colors. During compositing colors from several such objects are mixed, producing unexpected artifacts. Also outer contour must have bigger rounding - values for inner/outer rects are spreaded to be around of original 2.0px, to preserve original look. * CarlaStyle: better separator color Create separator color from softened text color. * paramspinbox: Keep scrollbar size closer to outer frame Unless QStyle allowes any widget style, or it is entries and scrollbars provide essential way to control or read frame parameters, scrollbar is still set a bit smaller to counter theme-side deviations between scrollbar and spinbox visible height while real height is equal. * CarlaStyle: better light shade * CarlaStyle: fix visible spinbox height regression When spinbox is in one row with scrollbar or entry field, all vertically expanding, spinbox look a bit lower. * CarlaStyle: completed spinbox buttons light border * CarlaStyle: fixed spinbox button rects, better borderwidth balance Integer button rectangles now produce pixel-aligned non-overlaping, still centered rectangles. SpinBox border width is reduced to minimum, right enough to keep entry widget corners out of outer rounded border parts. * CarlaStyle: constification (SpinBox drawing) * CarlaStyle: spinbox drawing fixes Rely to correct buttons rectangles, handle correctly both even and odd spinbox heights. Disappeared buttons highlight glitch, appeared when moving mouse one button to another. * CarlaStyle, SpinBox: contrast highlight margin between buttons * CarlaStyle spinbox: more careful buttons highlight * CarlaStyle, spinbox: better arrows placement * paramspinbox: Hide scrollbar border * CarlaStyle: nicer rounded corners in deep-dark colors (less radius deviation) * CarlaStyle CT_ToolButton: took less space than combobox in same layout As in designer, carla_host.ui has plus/minus buttons size 25x24, with height equal to adjacent combobox. It seems, system carla style already got fix.
6 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042
  1. /*
  2. * Carla Style, based on Qt5 fusion style
  3. * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
  4. * Copyright (C) 2013-2019 Filipe Coelho <falktx@falktx.com>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * For a full copy of the license see the doc/LGPL.txt file
  16. */
  17. #include "CarlaStylePrivate.hpp"
  18. #include <QtCore/qmath.h>
  19. #include <QtCore/QStringBuilder>
  20. #if defined(__GNUC__) && __GNUC__ >= 8
  21. # pragma GCC diagnostic ignored "-Wdeprecated-copy"
  22. #endif
  23. #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
  24. # include <QtGui/QPainter>
  25. # include <QtGui/QPainterPath>
  26. # include <QtGui/QPixmapCache>
  27. # include <QtWidgets/qdrawutil.h>
  28. # include <QtWidgets/QApplication>
  29. # include <QtWidgets/QComboBox>
  30. # include <QtWidgets/QGroupBox>
  31. # include <QtWidgets/QMainWindow>
  32. # include <QtWidgets/QProgressBar>
  33. # include <QtWidgets/QPushButton>
  34. # include <QtWidgets/QScrollBar>
  35. # include <QtWidgets/QSlider>
  36. # include <QtWidgets/QSpinBox>
  37. # include <QtWidgets/QSplitter>
  38. # include <QtWidgets/QWizard>
  39. # define QStyleOptionFrameV3 QStyleOptionFrame
  40. # define QStyleOptionProgressBarV2 QStyleOptionProgressBar
  41. #else
  42. # ifdef __clang__
  43. # pragma clang diagnostic push
  44. # pragma clang diagnostic ignored "-Wdeprecated-register"
  45. # endif
  46. # include <QtGui/QPainter>
  47. # include <QtGui/QPainterPath>
  48. # include <QtGui/QPixmapCache>
  49. # include <QtGui/QApplication>
  50. # include <QtGui/QComboBox>
  51. # include <QtGui/QGroupBox>
  52. # include <QtGui/QMainWindow>
  53. # include <QtGui/QProgressBar>
  54. # include <QtGui/QPushButton>
  55. # include <QtGui/QScrollBar>
  56. # include <QtGui/QSlider>
  57. # include <QtGui/QSpinBox>
  58. # include <QtGui/QSplitter>
  59. # include <QtGui/QWizard>
  60. # ifdef __clang__
  61. # pragma clang diagnostic pop
  62. # endif
  63. #endif
  64. #if defined(__GNUC__) && __GNUC__ >= 8
  65. # pragma GCC diagnostic pop
  66. #endif
  67. #include <cstdio>
  68. #if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
  69. #define PIXMAPCACHE_VAR_PREFIX &
  70. #else
  71. #define PIXMAPCACHE_VAR_PREFIX
  72. #endif
  73. #define BEGIN_STYLE_PIXMAPCACHE(a) \
  74. QRect rect = option->rect; \
  75. QPixmap internalPixmapCache; \
  76. QImage imageCache; \
  77. QPainter *p = painter; \
  78. QString unique = uniqueName((a), option, option->rect.size()); \
  79. int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \
  80. bool doPixmapCache = txType <= QTransform::TxTranslate; \
  81. if (doPixmapCache && QPixmapCache::find(unique, PIXMAPCACHE_VAR_PREFIX internalPixmapCache)) { \
  82. painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
  83. } else { \
  84. if (doPixmapCache) { \
  85. rect.setRect(0, 0, option->rect.width(), option->rect.height()); \
  86. imageCache = QImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied); \
  87. imageCache.fill(0); \
  88. p = new QPainter(&imageCache); \
  89. }
  90. #define END_STYLE_PIXMAPCACHE \
  91. if (doPixmapCache) { \
  92. p->end(); \
  93. delete p; \
  94. internalPixmapCache = QPixmap::fromImage(imageCache); \
  95. painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
  96. QPixmapCache::insert(unique, internalPixmapCache); \
  97. } \
  98. }
  99. enum Direction {
  100. TopDown,
  101. FromLeft,
  102. BottomUp,
  103. FromRight
  104. };
  105. // from windows style
  106. static const int windowsItemFrame = 2; // menu item frame width
  107. static const int windowsItemHMargin = 3; // menu item hor text margin
  108. static const int windowsItemVMargin = 8; // menu item ver text margin
  109. static const int windowsRightBorder = 15; // right border on windows
  110. static const int groupBoxBottomMargin = 0; // space below the groupbox
  111. static const int groupBoxTopMargin = 3;
  112. /* XPM */
  113. static const char * const qt_titlebar_context_help[] = {
  114. "10 10 3 1",
  115. " c None",
  116. "# c #000000",
  117. "+ c #444444",
  118. " +####+ ",
  119. " ### ### ",
  120. " ## ## ",
  121. " +##+ ",
  122. " +## ",
  123. " ## ",
  124. " ## ",
  125. " ",
  126. " ## ",
  127. " ## "};
  128. static const qreal Q_PI = qreal(3.14159265358979323846);
  129. // internal helper. Converts an integer value to an unique string token
  130. template <typename T>
  131. struct HexString
  132. {
  133. HexString(const T t)
  134. : val(t) {}
  135. void write(QChar* &dest) const
  136. {
  137. const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
  138. const char* c = reinterpret_cast<const char*>(&val);
  139. for (uint i = 0; i < sizeof(T); ++i)
  140. {
  141. *dest++ = hexChars[*c & 0xf];
  142. *dest++ = hexChars[(*c & 0xf0) >> 4];
  143. ++c;
  144. }
  145. }
  146. const T val;
  147. };
  148. // specialization to enable fast concatenating of our string tokens to a string
  149. template <typename T>
  150. struct QConcatenable<HexString<T> >
  151. {
  152. typedef HexString<T> type;
  153. enum { ExactSize = true };
  154. static int size(const HexString<T> &) { return sizeof(T) * 2; }
  155. static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); }
  156. typedef QString ConvertTo;
  157. };
  158. inline int qt_div_255(int x)
  159. {
  160. return (x + (x>>8) + 0x80) >> 8;
  161. }
  162. inline QPixmap styleCachePixmap(const QSize &size)
  163. {
  164. return QPixmap(size);
  165. }
  166. inline int fontMetricsHorizontalAdvance(const QFontMetrics& fm, const QString& s)
  167. {
  168. #if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
  169. return fm.horizontalAdvance(s);
  170. #else
  171. return fm.width(s);
  172. #endif
  173. }
  174. int calcBigLineSize(int radius)
  175. {
  176. int bigLineSize = radius / 6;
  177. if (bigLineSize < 4)
  178. bigLineSize = 4;
  179. if (bigLineSize > radius / 2)
  180. bigLineSize = radius / 2;
  181. return bigLineSize;
  182. }
  183. static QPolygonF calcLines(const QStyleOptionSlider* dial)
  184. {
  185. QPolygonF poly;
  186. int width = dial->rect.width();
  187. int height = dial->rect.height();
  188. qreal r = qMin(width, height) / 2;
  189. int bigLineSize = calcBigLineSize(int(r));
  190. qreal xc = width / 2 + 0.5;
  191. qreal yc = height / 2 + 0.5;
  192. const int ns = dial->tickInterval;
  193. if (!ns) // Invalid values may be set by Qt Designer.
  194. return poly;
  195. int notches = (dial->maximum + ns - 1 - dial->minimum) / ns;
  196. if (notches <= 0)
  197. return poly;
  198. if (dial->maximum < dial->minimum || dial->maximum - dial->minimum > 1000) {
  199. int maximum = dial->minimum + 1000;
  200. notches = (maximum + ns - 1 - dial->minimum) / ns;
  201. }
  202. poly.resize(2 + 2 * notches);
  203. int smallLineSize = bigLineSize / 2;
  204. for (int i = 0; i <= notches; ++i) {
  205. qreal angle = dial->dialWrapping ? Q_PI * 3 / 2 - i * 2 * Q_PI / notches
  206. : (Q_PI * 8 - i * 10 * Q_PI / notches) / 6;
  207. qreal s = qSin(angle);
  208. qreal c = qCos(angle);
  209. if (i == 0 || (((ns * i) % (dial->pageStep ? dial->pageStep : 1)) == 0)) {
  210. poly[2 * i] = QPointF(xc + (r - bigLineSize) * c,
  211. yc - (r - bigLineSize) * s);
  212. poly[2 * i + 1] = QPointF(xc + r * c, yc - r * s);
  213. } else {
  214. poly[2 * i] = QPointF(xc + (r - 1 - smallLineSize) * c,
  215. yc - (r - 1 - smallLineSize) * s);
  216. poly[2 * i + 1] = QPointF(xc + (r - 1) * c, yc -(r - 1) * s);
  217. }
  218. }
  219. return poly;
  220. }
  221. static QPointF calcRadialPos(const QStyleOptionSlider *dial, qreal offset)
  222. {
  223. const int width = dial->rect.width();
  224. const int height = dial->rect.height();
  225. const int r = qMin(width, height) / 2;
  226. const int currentSliderPosition = dial->upsideDown ? dial->sliderPosition : (dial->maximum - dial->sliderPosition);
  227. qreal a = 0;
  228. if (dial->maximum == dial->minimum)
  229. a = Q_PI / 2;
  230. else if (dial->dialWrapping)
  231. a = Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 * Q_PI
  232. / (dial->maximum - dial->minimum);
  233. else
  234. a = (Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 * Q_PI
  235. / (dial->maximum - dial->minimum)) / 6;
  236. qreal xc = width / 2.0;
  237. qreal yc = height / 2.0;
  238. qreal len = r - calcBigLineSize(r) - 3;
  239. qreal back = offset * len;
  240. QPointF pos(QPointF(xc + back * qCos(a), yc - back * qSin(a)));
  241. return pos;
  242. }
  243. static QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
  244. {
  245. const QStyleOptionComplex* complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
  246. QString tmp = key % HexString<uint>(option->state)
  247. % HexString<uint>(option->direction)
  248. % HexString<uint>(complexOption ? uint(complexOption->activeSubControls) : 0u)
  249. % HexString<quint64>(option->palette.cacheKey())
  250. % HexString<uint>(size.width())
  251. % HexString<uint>(size.height());
  252. #ifndef QT_NO_SPINBOX
  253. if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
  254. tmp = tmp % HexString<uint>(spinBox->buttonSymbols)
  255. % HexString<uint>(spinBox->stepEnabled)
  256. % QLatin1Char(spinBox->frame ? '1' : '0'); ;
  257. }
  258. #endif // QT_NO_SPINBOX
  259. return tmp;
  260. }
  261. // This will draw a nice and shiny QDial for us. We don't want
  262. // all the shinyness in QWindowsStyle, hence we place it here
  263. static void drawDial(const QStyleOptionSlider* option, QPainter* painter)
  264. {
  265. QPalette pal = option->palette;
  266. QColor buttonColor = pal.button().color();
  267. const int width = option->rect.width();
  268. const int height = option->rect.height();
  269. const bool enabled = option->state & QStyle::State_Enabled;
  270. qreal r = qMin(width, height) / 2;
  271. r -= r/50;
  272. const qreal penSize = r/20.0;
  273. painter->save();
  274. painter->setRenderHint(QPainter::Antialiasing);
  275. // Draw notches
  276. if (option->subControls & QStyle::SC_DialTickmarks) {
  277. painter->setPen(option->palette.dark().color().darker(120));
  278. painter->drawLines(calcLines(option));
  279. }
  280. // Cache dial background
  281. BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("qdial"));
  282. p->setRenderHint(QPainter::Antialiasing);
  283. const qreal d_ = r / 6;
  284. const qreal dx = option->rect.x() + d_ + (width - 2 * r) / 2 + 1;
  285. const qreal dy = option->rect.y() + d_ + (height - 2 * r) / 2 + 1;
  286. QRectF br = QRectF(dx + 0.5, dy + 0.5,
  287. int(r * 2 - 2 * d_ - 2),
  288. int(r * 2 - 2 * d_ - 2));
  289. buttonColor.setHsv(buttonColor .hue(),
  290. qMin(140, buttonColor .saturation()),
  291. qMax(180, buttonColor.value()));
  292. QColor shadowColor(0, 0, 0, 20);
  293. if (enabled) {
  294. // Drop shadow
  295. qreal shadowSize = qMax(1.0, penSize/2.0);
  296. QRectF shadowRect= br.adjusted(-2*shadowSize, -2*shadowSize,
  297. 2*shadowSize, 2*shadowSize);
  298. QRadialGradient shadowGradient(shadowRect.center().x(),
  299. shadowRect.center().y(), shadowRect.width()/2.0,
  300. shadowRect.center().x(), shadowRect.center().y());
  301. shadowGradient.setColorAt(qreal(0.91), QColor(0, 0, 0, 40));
  302. shadowGradient.setColorAt(qreal(1.0), Qt::transparent);
  303. p->setBrush(shadowGradient);
  304. p->setPen(Qt::NoPen);
  305. p->translate(shadowSize, shadowSize);
  306. p->drawEllipse(shadowRect);
  307. p->translate(-shadowSize, -shadowSize);
  308. // Main gradient
  309. QRadialGradient gradient(br.center().x() - br.width()/3, dy,
  310. br.width()*1.3, br.center().x(),
  311. br.center().y() - br.height()/2);
  312. gradient.setColorAt(0, buttonColor.lighter(110));
  313. gradient.setColorAt(qreal(0.5), buttonColor);
  314. gradient.setColorAt(qreal(0.501), buttonColor.darker(102));
  315. gradient.setColorAt(1, buttonColor.darker(115));
  316. p->setBrush(gradient);
  317. } else {
  318. p->setBrush(Qt::NoBrush);
  319. }
  320. p->setPen(QPen(buttonColor.darker(280)));
  321. p->drawEllipse(br);
  322. p->setBrush(Qt::NoBrush);
  323. p->setPen(buttonColor.lighter(110));
  324. p->drawEllipse(br.adjusted(1, 1, -1, -1));
  325. if (option->state & QStyle::State_HasFocus) {
  326. QColor highlight = pal.highlight().color();
  327. highlight.setHsv(highlight.hue(),
  328. qMin(160, highlight.saturation()),
  329. qMax(230, highlight.value()));
  330. highlight.setAlpha(127);
  331. p->setPen(QPen(highlight, 2.0));
  332. p->setBrush(Qt::NoBrush);
  333. p->drawEllipse(br.adjusted(-1, -1, 1, 1));
  334. }
  335. END_STYLE_PIXMAPCACHE
  336. QPointF dp = calcRadialPos(option, qreal(0.70));
  337. buttonColor = buttonColor.lighter(104);
  338. buttonColor.setAlphaF(qreal(0.8));
  339. const qreal ds = r/qreal(7.0);
  340. QRectF dialRect(dp.x() - ds, dp.y() - ds, 2*ds, 2*ds);
  341. QRadialGradient dialGradient(dialRect.center().x() + dialRect.width()/2,
  342. dialRect.center().y() + dialRect.width(),
  343. dialRect.width()*2,
  344. dialRect.center().x(), dialRect.center().y());
  345. dialGradient.setColorAt(1, buttonColor.darker(140));
  346. dialGradient.setColorAt(qreal(0.4), buttonColor.darker(120));
  347. dialGradient.setColorAt(0, buttonColor.darker(110));
  348. if (penSize > 3.0) {
  349. painter->setPen(QPen(QColor(0, 0, 0, 25), penSize));
  350. painter->drawLine(calcRadialPos(option, qreal(0.90)), calcRadialPos(option, qreal(0.96)));
  351. }
  352. painter->setBrush(dialGradient);
  353. painter->setPen(QColor(255, 255, 255, 150));
  354. painter->drawEllipse(dialRect.adjusted(-1, -1, 1, 1));
  355. painter->setPen(QColor(0, 0, 0, 80));
  356. painter->drawEllipse(dialRect);
  357. painter->restore();
  358. }
  359. static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50)
  360. {
  361. const int maxFactor = 100;
  362. QColor tmp = colorA;
  363. tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor);
  364. tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor);
  365. tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor);
  366. return tmp;
  367. }
  368. static QPixmap colorizedImage(const QString &fileName, const QColor &color, int rotation = 0)
  369. {
  370. QString pixmapName = QLatin1String("$qt_ia-") % fileName % HexString<uint>(color.rgba()) % QString::number(rotation);
  371. QPixmap pixmap;
  372. if (!QPixmapCache::find(pixmapName, PIXMAPCACHE_VAR_PREFIX pixmap)) {
  373. QImage image(fileName);
  374. if (image.format() != QImage::Format_ARGB32_Premultiplied)
  375. image = image.convertToFormat( QImage::Format_ARGB32_Premultiplied);
  376. int width = image.width();
  377. int height = image.height();
  378. int source = color.rgba();
  379. unsigned char sourceRed = qRed(source);
  380. unsigned char sourceGreen = qGreen(source);
  381. unsigned char sourceBlue = qBlue(source);
  382. for (int y = 0; y < height; ++y)
  383. {
  384. QRgb *data = (QRgb*) image.scanLine(y);
  385. for (int x = 0 ; x < width ; ++x) {
  386. QRgb col = data[x];
  387. unsigned int colorDiff = (qBlue(col) - qRed(col));
  388. unsigned char gray = qGreen(col);
  389. unsigned char red = gray + qt_div_255(sourceRed * colorDiff);
  390. unsigned char green = gray + qt_div_255(sourceGreen * colorDiff);
  391. unsigned char blue = gray + qt_div_255(sourceBlue * colorDiff);
  392. unsigned char alpha = qt_div_255(qAlpha(col) * qAlpha(source));
  393. data[x] = qRgba(red, green, blue, alpha);
  394. }
  395. }
  396. if (rotation != 0) {
  397. QTransform transform;
  398. transform.translate(-image.width()/2, -image.height()/2);
  399. transform.rotate(rotation);
  400. transform.translate(image.width()/2, image.height()/2);
  401. image = image.transformed(transform);
  402. }
  403. pixmap = QPixmap::fromImage(image);
  404. QPixmapCache::insert(pixmapName, pixmap);
  405. }
  406. return pixmap;
  407. }
  408. // The default button and handle gradient
  409. static QLinearGradient qt_fusion_gradient(const QRect &rect, const QBrush &baseColor, Direction direction = TopDown)
  410. {
  411. int x = rect.center().x();
  412. int y = rect.center().y();
  413. QLinearGradient gradient;
  414. switch (direction) {
  415. case FromLeft:
  416. gradient = QLinearGradient(rect.left(), y, rect.right(), y);
  417. break;
  418. case FromRight:
  419. gradient = QLinearGradient(rect.right(), y, rect.left(), y);
  420. break;
  421. case BottomUp:
  422. gradient = QLinearGradient(x, rect.bottom(), x, rect.top());
  423. break;
  424. case TopDown:
  425. default:
  426. gradient = QLinearGradient(x, rect.top(), x, rect.bottom());
  427. break;
  428. }
  429. if (baseColor.gradient())
  430. gradient.setStops(baseColor.gradient()->stops());
  431. else {
  432. QColor gradientStartColor = baseColor.color().lighter(124);
  433. QColor gradientStopColor = baseColor.color().lighter(102);
  434. gradient.setColorAt(0, gradientStartColor);
  435. gradient.setColorAt(1, gradientStopColor);
  436. // Uncomment for adding shiny shading
  437. // QColor midColor1 = mergedColors(gradientStartColor, gradientStopColor, 55);
  438. // QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 45);
  439. // gradient.setColorAt(0.5, midColor1);
  440. // gradient.setColorAt(0.501, midColor2);
  441. }
  442. return gradient;
  443. }
  444. static void qt_fusion_draw_mdibutton(QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken)
  445. {
  446. QColor dark;
  447. dark.setHsv(option->palette.button().color().hue(),
  448. qMin(255, (int)(option->palette.button().color().saturation())),
  449. qMin(255, (int)(option->palette.button().color().value()*0.7)));
  450. QColor highlight = option->palette.highlight().color();
  451. bool active = (option->titleBarState & QStyle::State_Active);
  452. QColor titleBarHighlight(255, 255, 255, 60);
  453. if (sunken)
  454. painter->fillRect(tmp.adjusted(1, 1, -1, -1), option->palette.highlight().color().darker(120));
  455. else if (hover)
  456. painter->fillRect(tmp.adjusted(1, 1, -1, -1), QColor(255, 255, 255, 20));
  457. QColor mdiButtonGradientStartColor;
  458. QColor mdiButtonGradientStopColor;
  459. mdiButtonGradientStartColor = QColor(0, 0, 0, 40);
  460. mdiButtonGradientStopColor = QColor(255, 255, 255, 60);
  461. if (sunken)
  462. titleBarHighlight = highlight.darker(130);
  463. QLinearGradient gradient(tmp.center().x(), tmp.top(), tmp.center().x(), tmp.bottom());
  464. gradient.setColorAt(0, mdiButtonGradientStartColor);
  465. gradient.setColorAt(1, mdiButtonGradientStopColor);
  466. QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110));
  467. painter->setPen(QPen(mdiButtonBorderColor, 1));
  468. const QLine lines[4] = {
  469. QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()),
  470. QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()),
  471. QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2),
  472. QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2)
  473. };
  474. painter->drawLines(lines, 4);
  475. const QPoint points[4] = {
  476. QPoint(tmp.left() + 1, tmp.top() + 1),
  477. QPoint(tmp.right() - 1, tmp.top() + 1),
  478. QPoint(tmp.left() + 1, tmp.bottom() - 1),
  479. QPoint(tmp.right() - 1, tmp.bottom() - 1)
  480. };
  481. painter->drawPoints(points, 4);
  482. painter->setPen(titleBarHighlight);
  483. painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1);
  484. painter->drawLine(tmp.left() + 1, tmp.top() + 2, tmp.left() + 1, tmp.bottom() - 2);
  485. painter->setPen(QPen(gradient, 1));
  486. painter->drawLine(tmp.right() + 1, tmp.top() + 2, tmp.right() + 1, tmp.bottom() - 2);
  487. painter->drawPoint(tmp.right() , tmp.top() + 1);
  488. painter->drawLine(tmp.left() + 2, tmp.bottom() + 1, tmp.right() - 2, tmp.bottom() + 1);
  489. painter->drawPoint(tmp.left() + 1, tmp.bottom());
  490. painter->drawPoint(tmp.right() - 1, tmp.bottom());
  491. painter->drawPoint(tmp.right() , tmp.bottom() - 1);
  492. }
  493. CarlaStyle::CarlaStyle()
  494. : QCommonStyle(),
  495. d(new CarlaStylePrivate(this))
  496. {
  497. setObjectName(QLatin1String("CarlaStyle"));
  498. #if 0
  499. fPalSystem = app->palette();
  500. fPalBlack.setColor(QPalette::Disabled, QPalette::Window, QColor(14, 14, 14));
  501. fPalBlack.setColor(QPalette::Active, QPalette::Window, QColor(17, 17, 17));
  502. fPalBlack.setColor(QPalette::Inactive, QPalette::Window, QColor(17, 17, 17));
  503. fPalBlack.setColor(QPalette::Disabled, QPalette::WindowText, QColor(83, 83, 83));
  504. fPalBlack.setColor(QPalette::Active, QPalette::WindowText, QColor(240, 240, 240));
  505. fPalBlack.setColor(QPalette::Inactive, QPalette::WindowText, QColor(240, 240, 240));
  506. fPalBlack.setColor(QPalette::Disabled, QPalette::Base, QColor(6, 6, 6));
  507. fPalBlack.setColor(QPalette::Active, QPalette::Base, QColor(7, 7, 7));
  508. fPalBlack.setColor(QPalette::Inactive, QPalette::Base, QColor(7, 7, 7));
  509. fPalBlack.setColor(QPalette::Disabled, QPalette::AlternateBase, QColor(12, 12, 12));
  510. fPalBlack.setColor(QPalette::Active, QPalette::AlternateBase, QColor(14, 14, 14));
  511. fPalBlack.setColor(QPalette::Inactive, QPalette::AlternateBase, QColor(14, 14, 14));
  512. fPalBlack.setColor(QPalette::Disabled, QPalette::ToolTipBase, QColor(4, 4, 4));
  513. fPalBlack.setColor(QPalette::Active, QPalette::ToolTipBase, QColor(4, 4, 4));
  514. fPalBlack.setColor(QPalette::Inactive, QPalette::ToolTipBase, QColor(4, 4, 4));
  515. fPalBlack.setColor(QPalette::Disabled, QPalette::ToolTipText, QColor(230, 230, 230));
  516. fPalBlack.setColor(QPalette::Active, QPalette::ToolTipText, QColor(230, 230, 230));
  517. fPalBlack.setColor(QPalette::Inactive, QPalette::ToolTipText, QColor(230, 230, 230));
  518. fPalBlack.setColor(QPalette::Disabled, QPalette::Text, QColor(74, 74, 74));
  519. fPalBlack.setColor(QPalette::Active, QPalette::Text, QColor(230, 230, 230));
  520. fPalBlack.setColor(QPalette::Inactive, QPalette::Text, QColor(230, 230, 230));
  521. fPalBlack.setColor(QPalette::Disabled, QPalette::Button, QColor(24, 24, 24));
  522. fPalBlack.setColor(QPalette::Active, QPalette::Button, QColor(28, 28, 28));
  523. fPalBlack.setColor(QPalette::Inactive, QPalette::Button, QColor(28, 28, 28));
  524. fPalBlack.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(90, 90, 90));
  525. fPalBlack.setColor(QPalette::Active, QPalette::ButtonText, QColor(240, 240, 240));
  526. fPalBlack.setColor(QPalette::Inactive, QPalette::ButtonText, QColor(240, 240, 240));
  527. fPalBlack.setColor(QPalette::Disabled, QPalette::BrightText, QColor(255, 255, 255));
  528. fPalBlack.setColor(QPalette::Active, QPalette::BrightText, QColor(255, 255, 255));
  529. fPalBlack.setColor(QPalette::Inactive, QPalette::BrightText, QColor(255, 255, 255));
  530. fPalBlack.setColor(QPalette::Disabled, QPalette::Light, QColor(191, 191, 191));
  531. fPalBlack.setColor(QPalette::Active, QPalette::Light, QColor(191, 191, 191));
  532. fPalBlack.setColor(QPalette::Inactive, QPalette::Light, QColor(191, 191, 191));
  533. fPalBlack.setColor(QPalette::Disabled, QPalette::Midlight, QColor(155, 155, 155));
  534. fPalBlack.setColor(QPalette::Active, QPalette::Midlight, QColor(155, 155, 155));
  535. fPalBlack.setColor(QPalette::Inactive, QPalette::Midlight, QColor(155, 155, 155));
  536. fPalBlack.setColor(QPalette::Disabled, QPalette::Dark, QColor(129, 129, 129));
  537. fPalBlack.setColor(QPalette::Active, QPalette::Dark, QColor(129, 129, 129));
  538. fPalBlack.setColor(QPalette::Inactive, QPalette::Dark, QColor(129, 129, 129));
  539. fPalBlack.setColor(QPalette::Disabled, QPalette::Mid, QColor(94, 94, 94));
  540. fPalBlack.setColor(QPalette::Active, QPalette::Mid, QColor(94, 94, 94));
  541. fPalBlack.setColor(QPalette::Inactive, QPalette::Mid, QColor(94, 94, 94));
  542. fPalBlack.setColor(QPalette::Disabled, QPalette::Shadow, QColor(155, 155, 155));
  543. fPalBlack.setColor(QPalette::Active, QPalette::Shadow, QColor(155, 155, 155));
  544. fPalBlack.setColor(QPalette::Inactive, QPalette::Shadow, QColor(155, 155, 155));
  545. fPalBlack.setColor(QPalette::Disabled, QPalette::Highlight, QColor(14, 14, 14));
  546. fPalBlack.setColor(QPalette::Active, QPalette::Highlight, QColor(60, 60, 60));
  547. fPalBlack.setColor(QPalette::Inactive, QPalette::Highlight, QColor(34, 34, 34));
  548. fPalBlack.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(83, 83, 83));
  549. fPalBlack.setColor(QPalette::Active, QPalette::HighlightedText, QColor(255, 255, 255));
  550. fPalBlack.setColor(QPalette::Inactive, QPalette::HighlightedText, QColor(240, 240, 240));
  551. fPalBlack.setColor(QPalette::Disabled, QPalette::Link, QColor(34, 34, 74));
  552. fPalBlack.setColor(QPalette::Active, QPalette::Link, QColor(100, 100, 230));
  553. fPalBlack.setColor(QPalette::Inactive, QPalette::Link, QColor(100, 100, 230));
  554. fPalBlack.setColor(QPalette::Disabled, QPalette::LinkVisited, QColor(74, 34, 74));
  555. fPalBlack.setColor(QPalette::Active, QPalette::LinkVisited, QColor(230, 100, 230));
  556. fPalBlack.setColor(QPalette::Inactive, QPalette::LinkVisited, QColor(230, 100, 230));
  557. fPalBlue.setColor(QPalette::Disabled, QPalette::Window, QColor(32, 35, 39));
  558. fPalBlue.setColor(QPalette::Active, QPalette::Window, QColor(37, 40, 45));
  559. fPalBlue.setColor(QPalette::Inactive, QPalette::Window, QColor(37, 40, 45));
  560. fPalBlue.setColor(QPalette::Disabled, QPalette::WindowText, QColor(89, 95, 104));
  561. fPalBlue.setColor(QPalette::Active, QPalette::WindowText, QColor(223, 237, 255));
  562. fPalBlue.setColor(QPalette::Inactive, QPalette::WindowText, QColor(223, 237, 255));
  563. fPalBlue.setColor(QPalette::Disabled, QPalette::Base, QColor(48, 53, 60));
  564. fPalBlue.setColor(QPalette::Active, QPalette::Base, QColor(55, 61, 69));
  565. fPalBlue.setColor(QPalette::Inactive, QPalette::Base, QColor(55, 61, 69));
  566. fPalBlue.setColor(QPalette::Disabled, QPalette::AlternateBase, QColor(60, 64, 67));
  567. fPalBlue.setColor(QPalette::Active, QPalette::AlternateBase, QColor(69, 73, 77));
  568. fPalBlue.setColor(QPalette::Inactive, QPalette::AlternateBase, QColor(69, 73, 77));
  569. fPalBlue.setColor(QPalette::Disabled, QPalette::ToolTipBase, QColor(182, 193, 208));
  570. fPalBlue.setColor(QPalette::Active, QPalette::ToolTipBase, QColor(182, 193, 208));
  571. fPalBlue.setColor(QPalette::Inactive, QPalette::ToolTipBase, QColor(182, 193, 208));
  572. fPalBlue.setColor(QPalette::Disabled, QPalette::ToolTipText, QColor(42, 44, 48));
  573. fPalBlue.setColor(QPalette::Active, QPalette::ToolTipText, QColor(42, 44, 48));
  574. fPalBlue.setColor(QPalette::Inactive, QPalette::ToolTipText, QColor(42, 44, 48));
  575. fPalBlue.setColor(QPalette::Disabled, QPalette::Text, QColor(96, 103, 113));
  576. fPalBlue.setColor(QPalette::Active, QPalette::Text, QColor(210, 222, 240));
  577. fPalBlue.setColor(QPalette::Inactive, QPalette::Text, QColor(210, 222, 240));
  578. fPalBlue.setColor(QPalette::Disabled, QPalette::Button, QColor(51, 55, 62));
  579. fPalBlue.setColor(QPalette::Active, QPalette::Button, QColor(59, 63, 71));
  580. fPalBlue.setColor(QPalette::Inactive, QPalette::Button, QColor(59, 63, 71));
  581. fPalBlue.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(98, 104, 114));
  582. fPalBlue.setColor(QPalette::Active, QPalette::ButtonText, QColor(210, 222, 240));
  583. fPalBlue.setColor(QPalette::Inactive, QPalette::ButtonText, QColor(210, 222, 240));
  584. fPalBlue.setColor(QPalette::Disabled, QPalette::BrightText, QColor(255, 255, 255));
  585. fPalBlue.setColor(QPalette::Active, QPalette::BrightText, QColor(255, 255, 255));
  586. fPalBlue.setColor(QPalette::Inactive, QPalette::BrightText, QColor(255, 255, 255));
  587. fPalBlue.setColor(QPalette::Disabled, QPalette::Light, QColor(59, 64, 72));
  588. fPalBlue.setColor(QPalette::Active, QPalette::Light, QColor(63, 68, 76));
  589. fPalBlue.setColor(QPalette::Inactive, QPalette::Light, QColor(63, 68, 76));
  590. fPalBlue.setColor(QPalette::Disabled, QPalette::Midlight, QColor(48, 52, 59));
  591. fPalBlue.setColor(QPalette::Active, QPalette::Midlight, QColor(51, 56, 63));
  592. fPalBlue.setColor(QPalette::Inactive, QPalette::Midlight, QColor(51, 56, 63));
  593. fPalBlue.setColor(QPalette::Disabled, QPalette::Dark, QColor(18, 19, 22));
  594. fPalBlue.setColor(QPalette::Active, QPalette::Dark, QColor(20, 22, 25));
  595. fPalBlue.setColor(QPalette::Inactive, QPalette::Dark, QColor(20, 22, 25));
  596. fPalBlue.setColor(QPalette::Disabled, QPalette::Mid, QColor(28, 30, 34));
  597. fPalBlue.setColor(QPalette::Active, QPalette::Mid, QColor(32, 35, 39));
  598. fPalBlue.setColor(QPalette::Inactive, QPalette::Mid, QColor(32, 35, 39));
  599. fPalBlue.setColor(QPalette::Disabled, QPalette::Shadow, QColor(13, 14, 16));
  600. fPalBlue.setColor(QPalette::Active, QPalette::Shadow, QColor(15, 16, 18));
  601. fPalBlue.setColor(QPalette::Inactive, QPalette::Shadow, QColor(15, 16, 18));
  602. fPalBlue.setColor(QPalette::Disabled, QPalette::Highlight, QColor(32, 35, 39));
  603. fPalBlue.setColor(QPalette::Active, QPalette::Highlight, QColor(14, 14, 17));
  604. fPalBlue.setColor(QPalette::Inactive, QPalette::Highlight, QColor(27, 28, 33));
  605. fPalBlue.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(89, 95, 104));
  606. fPalBlue.setColor(QPalette::Active, QPalette::HighlightedText, QColor(217, 234, 253));
  607. fPalBlue.setColor(QPalette::Inactive, QPalette::HighlightedText, QColor(223, 237, 255));
  608. fPalBlue.setColor(QPalette::Disabled, QPalette::Link, QColor(79, 100, 118));
  609. fPalBlue.setColor(QPalette::Active, QPalette::Link, QColor(156, 212, 255));
  610. fPalBlue.setColor(QPalette::Inactive, QPalette::Link, QColor(156, 212, 255));
  611. fPalBlue.setColor(QPalette::Disabled, QPalette::LinkVisited, QColor(51, 74, 118));
  612. fPalBlue.setColor(QPalette::Active, QPalette::LinkVisited, QColor(64, 128, 255));
  613. fPalBlue.setColor(QPalette::Inactive, QPalette::LinkVisited, QColor(64, 128, 255));
  614. #endif
  615. }
  616. CarlaStyle::~CarlaStyle()
  617. {
  618. delete d;
  619. }
  620. void printPalette(const QPalette& pal)
  621. {
  622. #define PAL "fPalBlue"
  623. #define PAL_PRINT(ROLE) \
  624. { \
  625. QColor color1(pal.color(QPalette::Disabled, ROLE)); \
  626. QColor color2(pal.color(QPalette::Active, ROLE)); \
  627. QColor color3(pal.color(QPalette::Inactive, ROLE)); \
  628. printf(PAL ".setColor(QPalette::Disabled, " #ROLE ", QColor(%i, %i, %i));\n", color1.red(), color1.green(), color1.blue()); \
  629. printf(PAL ".setColor(QPalette::Active, " #ROLE ", QColor(%i, %i, %i));\n", color2.red(), color2.green(), color2.blue()); \
  630. printf(PAL ".setColor(QPalette::Inactive, " #ROLE ", QColor(%i, %i, %i));\n", color3.red(), color3.green(), color3.blue()); \
  631. }
  632. PAL_PRINT(QPalette::Window)
  633. PAL_PRINT(QPalette::WindowText)
  634. PAL_PRINT(QPalette::Base)
  635. PAL_PRINT(QPalette::AlternateBase)
  636. PAL_PRINT(QPalette::ToolTipBase)
  637. PAL_PRINT(QPalette::ToolTipText)
  638. PAL_PRINT(QPalette::Text)
  639. PAL_PRINT(QPalette::Button)
  640. PAL_PRINT(QPalette::ButtonText)
  641. PAL_PRINT(QPalette::BrightText)
  642. PAL_PRINT(QPalette::Light)
  643. PAL_PRINT(QPalette::Midlight)
  644. PAL_PRINT(QPalette::Dark)
  645. PAL_PRINT(QPalette::Mid)
  646. PAL_PRINT(QPalette::Shadow)
  647. PAL_PRINT(QPalette::Highlight)
  648. PAL_PRINT(QPalette::HighlightedText)
  649. PAL_PRINT(QPalette::Link)
  650. PAL_PRINT(QPalette::LinkVisited)
  651. #undef PAL
  652. }
  653. /*!
  654. \fn void CarlaStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette,
  655. bool enabled, const QString& text, QPalette::ColorRole textRole) const
  656. Draws the given \a text in the specified \a rectangle using the
  657. provided \a painter and \a palette.
  658. Text is drawn using the painter's pen. If an explicit \a textRole
  659. is specified, then the text is drawn using the \a palette's color
  660. for the specified role. The \a enabled value indicates whether or
  661. not the item is enabled; when reimplementing, this value should
  662. influence how the item is drawn.
  663. The text is aligned and wrapped according to the specified \a
  664. alignment.
  665. \sa Qt::Alignment
  666. */
  667. void CarlaStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,
  668. bool enabled, const QString& text, QPalette::ColorRole textRole) const
  669. {
  670. if (text.isEmpty())
  671. return;
  672. QPen savedPen = painter->pen();
  673. if (textRole != QPalette::NoRole) {
  674. painter->setPen(QPen(pal.brush(textRole), savedPen.widthF()));
  675. }
  676. if (!enabled) {
  677. QPen pen = painter->pen();
  678. painter->setPen(pen);
  679. }
  680. painter->drawText(rect, alignment, text);
  681. painter->setPen(savedPen);
  682. }
  683. /*!
  684. \reimp
  685. */
  686. void CarlaStyle::drawPrimitive(PrimitiveElement elem,
  687. const QStyleOption *option,
  688. QPainter *painter, const QWidget *widget) const
  689. {
  690. Q_ASSERT(option);
  691. QRect rect = option->rect;
  692. int state = option->state;
  693. QColor outline = d->outline(option->palette);
  694. QColor highlightedOutline = d->highlightedOutline(option->palette);
  695. QColor tabFrameColor = d->tabFrameColor(option->palette);
  696. switch (elem) {
  697. // No frame drawn
  698. case PE_FrameGroupBox:
  699. {
  700. QPixmap pixmap(QLatin1String(":/bitmaps/style/groupbox.png"));
  701. int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin;
  702. QRect frame = option->rect.adjusted(0, topMargin, 0, 0);
  703. qDrawBorderPixmap(painter, frame, QMargins(6, 6, 6, 6), pixmap);
  704. break;
  705. }
  706. case PE_IndicatorBranch: {
  707. if (!(option->state & State_Children))
  708. break;
  709. if (option->state & State_Open)
  710. drawPrimitive(PE_IndicatorArrowDown, option, painter, widget);
  711. else
  712. drawPrimitive(PE_IndicatorArrowRight, option, painter, widget);
  713. break;
  714. }
  715. case PE_FrameTabBarBase:
  716. if (const QStyleOptionTabBarBase *tbb
  717. = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
  718. painter->save();
  719. painter->setPen(QPen(outline.lighter(110), 0));
  720. switch (tbb->shape) {
  721. case QTabBar::RoundedNorth: {
  722. QRegion region(tbb->rect);
  723. region -= tbb->selectedTabRect;
  724. painter->drawLine(tbb->rect.topLeft(), tbb->rect.topRight());
  725. painter->setClipRegion(region);
  726. painter->setPen(option->palette.light().color());
  727. painter->drawLine(tbb->rect.topLeft() + QPoint(0, 1), tbb->rect.topRight() + QPoint(0, 1));
  728. }
  729. break;
  730. case QTabBar::RoundedWest:
  731. painter->drawLine(tbb->rect.left(), tbb->rect.top(), tbb->rect.left(), tbb->rect.bottom());
  732. break;
  733. case QTabBar::RoundedSouth:
  734. painter->drawLine(tbb->rect.left(), tbb->rect.bottom(),
  735. tbb->rect.right(), tbb->rect.bottom());
  736. break;
  737. case QTabBar::RoundedEast:
  738. painter->drawLine(tbb->rect.topRight(), tbb->rect.bottomRight());
  739. break;
  740. case QTabBar::TriangularNorth:
  741. case QTabBar::TriangularEast:
  742. case QTabBar::TriangularWest:
  743. case QTabBar::TriangularSouth:
  744. painter->restore();
  745. QCommonStyle::drawPrimitive(elem, option, painter, widget);
  746. return;
  747. }
  748. painter->restore();
  749. }
  750. return;
  751. case PE_PanelScrollAreaCorner: {
  752. painter->save();
  753. QColor alphaOutline = outline;
  754. alphaOutline.setAlpha(180);
  755. painter->setPen(alphaOutline);
  756. painter->setBrush(option->palette.brush(QPalette::Window));
  757. painter->drawRect(option->rect);
  758. painter->restore();
  759. } break;
  760. case PE_IndicatorArrowUp:
  761. case PE_IndicatorArrowDown:
  762. case PE_IndicatorArrowRight:
  763. case PE_IndicatorArrowLeft:
  764. {
  765. if (option->rect.width() <= 1 || option->rect.height() <= 1)
  766. break;
  767. QColor arrowColor = qt_palette_fg_color(option->palette);
  768. QPixmap arrow;
  769. int rotation = 0;
  770. switch (elem) {
  771. case PE_IndicatorArrowDown:
  772. rotation = 180;
  773. break;
  774. case PE_IndicatorArrowRight:
  775. rotation = 90;
  776. break;
  777. case PE_IndicatorArrowLeft:
  778. rotation = -90;
  779. break;
  780. default:
  781. break;
  782. }
  783. arrow = colorizedImage(QLatin1String(":/bitmaps/style/arrow.png"), arrowColor, rotation);
  784. QRect rect = option->rect;
  785. QRect arrowRect;
  786. int imageMax = qMin(arrow.height(), arrow.width());
  787. int rectMax = qMin(rect.height(), rect.width());
  788. int size = qMin(imageMax, rectMax);
  789. arrowRect.setWidth(size);
  790. arrowRect.setHeight(size);
  791. if (arrow.width() > arrow.height())
  792. arrowRect.setHeight(arrow.height() * size / arrow.width());
  793. else
  794. arrowRect.setWidth(arrow.width() * size / arrow.height());
  795. arrowRect.moveTopLeft(rect.center() - arrowRect.center());
  796. painter->save();
  797. painter->setRenderHint(QPainter::SmoothPixmapTransform);
  798. painter->drawPixmap(arrowRect, arrow);
  799. painter->restore();
  800. }
  801. break;
  802. case PE_IndicatorViewItemCheck:
  803. {
  804. QStyleOptionButton button;
  805. button.QStyleOption::operator=(*option);
  806. button.state &= ~State_MouseOver;
  807. proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
  808. }
  809. return;
  810. case PE_IndicatorHeaderArrow:
  811. if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
  812. QRect r = header->rect;
  813. QPixmap arrow;
  814. QColor arrowColor = qt_palette_fg_color(header->palette);
  815. QPoint offset = QPoint(0, -1);
  816. if (header->sortIndicator & QStyleOptionHeader::SortUp) {
  817. arrow = colorizedImage(QLatin1String(":/bitmaps/style/arrow.png"), arrowColor);
  818. } else if (header->sortIndicator & QStyleOptionHeader::SortDown) {
  819. arrow = colorizedImage(QLatin1String(":/bitmaps/style/arrow.png"), arrowColor, 180);
  820. } if (!arrow.isNull()) {
  821. r.setSize(QSize(arrow.width()/2, arrow.height()/2));
  822. r.moveCenter(header->rect.center());
  823. painter->drawPixmap(r.translated(offset), arrow);
  824. }
  825. }
  826. break;
  827. case PE_IndicatorButtonDropDown:
  828. proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
  829. break;
  830. case PE_IndicatorToolBarSeparator:
  831. {
  832. QRect rect = option->rect;
  833. const int margin = 6;
  834. QColor separator_color = option->palette.text().color();
  835. separator_color.setAlpha(50);
  836. painter->setPen(QPen(separator_color));
  837. if (option->state & State_Horizontal) {
  838. const int offset = rect.width()/2;
  839. painter->drawLine(rect.bottomLeft().x() + offset,
  840. rect.bottomLeft().y() - margin,
  841. rect.topLeft().x() + offset,
  842. rect.topLeft().y() + margin);
  843. painter->setPen(QPen(qt_palette_bg_color(option->palette).lighter(110)));
  844. painter->drawLine(rect.bottomLeft().x() + offset + 1,
  845. rect.bottomLeft().y() - margin,
  846. rect.topLeft().x() + offset + 1,
  847. rect.topLeft().y() + margin);
  848. } else { //Draw vertical separator
  849. const int offset = rect.height()/2;
  850. painter->drawLine(rect.topLeft().x() + margin ,
  851. rect.topLeft().y() + offset,
  852. rect.topRight().x() - margin,
  853. rect.topRight().y() + offset);
  854. painter->setPen(QPen(qt_palette_bg_color(option->palette).lighter(110)));
  855. painter->drawLine(rect.topLeft().x() + margin ,
  856. rect.topLeft().y() + offset + 1,
  857. rect.topRight().x() - margin,
  858. rect.topRight().y() + offset + 1);
  859. }
  860. }
  861. break;
  862. case PE_Frame:
  863. if (widget && widget->inherits("QComboBoxPrivateContainer")){
  864. QStyleOption copy = *option;
  865. copy.state |= State_Raised;
  866. proxy()->drawPrimitive(PE_PanelMenu, &copy, painter, widget);
  867. break;
  868. }
  869. painter->save();
  870. painter->setPen(outline.lighter(108));
  871. painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
  872. painter->restore();
  873. break;
  874. case PE_FrameMenu:
  875. painter->save();
  876. {
  877. painter->setPen(QPen(outline, 1));
  878. painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
  879. QColor frameLight = qt_palette_bg_color(option->palette).lighter(160);
  880. QColor frameShadow = qt_palette_bg_color(option->palette).darker(110);
  881. //paint beveleffect
  882. QRect frame = option->rect.adjusted(1, 1, -1, -1);
  883. painter->setPen(frameLight);
  884. painter->drawLine(frame.topLeft(), frame.bottomLeft());
  885. painter->drawLine(frame.topLeft(), frame.topRight());
  886. painter->setPen(frameShadow);
  887. painter->drawLine(frame.topRight(), frame.bottomRight());
  888. painter->drawLine(frame.bottomLeft(), frame.bottomRight());
  889. }
  890. painter->restore();
  891. break;
  892. case PE_FrameDockWidget:
  893. painter->save();
  894. {
  895. QColor softshadow = qt_palette_bg_color(option->palette).darker(120);
  896. QRect rect= option->rect;
  897. painter->setPen(softshadow);
  898. painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
  899. painter->setPen(QPen(option->palette.light(), 0));
  900. painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), QPoint(rect.left() + 1, rect.bottom() - 1));
  901. painter->setPen(QPen(qt_palette_bg_color(option->palette).darker(120), 0));
  902. painter->drawLine(QPoint(rect.left() + 1, rect.bottom() - 1), QPoint(rect.right() - 2, rect.bottom() - 1));
  903. painter->drawLine(QPoint(rect.right() - 1, rect.top() + 1), QPoint(rect.right() - 1, rect.bottom() - 1));
  904. }
  905. painter->restore();
  906. break;
  907. case PE_PanelButtonTool:
  908. painter->save();
  909. if ((option->state & State_Enabled || option->state & State_On) || !(option->state & State_AutoRaise)) {
  910. if (widget && widget->inherits("QDockWidgetTitleButton")) {
  911. if (option->state & State_MouseOver)
  912. proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
  913. } else {
  914. proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
  915. }
  916. }
  917. painter->restore();
  918. break;
  919. case PE_IndicatorDockWidgetResizeHandle:
  920. {
  921. QStyleOption dockWidgetHandle = *option;
  922. bool horizontal = option->state & State_Horizontal;
  923. if (horizontal)
  924. dockWidgetHandle.state &= ~State_Horizontal;
  925. else
  926. dockWidgetHandle.state |= State_Horizontal;
  927. proxy()->drawControl(CE_Splitter, &dockWidgetHandle, painter, widget);
  928. }
  929. break;
  930. case PE_FrameWindow:
  931. painter->save();
  932. {
  933. QRect rect= option->rect;
  934. painter->setPen(QPen(outline.darker(150), 0));
  935. painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
  936. painter->setPen(QPen(option->palette.light(), 0));
  937. painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1),
  938. QPoint(rect.left() + 1, rect.bottom() - 1));
  939. painter->setPen(QPen(qt_palette_bg_color(option->palette).darker(120), 0));
  940. painter->drawLine(QPoint(rect.left() + 1, rect.bottom() - 1),
  941. QPoint(rect.right() - 2, rect.bottom() - 1));
  942. painter->drawLine(QPoint(rect.right() - 1, rect.top() + 1),
  943. QPoint(rect.right() - 1, rect.bottom() - 1));
  944. }
  945. painter->restore();
  946. break;
  947. case PE_FrameLineEdit:
  948. {
  949. QRect r = rect;
  950. bool hasFocus = option->state & State_HasFocus;
  951. painter->save();
  952. painter->setRenderHint(QPainter::Antialiasing, true);
  953. // ### highdpi painter bug.
  954. painter->translate(0.5, 0.5);
  955. // Draw Outline
  956. painter->setPen( QPen(hasFocus ? highlightedOutline : highlightedOutline.darker(160), 0));
  957. painter->setBrush(option->palette.base());
  958. painter->drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2);
  959. if (hasFocus) {
  960. QColor softHighlight = highlightedOutline;
  961. softHighlight.setAlpha(40);
  962. painter->setPen(softHighlight);
  963. painter->drawRoundedRect(r.adjusted(1, 1, -2, -2), 1.7, 1.7);
  964. }
  965. // Draw inner shadow
  966. painter->setPen(d->topShadow());
  967. painter->drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1));
  968. painter->restore();
  969. }
  970. break;
  971. case PE_IndicatorCheckBox:
  972. painter->save();
  973. if (const QStyleOptionButton *checkbox = qstyleoption_cast<const QStyleOptionButton*>(option)) {
  974. painter->setRenderHint(QPainter::Antialiasing, true);
  975. painter->translate(0.5, 0.5);
  976. rect = rect.adjusted(0, 0, -1, -1);
  977. const QColor& baseColor = option->palette.base().color();
  978. QColor pressedColor = mergedColors(baseColor, qt_palette_fg_color(option->palette), 85);
  979. painter->setBrush(Qt::NoBrush);
  980. // Gradient fill
  981. QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
  982. if (state & State_Sunken)
  983. {
  984. gradient.setColorAt(0, pressedColor);
  985. gradient.setColorAt(0.15, pressedColor);
  986. gradient.setColorAt(1, pressedColor);
  987. }
  988. else
  989. {
  990. gradient.setColorAt(0, baseColor.blackF() > 0.4 ? baseColor.lighter(115) : baseColor.darker(115));
  991. gradient.setColorAt(0.15, baseColor);
  992. gradient.setColorAt(1, baseColor);
  993. }
  994. painter->setBrush((state & State_Sunken) ? QBrush(pressedColor) : gradient);
  995. if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
  996. painter->setPen(QPen(highlightedOutline, 1));
  997. else
  998. painter->setPen(QPen(outline.lighter(110), 1));
  999. painter->drawRect(rect);
  1000. QColor checkMarkColor = option->palette.text().color().darker(120);
  1001. if (checkbox->state & State_NoChange) {
  1002. gradient = QLinearGradient(rect.topLeft(), rect.bottomLeft());
  1003. checkMarkColor.setAlpha(80);
  1004. gradient.setColorAt(0, checkMarkColor);
  1005. checkMarkColor.setAlpha(140);
  1006. gradient.setColorAt(1, checkMarkColor);
  1007. checkMarkColor.setAlpha(180);
  1008. painter->setPen(QPen(checkMarkColor, 1));
  1009. painter->setBrush(gradient);
  1010. painter->drawRect(rect.adjusted(3, 3, -3, -3));
  1011. } else if (checkbox->state & (State_On)) {
  1012. QPen checkPen = QPen(checkMarkColor, 1.8);
  1013. checkMarkColor.setAlpha(210);
  1014. painter->translate(-1, 0.5);
  1015. painter->setPen(checkPen);
  1016. painter->setBrush(Qt::NoBrush);
  1017. painter->translate(0.2, 0.0);
  1018. // Draw checkmark
  1019. QPainterPath path;
  1020. path.moveTo(5, rect.height() / 2.0);
  1021. path.lineTo(rect.width() / 2.0 - 0, rect.height() - 3);
  1022. path.lineTo(rect.width() - 2.5, 3);
  1023. painter->drawPath(path.translated(rect.topLeft()));
  1024. }
  1025. }
  1026. painter->restore();
  1027. break;
  1028. case PE_IndicatorRadioButton:
  1029. painter->save();
  1030. {
  1031. QColor pressedColor = mergedColors(option->palette.base().color(), qt_palette_fg_color(option->palette), 85);
  1032. painter->setBrush((state & State_Sunken) ? pressedColor : option->palette.base().color());
  1033. painter->setRenderHint(QPainter::Antialiasing, true);
  1034. QPainterPath circle;
  1035. circle.addEllipse(rect.center() + QPoint(1.0, 1.0), 6.5, 6.5);
  1036. painter->setPen(QPen(qt_palette_bg_color(option->palette).darker(150), 1));
  1037. if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
  1038. painter->setPen(QPen(highlightedOutline, 1));
  1039. painter->drawPath(circle);
  1040. if (state & (State_On )) {
  1041. circle = QPainterPath();
  1042. circle.addEllipse(rect.center() + QPoint(1, 1), 2.8, 2.8);
  1043. QColor checkMarkColor = option->palette.text().color().darker(120);
  1044. checkMarkColor.setAlpha(200);
  1045. painter->setPen(checkMarkColor);
  1046. checkMarkColor.setAlpha(180);
  1047. painter->setBrush(checkMarkColor);
  1048. painter->drawPath(circle);
  1049. }
  1050. }
  1051. painter->restore();
  1052. break;
  1053. case PE_IndicatorToolBarHandle:
  1054. {
  1055. //draw grips
  1056. if (option->state & State_Horizontal) {
  1057. for (int i = -3 ; i < 2 ; i += 3) {
  1058. for (int j = -8 ; j < 10 ; j += 3) {
  1059. painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade());
  1060. painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade());
  1061. }
  1062. }
  1063. } else { //vertical toolbar
  1064. for (int i = -6 ; i < 12 ; i += 3) {
  1065. for (int j = -3 ; j < 2 ; j += 3) {
  1066. painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade());
  1067. painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade());
  1068. }
  1069. }
  1070. }
  1071. break;
  1072. }
  1073. case PE_FrameDefaultButton:
  1074. break;
  1075. case PE_FrameFocusRect:
  1076. if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) {
  1077. //### check for d->alt_down
  1078. if (!(fropt->state & State_KeyboardFocusChange))
  1079. return;
  1080. QRect rect = option->rect;
  1081. painter->save();
  1082. painter->setRenderHint(QPainter::Antialiasing, true);
  1083. painter->translate(0.5, 0.5);
  1084. QColor fillcolor = highlightedOutline;
  1085. fillcolor.setAlpha(80);
  1086. painter->setPen(fillcolor.darker(120));
  1087. fillcolor.setAlpha(30);
  1088. QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
  1089. gradient.setColorAt(0, fillcolor.lighter(160));
  1090. gradient.setColorAt(1, fillcolor);
  1091. painter->setBrush(gradient);
  1092. painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 1, 1);
  1093. painter->restore();
  1094. }
  1095. break;
  1096. case PE_PanelButtonCommand:
  1097. {
  1098. bool isDefault = false;
  1099. bool isFlat = false;
  1100. bool isDown = (option->state & State_Sunken) || (option->state & State_On);
  1101. QRect r;
  1102. if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option)) {
  1103. isDefault = (button->features & QStyleOptionButton::DefaultButton) && (button->state & State_Enabled);
  1104. isFlat = (button->features & QStyleOptionButton::Flat);
  1105. }
  1106. if (isFlat && !isDown) {
  1107. if (isDefault) {
  1108. r = option->rect.adjusted(0, 1, 0, -1);
  1109. painter->setPen(QPen(Qt::black, 0));
  1110. const QLine lines[4] = {
  1111. QLine(QPoint(r.left() + 2, r.top()),
  1112. QPoint(r.right() - 2, r.top())),
  1113. QLine(QPoint(r.left(), r.top() + 2),
  1114. QPoint(r.left(), r.bottom() - 2)),
  1115. QLine(QPoint(r.right(), r.top() + 2),
  1116. QPoint(r.right(), r.bottom() - 2)),
  1117. QLine(QPoint(r.left() + 2, r.bottom()),
  1118. QPoint(r.right() - 2, r.bottom()))
  1119. };
  1120. painter->drawLines(lines, 4);
  1121. const QPoint points[4] = {
  1122. QPoint(r.right() - 1, r.bottom() - 1),
  1123. QPoint(r.right() - 1, r.top() + 1),
  1124. QPoint(r.left() + 1, r.bottom() - 1),
  1125. QPoint(r.left() + 1, r.top() + 1)
  1126. };
  1127. painter->drawPoints(points, 4);
  1128. }
  1129. return;
  1130. }
  1131. BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("pushbutton-%1").arg(isDefault))
  1132. r = rect.adjusted(0, 1, -1, 0);
  1133. bool isEnabled = option->state & State_Enabled;
  1134. bool hasFocus = (option->state & State_HasFocus && option->state & State_KeyboardFocusChange);
  1135. QColor buttonColor = d->buttonColor(option->palette);
  1136. QColor darkOutline = outline;
  1137. if (hasFocus || isDefault) {
  1138. darkOutline = highlightedOutline;
  1139. }
  1140. if (isDefault)
  1141. buttonColor = mergedColors(buttonColor, highlightedOutline.lighter(130), 90);
  1142. p->setRenderHint(QPainter::Antialiasing, true);
  1143. p->translate(0.5, -0.5);
  1144. QLinearGradient gradient = qt_fusion_gradient(rect, (isEnabled && option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104));
  1145. p->setBrush(isDown ? QBrush(buttonColor.darker(110)) : gradient);
  1146. p->setPen(QPen(p->brush(), 1));
  1147. p->drawRoundedRect(r.adjusted(1,1,-1,-1), 1.8, 1.8);
  1148. p->setBrush(Qt::NoBrush);
  1149. // Outline
  1150. p->setPen(!isEnabled ? QPen(darkOutline.lighter(115)) : QPen(darkOutline, 1));
  1151. p->drawRoundedRect(r, 2.5, 2.5);
  1152. p->setPen(d->innerContrastLine());
  1153. p->drawRoundedRect(r.adjusted(1, 1, -1, -1), 1.8, 1.8);
  1154. END_STYLE_PIXMAPCACHE
  1155. }
  1156. break;
  1157. case PE_FrameTabWidget:
  1158. painter->save();
  1159. painter->fillRect(option->rect.adjusted(0, 0, -1, -1), tabFrameColor);
  1160. if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
  1161. QColor borderColor = outline.lighter(110);
  1162. QRect rect = option->rect.adjusted(0, 0, -1, -1);
  1163. // Shadow outline
  1164. if (twf->shape != QTabBar::RoundedSouth) {
  1165. rect.adjust(0, 0, 0, -1);
  1166. QColor alphaShadow(Qt::black);
  1167. alphaShadow.setAlpha(15);
  1168. painter->setPen(alphaShadow);
  1169. painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); painter->setPen(borderColor);
  1170. }
  1171. // outline
  1172. painter->setPen(outline);
  1173. painter->drawRect(rect);
  1174. // Inner frame highlight
  1175. painter->setPen(d->innerContrastLine());
  1176. painter->drawRect(rect.adjusted(1, 1, -1, -1));
  1177. }
  1178. painter->restore();
  1179. break ;
  1180. case PE_FrameStatusBarItem:
  1181. break;
  1182. case PE_IndicatorTabClose:
  1183. {
  1184. if (d->tabBarcloseButtonIcon.isNull())
  1185. d->tabBarcloseButtonIcon = standardIcon(SP_DialogCloseButton, option, widget);
  1186. if ((option->state & State_Enabled) && (option->state & State_MouseOver))
  1187. proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
  1188. QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(QSize(16, 16), QIcon::Normal, QIcon::On);
  1189. proxy()->drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap);
  1190. }
  1191. break;
  1192. case PE_PanelMenu: {
  1193. painter->save();
  1194. const QBrush menuBackground = option->palette.base().color().lighter(108);
  1195. QColor borderColor(32, 32, 32);
  1196. qDrawPlainRect(painter, option->rect, borderColor, 1, &menuBackground);
  1197. painter->restore();
  1198. }
  1199. break;
  1200. default:
  1201. QCommonStyle::drawPrimitive(elem, option, painter, widget);
  1202. break;
  1203. }
  1204. }
  1205. /*!
  1206. \reimp
  1207. */
  1208. void CarlaStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter,
  1209. const QWidget *widget) const
  1210. {
  1211. QRect rect = option->rect;
  1212. QColor outline = d->outline(option->palette);
  1213. QColor highlightedOutline = d->highlightedOutline(option->palette);
  1214. QColor shadow = d->darkShade();
  1215. switch (element) {
  1216. case CE_ComboBoxLabel:
  1217. if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
  1218. QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
  1219. painter->save();
  1220. painter->setClipRect(editRect);
  1221. if (!cb->currentIcon.isNull()) {
  1222. QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
  1223. : QIcon::Disabled;
  1224. QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
  1225. QRect iconRect(editRect);
  1226. iconRect.setWidth(cb->iconSize.width() + 4);
  1227. iconRect = alignedRect(cb->direction,
  1228. Qt::AlignLeft | Qt::AlignVCenter,
  1229. iconRect.size(), editRect);
  1230. if (cb->editable)
  1231. painter->fillRect(iconRect, cb->palette.brush(QPalette::Base));
  1232. proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
  1233. if (cb->direction == Qt::RightToLeft)
  1234. editRect.translate(-4 - cb->iconSize.width(), 0);
  1235. else
  1236. editRect.translate(cb->iconSize.width() + 4, 0);
  1237. }
  1238. if (!cb->currentText.isEmpty() && !cb->editable) {
  1239. proxy()->drawItemText(painter, editRect.adjusted(1, 0, -1, 0),
  1240. visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter),
  1241. cb->palette, cb->state & State_Enabled, cb->currentText,
  1242. cb->editable ? QPalette::Text : QPalette::ButtonText);
  1243. }
  1244. painter->restore();
  1245. }
  1246. break;
  1247. case CE_Splitter:
  1248. {
  1249. // Don't draw handle for single pixel splitters
  1250. if (option->rect.width() > 1 && option->rect.height() > 1) {
  1251. //draw grips
  1252. if (option->state & State_Horizontal) {
  1253. for (int j = -6 ; j< 12 ; j += 3) {
  1254. painter->fillRect(rect.center().x() + 1, rect.center().y() + j, 2, 2, d->lightShade());
  1255. painter->fillRect(rect.center().x() + 1, rect.center().y() + j, 1, 1, d->darkShade());
  1256. }
  1257. } else {
  1258. for (int i = -6; i< 12 ; i += 3) {
  1259. painter->fillRect(rect.center().x() + i, rect.center().y(), 2, 2, d->lightShade());
  1260. painter->fillRect(rect.center().x() + i, rect.center().y(), 1, 1, d->darkShade());
  1261. }
  1262. }
  1263. }
  1264. break;
  1265. }
  1266. case CE_RubberBand:
  1267. if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) {
  1268. QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
  1269. painter->save();
  1270. QColor penColor = highlight.darker(120);
  1271. penColor.setAlpha(180);
  1272. painter->setPen(penColor);
  1273. QColor dimHighlight(qMin(highlight.red()/2 + 110, 255),
  1274. qMin(highlight.green()/2 + 110, 255),
  1275. qMin(highlight.blue()/2 + 110, 255));
  1276. dimHighlight.setAlpha(widget && widget->isTopLevel() ? 255 : 80);
  1277. QLinearGradient gradient(rect.topLeft(), QPoint(rect.bottomLeft().x(), rect.bottomLeft().y()));
  1278. gradient.setColorAt(0, dimHighlight.lighter(120));
  1279. gradient.setColorAt(1, dimHighlight);
  1280. painter->setRenderHint(QPainter::Antialiasing, true);
  1281. painter->translate(0.5, 0.5);
  1282. painter->setBrush(dimHighlight);
  1283. painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 1.3, 1.3);
  1284. QColor innerLine = Qt::white;
  1285. innerLine.setAlpha(40);
  1286. painter->setPen(innerLine);
  1287. painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 0.7, 0.7);
  1288. painter->restore();
  1289. return;
  1290. }
  1291. break;
  1292. case CE_SizeGrip:
  1293. painter->save();
  1294. {
  1295. //draw grips
  1296. for (int i = -6; i< 12 ; i += 3) {
  1297. for (int j = -6 ; j< 12 ; j += 3) {
  1298. if ((option->direction == Qt::LeftToRight && i > -j) || (option->direction == Qt::RightToLeft && j > i) ) {
  1299. painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade());
  1300. painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade());
  1301. }
  1302. }
  1303. }
  1304. }
  1305. painter->restore();
  1306. break;
  1307. case CE_ToolBar:
  1308. if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
  1309. // Reserve the beveled appearance only for mainwindow toolbars
  1310. if (widget && !(qobject_cast<const QMainWindow*> (widget->parentWidget())))
  1311. break;
  1312. // Draws the light line above and the dark line below menu bars and
  1313. // tool bars.
  1314. QLinearGradient gradient(option->rect.topLeft(), option->rect.bottomLeft());
  1315. if (!(option->state & State_Horizontal))
  1316. gradient = QLinearGradient(rect.left(), rect.center().y(),
  1317. rect.right(), rect.center().y());
  1318. gradient.setColorAt(0, option->palette.window().color().lighter(104));
  1319. gradient.setColorAt(1, option->palette.window().color());
  1320. painter->fillRect(option->rect, gradient);
  1321. QColor light = d->lightShade();
  1322. QColor shadow = d->darkShade();
  1323. QPen oldPen = painter->pen();
  1324. if (toolBar->toolBarArea == Qt::TopToolBarArea) {
  1325. if (toolBar->positionOfLine == QStyleOptionToolBar::End
  1326. || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
  1327. // The end and onlyone top toolbar lines draw a double
  1328. // line at the bottom to blend with the central
  1329. // widget.
  1330. painter->setPen(light);
  1331. painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
  1332. painter->setPen(shadow);
  1333. painter->drawLine(option->rect.left(), option->rect.bottom() - 1,
  1334. option->rect.right(), option->rect.bottom() - 1);
  1335. } else {
  1336. // All others draw a single dark line at the bottom.
  1337. painter->setPen(shadow);
  1338. painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
  1339. }
  1340. // All top toolbar lines draw a light line at the top.
  1341. painter->setPen(light);
  1342. painter->drawLine(option->rect.topLeft(), option->rect.topRight());
  1343. } else if (toolBar->toolBarArea == Qt::BottomToolBarArea) {
  1344. if (toolBar->positionOfLine == QStyleOptionToolBar::End
  1345. || toolBar->positionOfLine == QStyleOptionToolBar::Middle) {
  1346. // The end and middle bottom tool bar lines draw a dark
  1347. // line at the bottom.
  1348. painter->setPen(shadow);
  1349. painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
  1350. }
  1351. if (toolBar->positionOfLine == QStyleOptionToolBar::Beginning
  1352. || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
  1353. // The beginning and only one tool bar lines draw a
  1354. // double line at the bottom to blend with the
  1355. // status bar.
  1356. // ### The styleoption could contain whether the
  1357. // main window has a menu bar and a status bar, and
  1358. // possibly dock widgets.
  1359. painter->setPen(shadow);
  1360. painter->drawLine(option->rect.left(), option->rect.bottom() - 1,
  1361. option->rect.right(), option->rect.bottom() - 1);
  1362. painter->setPen(light);
  1363. painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
  1364. }
  1365. if (toolBar->positionOfLine == QStyleOptionToolBar::End) {
  1366. painter->setPen(shadow);
  1367. painter->drawLine(option->rect.topLeft(), option->rect.topRight());
  1368. painter->setPen(light);
  1369. painter->drawLine(option->rect.left(), option->rect.top() + 1,
  1370. option->rect.right(), option->rect.top() + 1);
  1371. } else {
  1372. // All other bottom toolbars draw a light line at the top.
  1373. painter->setPen(light);
  1374. painter->drawLine(option->rect.topLeft(), option->rect.topRight());
  1375. }
  1376. }
  1377. if (toolBar->toolBarArea == Qt::LeftToolBarArea) {
  1378. if (toolBar->positionOfLine == QStyleOptionToolBar::Middle
  1379. || toolBar->positionOfLine == QStyleOptionToolBar::End) {
  1380. // The middle and left end toolbar lines draw a light
  1381. // line to the left.
  1382. painter->setPen(light);
  1383. painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft());
  1384. }
  1385. if (toolBar->positionOfLine == QStyleOptionToolBar::End) {
  1386. // All other left toolbar lines draw a dark line to the right
  1387. painter->setPen(shadow);
  1388. painter->drawLine(option->rect.right() - 1, option->rect.top(),
  1389. option->rect.right() - 1, option->rect.bottom());
  1390. painter->setPen(light);
  1391. painter->drawLine(option->rect.topRight(), option->rect.bottomRight());
  1392. } else {
  1393. // All other left toolbar lines draw a dark line to the right
  1394. painter->setPen(shadow);
  1395. painter->drawLine(option->rect.topRight(), option->rect.bottomRight());
  1396. }
  1397. } else if (toolBar->toolBarArea == Qt::RightToolBarArea) {
  1398. if (toolBar->positionOfLine == QStyleOptionToolBar::Middle
  1399. || toolBar->positionOfLine == QStyleOptionToolBar::End) {
  1400. // Right middle and end toolbar lines draw the dark right line
  1401. painter->setPen(shadow);
  1402. painter->drawLine(option->rect.topRight(), option->rect.bottomRight());
  1403. }
  1404. if (toolBar->positionOfLine == QStyleOptionToolBar::End
  1405. || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
  1406. // The right end and single toolbar draws the dark
  1407. // line on its left edge
  1408. painter->setPen(shadow);
  1409. painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft());
  1410. // And a light line next to it
  1411. painter->setPen(light);
  1412. painter->drawLine(option->rect.left() + 1, option->rect.top(),
  1413. option->rect.left() + 1, option->rect.bottom());
  1414. } else {
  1415. // Other right toolbars draw a light line on its left edge
  1416. painter->setPen(light);
  1417. painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft());
  1418. }
  1419. }
  1420. painter->setPen(oldPen);
  1421. }
  1422. break;
  1423. case CE_DockWidgetTitle:
  1424. painter->save();
  1425. if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
  1426. bool verticalTitleBar = false;
  1427. QRect titleRect = subElementRect(SE_DockWidgetTitleBarText, option, widget);
  1428. if (verticalTitleBar) {
  1429. QRect rect = dwOpt->rect;
  1430. QRect r = rect;
  1431. QSize s = r.size();
  1432. s.transpose();
  1433. r.setSize(s);
  1434. titleRect = QRect(r.left() + rect.bottom()
  1435. - titleRect.bottom(),
  1436. r.top() + titleRect.left() - rect.left(),
  1437. titleRect.height(), titleRect.width());
  1438. painter->translate(r.left(), r.top() + r.width());
  1439. painter->rotate(-90);
  1440. painter->translate(-r.left(), -r.top());
  1441. }
  1442. if (!dwOpt->title.isEmpty()) {
  1443. QString titleText
  1444. = painter->fontMetrics().elidedText(dwOpt->title,
  1445. Qt::ElideRight, titleRect.width());
  1446. proxy()->drawItemText(painter,
  1447. titleRect,
  1448. Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette,
  1449. dwOpt->state & State_Enabled, titleText,
  1450. QPalette::WindowText);
  1451. }
  1452. }
  1453. painter->restore();
  1454. break;
  1455. case CE_HeaderSection:
  1456. painter->save();
  1457. // Draws the header in tables.
  1458. if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
  1459. QString pixmapName = uniqueName(QLatin1String("headersection"), option, option->rect.size());
  1460. pixmapName += QString::number(- int(header->position));
  1461. pixmapName += QString::number(- int(header->orientation));
  1462. QPixmap cache;
  1463. if (!QPixmapCache::find(pixmapName, PIXMAPCACHE_VAR_PREFIX cache)) {
  1464. cache = styleCachePixmap(rect.size());
  1465. cache.fill(Qt::transparent);
  1466. QRect pixmapRect(0, 0, rect.width(), rect.height());
  1467. QPainter cachePainter(&cache);
  1468. QColor buttonColor = d->buttonColor(option->palette);
  1469. QColor gradientStopColor;
  1470. QColor gradientStartColor = buttonColor.lighter(104);
  1471. gradientStopColor = buttonColor.darker(102);
  1472. QLinearGradient gradient(pixmapRect.topLeft(), pixmapRect.bottomLeft());
  1473. #if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
  1474. const QGradient* gradientBrush = option->palette.window().gradient();
  1475. #else
  1476. const QGradient* gradientBrush = option->palette.background().gradient();
  1477. #endif
  1478. if (gradientBrush) {
  1479. gradient.setStops(gradientBrush->stops());
  1480. } else {
  1481. QColor midColor1 = mergedColors(gradientStartColor, gradientStopColor, 60);
  1482. QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40);
  1483. gradient.setColorAt(0, gradientStartColor);
  1484. gradient.setColorAt(0.5, midColor1);
  1485. gradient.setColorAt(0.501, midColor2);
  1486. gradient.setColorAt(0.92, gradientStopColor);
  1487. gradient.setColorAt(1, gradientStopColor.darker(104));
  1488. }
  1489. cachePainter.fillRect(pixmapRect, gradient);
  1490. cachePainter.setPen(d->innerContrastLine());
  1491. cachePainter.setBrush(Qt::NoBrush);
  1492. cachePainter.drawLine(pixmapRect.topLeft(), pixmapRect.topRight());
  1493. cachePainter.setPen(d->outline(option->palette));
  1494. cachePainter.drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight());
  1495. if (header->orientation == Qt::Horizontal &&
  1496. header->position != QStyleOptionHeader::End &&
  1497. header->position != QStyleOptionHeader::OnlyOneSection) {
  1498. cachePainter.setPen(QColor(0, 0, 0, 40));
  1499. cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight() + QPoint(0, -1));
  1500. cachePainter.setPen(d->innerContrastLine());
  1501. cachePainter.drawLine(pixmapRect.topRight() + QPoint(-1, 0), pixmapRect.bottomRight() + QPoint(-1, -1));
  1502. } else if (header->orientation == Qt::Vertical) {
  1503. cachePainter.setPen(d->outline(option->palette));
  1504. cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight());
  1505. }
  1506. cachePainter.end();
  1507. QPixmapCache::insert(pixmapName, cache);
  1508. }
  1509. painter->drawPixmap(rect.topLeft(), cache);
  1510. }
  1511. painter->restore();
  1512. break;
  1513. case CE_ProgressBarGroove:
  1514. painter->save();
  1515. {
  1516. painter->setRenderHint(QPainter::Antialiasing, true);
  1517. painter->translate(0.5, 0.5);
  1518. QColor shadowAlpha = Qt::black;
  1519. shadowAlpha.setAlpha(16);
  1520. painter->setPen(shadowAlpha);
  1521. painter->drawLine(rect.topLeft() - QPoint(0, 1), rect.topRight() - QPoint(0, 1));
  1522. painter->setBrush(Qt::NoBrush);
  1523. painter->setPen(QPen(outline, 1));
  1524. painter->drawRoundedRect(rect.adjusted(0, 0, -1, -1), 2.5, 2.5);
  1525. painter->setBrush(option->palette.base());
  1526. painter->setPen(QPen(option->palette.base(), 1));
  1527. painter->drawRoundedRect(rect.adjusted(1, 1, -2, -2), 1.8, 1.8);
  1528. // Inner shadow
  1529. painter->setPen(d->topShadow());
  1530. painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1),
  1531. QPoint(rect.right() - 1, rect.top() + 1));
  1532. }
  1533. painter->restore();
  1534. break;
  1535. case CE_ProgressBarContents:
  1536. painter->save();
  1537. painter->setRenderHint(QPainter::Antialiasing, true);
  1538. painter->translate(0.5, 0.5);
  1539. if (const QStyleOptionProgressBarV2 *bar = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
  1540. bool vertical = false;
  1541. bool inverted = false;
  1542. bool indeterminate = (bar->minimum == 0 && bar->maximum == 0);
  1543. bool complete = bar->progress == bar->maximum;
  1544. // Get extra style options if version 2
  1545. vertical = (bar->orientation == Qt::Vertical);
  1546. inverted = bar->invertedAppearance;
  1547. // If the orientation is vertical, we use a transform to rotate
  1548. // the progress bar 90 degrees clockwise. This way we can use the
  1549. // same rendering code for both orientations.
  1550. if (vertical) {
  1551. rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
  1552. QTransform m = QTransform::fromTranslate(rect.height()-1, -1.0);
  1553. m.rotate(90.0);
  1554. painter->setTransform(m, true);
  1555. }
  1556. int maxWidth = rect.width();
  1557. int minWidth = 0;
  1558. qreal progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
  1559. int progressBarWidth = (progress - bar->minimum) * qreal(maxWidth) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
  1560. int width = indeterminate ? maxWidth : qMax(minWidth, progressBarWidth);
  1561. bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
  1562. if (inverted)
  1563. reverse = !reverse;
  1564. int step = 0;
  1565. QRect progressBar;
  1566. QColor highlight = d->highlight(option->palette);
  1567. QColor highlightedoutline = highlight.darker(140);
  1568. if (qGray(outline.rgb()) > qGray(highlightedoutline.rgb()))
  1569. outline = highlightedoutline;
  1570. if (!indeterminate) {
  1571. QColor innerShadow(Qt::black);
  1572. innerShadow.setAlpha(35);
  1573. painter->setPen(innerShadow);
  1574. if (!reverse) {
  1575. progressBar.setRect(rect.left(), rect.top(), width - 1, rect.height() - 1);
  1576. if (!complete) {
  1577. painter->drawLine(progressBar.topRight() + QPoint(2, 1), progressBar.bottomRight() + QPoint(2, 0));
  1578. painter->setPen(QPen(highlight.darker(140), 0));
  1579. painter->drawLine(progressBar.topRight() + QPoint(1, 1), progressBar.bottomRight() + QPoint(1, 0));
  1580. }
  1581. } else {
  1582. progressBar.setRect(rect.right() - width - 1, rect.top(), width + 2, rect.height() - 1);
  1583. if (!complete) {
  1584. painter->drawLine(progressBar.topLeft() + QPoint(-2, 1), progressBar.bottomLeft() + QPoint(-2, 0));
  1585. painter->setPen(QPen(highlight.darker(140), 0));
  1586. painter->drawLine(progressBar.topLeft() + QPoint(-1, 1), progressBar.bottomLeft() + QPoint(-1, 0));
  1587. }
  1588. }
  1589. } else {
  1590. progressBar.setRect(rect.left(), rect.top(), rect.width() - 1, rect.height() - 1);
  1591. }
  1592. if (indeterminate || bar->progress > bar->minimum) {
  1593. QColor highlightedGradientStartColor = highlight.lighter(120);
  1594. QColor highlightedGradientStopColor = highlight;
  1595. QLinearGradient gradient(rect.topLeft(), QPoint(rect.bottomLeft().x(), rect.bottomLeft().y()));
  1596. gradient.setColorAt(0, highlightedGradientStartColor);
  1597. gradient.setColorAt(1, highlightedGradientStopColor);
  1598. painter->setBrush(gradient);
  1599. painter->setPen(QPen(painter->brush(), 1));
  1600. painter->save();
  1601. if (!complete && !indeterminate)
  1602. painter->setClipRect(progressBar.adjusted(0, 0, -1, 0));
  1603. QRect fillRect = progressBar.adjusted( indeterminate || complete || !reverse ? 1 : -1, 1,
  1604. indeterminate || complete || reverse ? -1 : 1, -1);
  1605. painter->drawRoundedRect(fillRect, 1.8, 1.8);
  1606. painter->restore();
  1607. painter->setBrush(Qt::NoBrush);
  1608. painter->setPen(QColor(255, 255, 255, 50));
  1609. painter->drawRoundedRect(progressBar.adjusted(1, 1, -1, -1), 1.8, 1.8);
  1610. if (!indeterminate) {
  1611. d->stopAnimation(widget);
  1612. } else {
  1613. highlightedGradientStartColor.setAlpha(120);
  1614. painter->setPen(QPen(highlightedGradientStartColor, 9.0));
  1615. painter->setClipRect(progressBar.adjusted(1, 1, -1, -1));
  1616. #ifndef QT_NO_ANIMATION
  1617. if (CarlaProgressStyleAnimation *animation = qobject_cast<CarlaProgressStyleAnimation*>(d->animation(widget)))
  1618. step = animation->animationStep() % 22;
  1619. else
  1620. d->startAnimation(new CarlaProgressStyleAnimation(d->animationFps(), const_cast<QWidget*>(widget)));
  1621. #endif
  1622. for (int x = progressBar.left() - rect.height(); x < rect.right() ; x += 22)
  1623. painter->drawLine(x + step, progressBar.bottom() + 1,
  1624. x + rect.height() + step, progressBar.top() - 2);
  1625. }
  1626. }
  1627. }
  1628. painter->restore();
  1629. break;
  1630. case CE_ProgressBarLabel:
  1631. if (const QStyleOptionProgressBarV2 *bar = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
  1632. QRect leftRect;
  1633. QRect rect = bar->rect;
  1634. QColor textColor = option->palette.text().color();
  1635. QColor alternateTextColor = d->highlightedText(option->palette);
  1636. painter->save();
  1637. bool vertical = false, inverted = false;
  1638. vertical = (bar->orientation == Qt::Vertical);
  1639. inverted = bar->invertedAppearance;
  1640. if (vertical)
  1641. rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
  1642. const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() /
  1643. qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
  1644. if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
  1645. leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height());
  1646. if (vertical)
  1647. leftRect.translate(rect.width() - progressIndicatorPos, 0);
  1648. bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted) ||
  1649. ((bar->direction == Qt::LeftToRight) && inverted)));
  1650. QRegion rightRect = rect;
  1651. rightRect = rightRect.subtracted(leftRect);
  1652. painter->setClipRegion(rightRect);
  1653. painter->setPen(flip ? alternateTextColor : textColor);
  1654. painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
  1655. if (!leftRect.isNull()) {
  1656. painter->setPen(flip ? textColor : alternateTextColor);
  1657. painter->setClipRect(leftRect);
  1658. painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
  1659. }
  1660. painter->restore();
  1661. }
  1662. break;
  1663. case CE_MenuBarItem:
  1664. painter->save();
  1665. if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option))
  1666. {
  1667. QStyleOptionMenuItem item = *mbi;
  1668. item.rect = mbi->rect.adjusted(0, 1, 0, -3);
  1669. QColor highlightOutline = option->palette.highlight().color().darker(125);
  1670. painter->fillRect(rect, option->palette.window());
  1671. QCommonStyle::drawControl(element, &item, painter, widget);
  1672. bool act = mbi->state & State_Selected && mbi->state & State_Sunken;
  1673. bool dis = !(mbi->state & State_Enabled);
  1674. QRect r = option->rect;
  1675. if (act)
  1676. {
  1677. painter->setBrush(option->palette.highlight().color());
  1678. painter->setPen(QPen(highlightOutline, 0));
  1679. painter->drawRect(r.adjusted(0, 5, -1, -1));
  1680. painter->drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2);
  1681. //draw text
  1682. QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
  1683. uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
  1684. if (!styleHint(SH_UnderlineShortcut, mbi, widget))
  1685. alignment |= Qt::TextHideMnemonic;
  1686. proxy()->drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole);
  1687. }
  1688. else
  1689. {
  1690. QColor shadow = mergedColors(qt_palette_bg_color(option->palette).darker(120),
  1691. outline.lighter(140), 60);
  1692. painter->setPen(QPen(shadow));
  1693. painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
  1694. }
  1695. }
  1696. painter->restore();
  1697. break;
  1698. case CE_MenuItem:
  1699. painter->save();
  1700. // Draws one item in a popup menu.
  1701. if (const QStyleOptionMenuItem* menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
  1702. QColor highlightOutline = highlightedOutline;
  1703. QColor highlight = option->palette.highlight().color();
  1704. if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
  1705. int w = 0;
  1706. if (!menuItem->text.isEmpty()) {
  1707. painter->setFont(menuItem->font);
  1708. proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
  1709. menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
  1710. QPalette::Text);
  1711. w = fontMetricsHorizontalAdvance(menuItem->fontMetrics, menuItem->text) + 5;
  1712. }
  1713. painter->setPen(highlight);
  1714. bool reverse = menuItem->direction == Qt::RightToLeft;
  1715. painter->drawLine(menuItem->rect.left() + 5 + (reverse ? 0 : w), menuItem->rect.center().y(),
  1716. menuItem->rect.right() - 5 - (reverse ? w : 0), menuItem->rect.center().y());
  1717. painter->restore();
  1718. break;
  1719. }
  1720. bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled;
  1721. if (selected) {
  1722. QRect r = option->rect;
  1723. painter->fillRect(r, highlight);
  1724. painter->setPen(QPen(highlightOutline, 0));
  1725. painter->drawRect(QRectF(r).adjusted(0.5, 0.5, -0.5, -0.5));
  1726. }
  1727. bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
  1728. bool checked = menuItem->checked;
  1729. bool sunken = menuItem->state & State_Sunken;
  1730. bool enabled = menuItem->state & State_Enabled;
  1731. bool ignoreCheckMark = false;
  1732. int checkcol = qMax(menuItem->maxIconWidth, 20);
  1733. if (qobject_cast<const QComboBox*>(widget))
  1734. ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate
  1735. if (!ignoreCheckMark) {
  1736. // Check
  1737. QRect checkRect(option->rect.left() + 7, option->rect.center().y() - 6, 14, 14);
  1738. checkRect = visualRect(menuItem->direction, menuItem->rect, checkRect);
  1739. if (checkable) {
  1740. if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) {
  1741. // Radio button
  1742. if (checked || sunken) {
  1743. painter->setRenderHint(QPainter::Antialiasing);
  1744. painter->setPen(Qt::NoPen);
  1745. QPalette::ColorRole textRole = !enabled ? QPalette::Text:
  1746. selected ? QPalette::HighlightedText : QPalette::ButtonText;
  1747. painter->setBrush(option->palette.brush( option->palette.currentColorGroup(), textRole));
  1748. painter->drawEllipse(checkRect.adjusted(4, 4, -4, -4));
  1749. }
  1750. } else {
  1751. // Check box
  1752. if (menuItem->icon.isNull()) {
  1753. QStyleOptionButton box;
  1754. box.QStyleOption::operator=(*option);
  1755. box.rect = checkRect;
  1756. if (checked)
  1757. box.state |= State_On;
  1758. proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
  1759. painter->setPen(QPen(highlight, 0));
  1760. painter->drawRect(checkRect);
  1761. }
  1762. }
  1763. }
  1764. } else { //ignore checkmark
  1765. if (menuItem->icon.isNull())
  1766. checkcol = 0;
  1767. else
  1768. checkcol = menuItem->maxIconWidth;
  1769. }
  1770. // Text and icon, ripped from windows style
  1771. bool dis = !(menuItem->state & State_Enabled);
  1772. bool act = menuItem->state & State_Selected;
  1773. const QStyleOption *opt = option;
  1774. const QStyleOptionMenuItem *menuitem = menuItem;
  1775. QPainter *p = painter;
  1776. QRect vCheckRect = visualRect(opt->direction, menuitem->rect,
  1777. QRect(menuitem->rect.x() + 4, menuitem->rect.y(),
  1778. checkcol, menuitem->rect.height()));
  1779. if (!menuItem->icon.isNull()) {
  1780. QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
  1781. if (act && !dis)
  1782. mode = QIcon::Active;
  1783. QPixmap pixmap;
  1784. int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget);
  1785. QSize iconSize(smallIconSize, smallIconSize);
  1786. if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget))
  1787. iconSize = combo->iconSize();
  1788. if (checked)
  1789. pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On);
  1790. else
  1791. pixmap = menuItem->icon.pixmap(iconSize, mode);
  1792. #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
  1793. const int pixw = pixmap.width() / pixmap.devicePixelRatioF();
  1794. const int pixh = pixmap.height() / pixmap.devicePixelRatioF();
  1795. #else
  1796. const int pixw = pixmap.width();
  1797. const int pixh = pixmap.height();
  1798. #endif
  1799. QRect pmr(0, 0, pixw, pixh);
  1800. pmr.moveCenter(vCheckRect.center());
  1801. painter->setPen(menuItem->palette.text().color());
  1802. if (checkable && checked) {
  1803. QStyleOption opt = *option;
  1804. if (act) {
  1805. QColor activeColor = mergedColors(qt_palette_bg_color(option->palette),
  1806. option->palette.highlight().color());
  1807. opt.palette.setBrush(QPalette::Button, activeColor);
  1808. }
  1809. opt.state |= State_Sunken;
  1810. opt.rect = vCheckRect;
  1811. proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
  1812. }
  1813. painter->drawPixmap(pmr.topLeft(), pixmap);
  1814. }
  1815. if (selected) {
  1816. painter->setPen(menuItem->palette.highlightedText().color());
  1817. } else {
  1818. painter->setPen(menuItem->palette.text().color());
  1819. }
  1820. int x, y, w, h;
  1821. menuitem->rect.getRect(&x, &y, &w, &h);
  1822. int tab = menuitem->tabWidth;
  1823. QColor discol;
  1824. if (dis) {
  1825. discol = menuitem->palette.text().color();
  1826. p->setPen(discol);
  1827. }
  1828. int xm = windowsItemFrame + checkcol + windowsItemHMargin + 2;
  1829. int xpos = menuitem->rect.x() + xm;
  1830. QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
  1831. QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
  1832. QString s = menuitem->text;
  1833. if (!s.isEmpty()) { // draw text
  1834. p->save();
  1835. int t = s.indexOf(QLatin1Char('\t'));
  1836. int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
  1837. if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
  1838. text_flags |= Qt::TextHideMnemonic;
  1839. text_flags |= Qt::AlignLeft;
  1840. if (t >= 0) {
  1841. QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,
  1842. QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
  1843. if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
  1844. p->setPen(menuitem->palette.light().color());
  1845. p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, s.mid(t + 1));
  1846. p->setPen(discol);
  1847. }
  1848. p->drawText(vShortcutRect, text_flags, s.mid(t + 1));
  1849. s = s.left(t);
  1850. }
  1851. QFont font = menuitem->font;
  1852. // font may not have any "hard" flags set. We override
  1853. // the point size so that when it is resolved against the device, this font will win.
  1854. // This is mainly to handle cases where someone sets the font on the window
  1855. // and then the combo inherits it and passes it onward. At that point the resolve mask
  1856. // is very, very weak. This makes it stonger.
  1857. font.setPointSizeF(QFontInfo(menuItem->font).pointSizeF());
  1858. if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
  1859. font.setBold(true);
  1860. p->setFont(font);
  1861. if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
  1862. p->setPen(menuitem->palette.light().color());
  1863. p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, s.left(t));
  1864. p->setPen(discol);
  1865. }
  1866. p->drawText(vTextRect, text_flags, s.left(t));
  1867. p->restore();
  1868. }
  1869. // Arrow
  1870. if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
  1871. int dim = (menuItem->rect.height() - 4) / 2;
  1872. PrimitiveElement arrow;
  1873. arrow = option->direction == Qt::RightToLeft ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
  1874. int xpos = menuItem->rect.left() + menuItem->rect.width() - 3 - dim;
  1875. QRect vSubMenuRect = visualRect(option->direction, menuItem->rect,
  1876. QRect(xpos, menuItem->rect.top() + menuItem->rect.height() / 2 - dim / 2, dim, dim));
  1877. QStyleOptionMenuItem newMI = *menuItem;
  1878. newMI.rect = vSubMenuRect;
  1879. newMI.state = !enabled ? State_None : State_Enabled;
  1880. if (selected)
  1881. newMI.palette.setColor(QPalette::Foreground,
  1882. newMI.palette.highlightedText().color());
  1883. proxy()->drawPrimitive(arrow, &newMI, painter, widget);
  1884. }
  1885. }
  1886. painter->restore();
  1887. break;
  1888. case CE_MenuHMargin:
  1889. case CE_MenuVMargin:
  1890. break;
  1891. case CE_MenuEmptyArea:
  1892. break;
  1893. case CE_PushButton:
  1894. if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
  1895. proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget);
  1896. QStyleOptionButton subopt = *btn;
  1897. subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
  1898. proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget);
  1899. }
  1900. break;
  1901. case CE_PushButtonLabel:
  1902. if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
  1903. QRect ir = button->rect;
  1904. uint tf = Qt::AlignVCenter;
  1905. if (styleHint(SH_UnderlineShortcut, button, widget))
  1906. tf |= Qt::TextShowMnemonic;
  1907. else
  1908. tf |= Qt::TextHideMnemonic;
  1909. if (!button->icon.isNull()) {
  1910. //Center both icon and text
  1911. QPoint point;
  1912. QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal
  1913. : QIcon::Disabled;
  1914. if (mode == QIcon::Normal && button->state & State_HasFocus)
  1915. mode = QIcon::Active;
  1916. QIcon::State state = QIcon::Off;
  1917. if (button->state & State_On)
  1918. state = QIcon::On;
  1919. QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
  1920. #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
  1921. int w = pixmap.width() / pixmap.devicePixelRatio();
  1922. int h = pixmap.height() / pixmap.devicePixelRatio();
  1923. #else
  1924. int w = pixmap.width();
  1925. int h = pixmap.height();
  1926. #endif
  1927. if (!button->text.isEmpty())
  1928. w += button->fontMetrics.boundingRect(option->rect, tf, button->text).width() + 2;
  1929. point = QPoint(ir.x() + ir.width() / 2 - w / 2,
  1930. ir.y() + ir.height() / 2 - h / 2);
  1931. #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
  1932. w = pixmap.width() / pixmap.devicePixelRatio();
  1933. #else
  1934. w = pixmap.width();
  1935. #endif
  1936. if (button->direction == Qt::RightToLeft)
  1937. point.rx() += w;
  1938. painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap);
  1939. if (button->direction == Qt::RightToLeft)
  1940. ir.translate(-point.x() - 2, 0);
  1941. else
  1942. ir.translate(point.x() + w, 0);
  1943. // left-align text if there is
  1944. if (!button->text.isEmpty())
  1945. tf |= Qt::AlignLeft;
  1946. } else {
  1947. tf |= Qt::AlignHCenter;
  1948. }
  1949. if (button->features & QStyleOptionButton::HasMenu)
  1950. ir = ir.adjusted(0, 0, -proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget), 0);
  1951. proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled),
  1952. button->text, QPalette::ButtonText);
  1953. }
  1954. break;
  1955. case CE_MenuBarEmptyArea:
  1956. painter->save();
  1957. {
  1958. painter->fillRect(rect, option->palette.window());
  1959. if (widget && qobject_cast<const QMainWindow *>(widget->parentWidget())) {
  1960. QColor shadow = mergedColors(qt_palette_bg_color(option->palette).darker(120),
  1961. outline.lighter(140), 60);
  1962. painter->setPen(QPen(shadow));
  1963. painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
  1964. }
  1965. }
  1966. painter->restore();
  1967. break;
  1968. case CE_TabBarTabShape:
  1969. painter->save();
  1970. if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
  1971. bool rtlHorTabs = (tab->direction == Qt::RightToLeft
  1972. && (tab->shape == QTabBar::RoundedNorth
  1973. || tab->shape == QTabBar::RoundedSouth));
  1974. bool selected = tab->state & State_Selected;
  1975. bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End)
  1976. || (rtlHorTabs
  1977. && tab->position == QStyleOptionTab::Beginning));
  1978. bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
  1979. int tabOverlap = pixelMetric(PM_TabBarTabOverlap, option, widget);
  1980. rect = option->rect.adjusted(0, 0, (onlyOne || lastTab) ? 0 : tabOverlap, 0);
  1981. #if 0
  1982. QRect r2(rect);
  1983. int x1 = r2.left();
  1984. int x2 = r2.right();
  1985. int y1 = r2.top();
  1986. int y2 = r2.bottom();
  1987. #endif
  1988. painter->setPen(d->innerContrastLine());
  1989. QTransform rotMatrix;
  1990. bool flip = false;
  1991. painter->setPen(shadow);
  1992. switch (tab->shape) {
  1993. case QTabBar::RoundedNorth:
  1994. break;
  1995. case QTabBar::RoundedSouth:
  1996. rotMatrix.rotate(180);
  1997. rotMatrix.translate(0, -rect.height() + 1);
  1998. rotMatrix.scale(-1, 1);
  1999. painter->setTransform(rotMatrix, true);
  2000. break;
  2001. case QTabBar::RoundedWest:
  2002. rotMatrix.rotate(180 + 90);
  2003. rotMatrix.scale(-1, 1);
  2004. flip = true;
  2005. painter->setTransform(rotMatrix, true);
  2006. break;
  2007. case QTabBar::RoundedEast:
  2008. rotMatrix.rotate(90);
  2009. rotMatrix.translate(0, - rect.width() + 1);
  2010. flip = true;
  2011. painter->setTransform(rotMatrix, true);
  2012. break;
  2013. default:
  2014. painter->restore();
  2015. QCommonStyle::drawControl(element, tab, painter, widget);
  2016. return;
  2017. }
  2018. if (flip) {
  2019. QRect tmp = rect;
  2020. rect = QRect(tmp.y(), tmp.x(), tmp.height(), tmp.width());
  2021. #if 0
  2022. int temp = x1;
  2023. x1 = y1;
  2024. y1 = temp;
  2025. temp = x2;
  2026. x2 = y2;
  2027. y2 = temp;
  2028. #endif
  2029. }
  2030. painter->setRenderHint(QPainter::Antialiasing, true);
  2031. painter->translate(0.5, 0.5);
  2032. QColor tabFrameColor = d->tabFrameColor(option->palette);
  2033. QLinearGradient fillGradient(rect.topLeft(), rect.bottomLeft());
  2034. QLinearGradient outlineGradient(rect.topLeft(), rect.bottomLeft());
  2035. QPen outlinePen = outline.lighter(110);
  2036. if (selected) {
  2037. fillGradient.setColorAt(0, tabFrameColor.lighter(104));
  2038. // QColor highlight = option->palette.highlight().color();
  2039. // if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) {
  2040. // fillGradient.setColorAt(0, highlight.lighter(130));
  2041. // outlineGradient.setColorAt(0, highlight.darker(130));
  2042. // fillGradient.setColorAt(0.14, highlight);
  2043. // outlineGradient.setColorAt(0.14, highlight.darker(130));
  2044. // fillGradient.setColorAt(0.1401, tabFrameColor);
  2045. // outlineGradient.setColorAt(0.1401, highlight.darker(130));
  2046. // }
  2047. fillGradient.setColorAt(1, tabFrameColor);
  2048. outlineGradient.setColorAt(1, outline);
  2049. outlinePen = QPen(outlineGradient, 1);
  2050. } else {
  2051. fillGradient.setColorAt(0, tabFrameColor.darker(108));
  2052. fillGradient.setColorAt(0.85, tabFrameColor.darker(108));
  2053. fillGradient.setColorAt(1, tabFrameColor.darker(116));
  2054. }
  2055. QRect drawRect = rect.adjusted(0, selected ? 0 : 2, 0, 3);
  2056. painter->setPen(outlinePen);
  2057. painter->save();
  2058. painter->setClipRect(rect.adjusted(-1, -1, 1, selected ? -2 : -3));
  2059. painter->setBrush(Qt::NoBrush);
  2060. painter->drawRoundedRect(drawRect.adjusted(0, 0, -1, -1), 2.5, 2.5);
  2061. painter->setBrush(fillGradient);
  2062. painter->setPen(QPen(QBrush(fillGradient), 1));
  2063. drawRect.adjust(1, 1, -2, -1);
  2064. painter->drawRoundedRect(drawRect, 1.8, 1.8);
  2065. painter->setBrush(Qt::NoBrush);
  2066. painter->setPen(d->innerContrastLine());
  2067. painter->drawRoundedRect(drawRect, 1.8, 1.8);
  2068. painter->restore();
  2069. if (selected) {
  2070. painter->fillRect(rect.left() + 1, rect.bottom() - 1, rect.width() - 2, rect.bottom() - 1, tabFrameColor);
  2071. painter->fillRect(QRect(rect.bottomRight() + QPoint(-2, -1), QSize(1, 1)), d->innerContrastLine());
  2072. painter->fillRect(QRect(rect.bottomLeft() + QPoint(0, -1), QSize(1, 1)), d->innerContrastLine());
  2073. painter->fillRect(QRect(rect.bottomRight() + QPoint(-1, -1), QSize(1, 1)), d->innerContrastLine());
  2074. }
  2075. }
  2076. painter->restore();
  2077. break;
  2078. default:
  2079. QCommonStyle::drawControl(element,option,painter,widget);
  2080. break;
  2081. }
  2082. }
  2083. /*!
  2084. \reimp
  2085. */
  2086. QPalette CarlaStyle::standardPalette () const
  2087. {
  2088. QPalette palette = QCommonStyle::standardPalette();
  2089. palette.setBrush(QPalette::Active, QPalette::Highlight, QColor(48, 140, 198));
  2090. palette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(145, 141, 126));
  2091. palette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(145, 141, 126));
  2092. QColor backGround(239, 235, 231);
  2093. QColor light = backGround.lighter(150);
  2094. QColor base = Qt::white;
  2095. QColor dark = QColor(170, 156, 143).darker(110);
  2096. dark = backGround.darker(150);
  2097. QColor darkDisabled = QColor(209, 200, 191).darker(110);
  2098. //### Find the correct disabled text color
  2099. palette.setBrush(QPalette::Disabled, QPalette::Text, QColor(190, 190, 190));
  2100. palette.setBrush(QPalette::Window, backGround);
  2101. palette.setBrush(QPalette::Mid, backGround.darker(130));
  2102. palette.setBrush(QPalette::Light, light);
  2103. palette.setBrush(QPalette::Active, QPalette::Base, base);
  2104. palette.setBrush(QPalette::Inactive, QPalette::Base, base);
  2105. palette.setBrush(QPalette::Disabled, QPalette::Base, backGround);
  2106. palette.setBrush(QPalette::Midlight, palette.mid().color().lighter(110));
  2107. palette.setBrush(QPalette::All, QPalette::Dark, dark);
  2108. palette.setBrush(QPalette::Disabled, QPalette::Dark, darkDisabled);
  2109. QColor button = backGround;
  2110. palette.setBrush(QPalette::Button, button);
  2111. QColor shadow = dark.darker(135);
  2112. palette.setBrush(QPalette::Shadow, shadow);
  2113. palette.setBrush(QPalette::Disabled, QPalette::Shadow, shadow.lighter(150));
  2114. palette.setBrush(QPalette::HighlightedText, QColor(QRgb(0xffffffff)));
  2115. return palette;
  2116. }
  2117. /*!
  2118. \reimp
  2119. */
  2120. void CarlaStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
  2121. QPainter *painter, const QWidget *widget) const
  2122. {
  2123. QColor buttonColor = d->buttonColor(option->palette);
  2124. QColor gradientStartColor = buttonColor.lighter(118);
  2125. QColor gradientStopColor = buttonColor;
  2126. QColor outline = d->outline(option->palette);
  2127. QColor alphaCornerColor;
  2128. if (widget) {
  2129. // ### backgroundrole/foregroundrole should be part of the style option
  2130. alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), outline);
  2131. } else {
  2132. alphaCornerColor = mergedColors(qt_palette_bg_color(option->palette), outline);
  2133. }
  2134. switch (control) {
  2135. case CC_GroupBox:
  2136. painter->save();
  2137. if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
  2138. // Draw frame
  2139. QRect textRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxLabel, widget);
  2140. QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget);
  2141. if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
  2142. QStyleOptionFrameV3 frame;
  2143. frame.QStyleOption::operator=(*groupBox);
  2144. frame.features = groupBox->features;
  2145. frame.lineWidth = groupBox->lineWidth;
  2146. frame.midLineWidth = groupBox->midLineWidth;
  2147. frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
  2148. proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
  2149. }
  2150. // Draw title
  2151. if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
  2152. // groupBox->textColor gets the incorrect palette here
  2153. painter->setPen(QPen(option->palette.windowText(), 1));
  2154. int alignment = int(groupBox->textAlignment);
  2155. if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, option, widget))
  2156. alignment |= Qt::TextHideMnemonic;
  2157. proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignLeft | alignment,
  2158. groupBox->palette, groupBox->state & State_Enabled, groupBox->text, QPalette::NoRole);
  2159. if (groupBox->state & State_HasFocus) {
  2160. QStyleOptionFocusRect fropt;
  2161. fropt.QStyleOption::operator=(*groupBox);
  2162. fropt.rect = textRect.adjusted(-2, -1, 2, 1);
  2163. proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
  2164. }
  2165. }
  2166. // Draw checkbox
  2167. if (groupBox->subControls & SC_GroupBoxCheckBox) {
  2168. QStyleOptionButton box;
  2169. box.QStyleOption::operator=(*groupBox);
  2170. box.rect = checkBoxRect;
  2171. proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
  2172. }
  2173. }
  2174. painter->restore();
  2175. break;
  2176. case CC_SpinBox:
  2177. if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
  2178. QPixmap cache;
  2179. QString pixmapName = uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size());
  2180. if (!QPixmapCache::find(pixmapName, PIXMAPCACHE_VAR_PREFIX cache)) {
  2181. cache = styleCachePixmap(spinBox->rect.size());
  2182. cache.fill(Qt::transparent);
  2183. QRect pixmapRect(0, 0, spinBox->rect.width(), spinBox->rect.height());
  2184. QRect rect = pixmapRect;
  2185. QRect r = rect;
  2186. QPainter cachePainter(&cache);
  2187. QColor arrowColor = qt_palette_fg_color(spinBox->palette);
  2188. arrowColor.setAlpha(220);
  2189. const bool isEnabled = (spinBox->state & State_Enabled);
  2190. const bool hover = isEnabled && (spinBox->state & State_MouseOver);
  2191. const bool sunken = (spinBox->state & State_Sunken);
  2192. const bool upIsActive = (spinBox->activeSubControls == SC_SpinBoxUp);
  2193. const bool downIsActive = (spinBox->activeSubControls == SC_SpinBoxDown);
  2194. const bool hasFocus = (option->state & State_HasFocus);
  2195. QStyleOptionSpinBox spinBoxCopy = *spinBox;
  2196. spinBoxCopy.rect = pixmapRect;
  2197. QRect upRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp, widget);
  2198. QRect downRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown, widget);
  2199. const bool oddHeight = (1+upRect.bottom() != downRect.top());
  2200. if (spinBox->frame) {
  2201. // Button group outer bounds
  2202. const int bty = upRect.top();
  2203. const int bby = 1+downRect.bottom() - 1;
  2204. const int brx = 1+upRect.right() - 1;
  2205. cachePainter.save();
  2206. cachePainter.setRenderHint(QPainter::Antialiasing, true);
  2207. cachePainter.translate(0.5, 0.5);
  2208. // Fill background
  2209. const QBrush & brush = option->palette.base();
  2210. cachePainter.setPen(brush.color());
  2211. cachePainter.setBrush(brush);
  2212. cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 1.8, 1.8);
  2213. // Draw inner shadow
  2214. cachePainter.setPen(d->topShadow());
  2215. cachePainter.drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(1+r.right() - 2, r.top() + 1));
  2216. // Draw button gradient
  2217. QColor buttonColor = d->buttonColor(option->palette);
  2218. QRectF updownRect(upRect.topLeft(), downRect.bottomRight() + QPoint(1,1));
  2219. updownRect.adjust(-0.5, -0.5, 0.5-1, 0.5-1);
  2220. QLinearGradient gradient = qt_fusion_gradient(updownRect.toAlignedRect(), (isEnabled && option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104));
  2221. // Draw button gradient
  2222. cachePainter.setPen(QPen(gradient, 1));
  2223. cachePainter.setBrush(gradient);
  2224. cachePainter.save();
  2225. cachePainter.setClipRect(updownRect);
  2226. cachePainter.drawRoundedRect(QRect(0, bty, brx, bby-bty), 1.8, 1.8);
  2227. cachePainter.setPen(QPen(d->innerContrastLine()));
  2228. cachePainter.setBrush(Qt::NoBrush);
  2229. cachePainter.drawRoundedRect(QRect(0, bty, brx, bby-bty), 1.8, 1.8);
  2230. cachePainter.drawLine(upRect.left(), bty + 1, upRect.left(), bby - 1);
  2231. if (hover) {
  2232. const int y = oddHeight ? (downRect.top() - 1) : (upIsActive ? (1+upRect.bottom() - 1) : downRect.top());
  2233. cachePainter.setOpacity(0.4);
  2234. cachePainter.drawLine(downRect.left() + 1, y, brx - 1, y);
  2235. cachePainter.setOpacity(1.0);
  2236. }
  2237. cachePainter.restore();
  2238. cachePainter.setPen(Qt::NoPen);
  2239. // Buttons mouse over background
  2240. if ((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) && upIsActive) {
  2241. QPointF clipTLeft(0, upRect.top());
  2242. QPointF clipBRight(1+downRect.right() - 1, 1+downRect.bottom() - 1);
  2243. QRectF clipRect(clipTLeft, clipBRight);
  2244. cachePainter.save();
  2245. clipRect.adjust(-0.5,-0.5, 0.5, 0.5);
  2246. QPainterPath clipPath;
  2247. clipPath.addRoundedRect(clipRect, 2.0, 2.0);
  2248. cachePainter.setClipPath(clipPath);
  2249. const int cy_fix = oddHeight ? 0 : -1;
  2250. if (sunken)
  2251. cachePainter.fillRect(QRectF(upRect).adjusted(-0.5, -0.5, 0.5-1, 0.5+cy_fix), gradientStopColor.darker(110));
  2252. else if (hover)
  2253. cachePainter.fillRect(QRectF(upRect).adjusted(-0.5, -0.5, 0.5-1, 0.5+cy_fix), d->innerContrastLine());
  2254. cachePainter.restore();
  2255. }
  2256. if ((spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) && downIsActive) {
  2257. QPointF clipTLeft(0, upRect.top());
  2258. QPointF clipBRight(1+downRect.right() - 1, 1+downRect.bottom() - 1);
  2259. QRectF clipRect(clipTLeft, clipBRight);
  2260. cachePainter.save();
  2261. clipRect.adjust(-0.5,-0.5, 0.5, 0.5);
  2262. QPainterPath clipPath;
  2263. clipPath.addRoundedRect(clipRect, 2.0, 2.0);
  2264. cachePainter.setClipPath(clipPath);
  2265. const int cy_fix = oddHeight ? 0 : 1;
  2266. if (sunken)
  2267. cachePainter.fillRect(QRectF(downRect).adjusted(-0.5, -0.5-1+cy_fix, 0.5-1, 0.5-1-cy_fix), gradientStopColor.darker(110));
  2268. else if (hover)
  2269. cachePainter.fillRect(QRectF(downRect).adjusted(-0.5, -0.5-1+cy_fix, 0.5-1, 0.5-1-cy_fix), d->innerContrastLine());
  2270. cachePainter.restore();
  2271. }
  2272. // Common highlight border
  2273. QColor highlightOutline = d->highlightedOutline(option->palette);
  2274. cachePainter.setPen(hasFocus ? highlightOutline : highlightOutline.darker(160));
  2275. cachePainter.setBrush(Qt::NoBrush);
  2276. cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2.5, 2.5);
  2277. if (hasFocus) {
  2278. QColor softHighlight = option->palette.highlight().color();
  2279. softHighlight.setAlpha(40);
  2280. cachePainter.setPen(softHighlight);
  2281. cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 1.8, 1.8);
  2282. }
  2283. cachePainter.restore();
  2284. }
  2285. // outline the up/down buttons
  2286. cachePainter.setPen(outline);
  2287. if (spinBox->direction == Qt::RightToLeft) {
  2288. cachePainter.drawLine(1+upRect.right() + 1, upRect.top(), 1+upRect.right() + 1, 1+downRect.bottom() - 1);
  2289. } else {
  2290. cachePainter.drawLine(upRect.left() - 1, upRect.top(), upRect.left() - 1, 1+downRect.bottom() - 1);
  2291. }
  2292. if (upIsActive && sunken) {
  2293. cachePainter.setPen(gradientStopColor.darker(130));
  2294. const int left = upRect.left();
  2295. const int right = 1+upRect.right() - 1;
  2296. const int top = upRect.top();
  2297. const int bottom = oddHeight ? (1+upRect.bottom()) : (1+upRect.bottom() - 1);
  2298. const QPoint points[] = {QPoint(right,bottom), QPoint(left,bottom), QPoint(left,top), QPoint(right-1,top)};
  2299. cachePainter.drawPolyline(points, 4);
  2300. }
  2301. if (downIsActive && sunken) {
  2302. cachePainter.setPen(gradientStopColor.darker(130));
  2303. const int left = downRect.left();
  2304. const int right = 1+downRect.right() - 1;
  2305. const int top = oddHeight ? (downRect.top() - 1) : downRect.top();
  2306. const int bottom = 1+downRect.bottom() - 1;
  2307. const QPoint points[] = {QPoint(left,bottom), QPoint(left,top), QPoint(right,top)};
  2308. cachePainter.drawPolyline(points, 3);
  2309. }
  2310. QColor disabledColor = mergedColors(arrowColor, option->palette.button().color());
  2311. if (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) {
  2312. // plus/minus
  2313. int centerX, centerY;
  2314. centerX = upRect.center().x();
  2315. centerY = upRect.center().y();
  2316. cachePainter.setPen((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) ? arrowColor : disabledColor);
  2317. cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY);
  2318. cachePainter.drawLine(centerX + 1, centerY - 2, centerX + 1, centerY + 2);
  2319. centerX = downRect.center().x();
  2320. centerY = downRect.center().y();
  2321. cachePainter.setPen((spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) ? arrowColor : disabledColor);
  2322. cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY);
  2323. } else if (spinBox->buttonSymbols == QAbstractSpinBox::UpDownArrows){
  2324. // arrows
  2325. painter->setRenderHint(QPainter::SmoothPixmapTransform);
  2326. QPixmap upArrow = colorizedImage(QLatin1String(":/bitmaps/style/arrow.png"),
  2327. (spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) ? arrowColor : disabledColor);
  2328. QPixmap downArrow = colorizedImage(QLatin1String(":/bitmaps/style/arrow.png"),
  2329. (spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) ? arrowColor : disabledColor, 180);
  2330. int y1, y2;
  2331. const int imgW = (upArrow.width() + downArrow.width()) / 2;
  2332. const int imgH = (upArrow.height() + downArrow.height()) / 2;
  2333. const float f = 1.0 / ceil(imgW / upRect.width() * 2);
  2334. const int w = imgW * f;
  2335. const int h = imgH * f;
  2336. const int x = upRect.center().x() - w / 2;
  2337. y1 = upRect.center().y();
  2338. y2 = downRect.center().y();
  2339. const int dy1 = 1+upRect.bottom() - y1;
  2340. const int dy2 = y2 - downRect.top();
  2341. const int dy = dy1 < dy2 ? dy1 : dy2;
  2342. y1 = (1+upRect.bottom() - dy - 1) - ceil(h / 4.0);
  2343. y2 = (downRect.top() + dy + 1) - floor(h / 4.0 * 3);
  2344. cachePainter.drawPixmap(QRectF(x, y1, w, h), upArrow, upArrow.rect());
  2345. cachePainter.drawPixmap(QRectF(x, y2, w, h), downArrow, downArrow.rect());
  2346. }
  2347. cachePainter.end();
  2348. QPixmapCache::insert(pixmapName, cache);
  2349. }
  2350. painter->drawPixmap(spinBox->rect.topLeft(), cache);
  2351. }
  2352. break;
  2353. case CC_TitleBar:
  2354. painter->save();
  2355. if (const QStyleOptionTitleBar *titleBar = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
  2356. const int buttonMargin = 5;
  2357. bool active = (titleBar->titleBarState & State_Active);
  2358. QRect fullRect = titleBar->rect;
  2359. QPalette palette = option->palette;
  2360. QColor highlight = option->palette.highlight().color();
  2361. QColor titleBarFrameBorder(active ? highlight.darker(180): outline.darker(110));
  2362. QColor titleBarHighlight(active ? highlight.lighter(120): qt_palette_bg_color(palette).lighter(120));
  2363. QColor textColor(active ? 0xffffff : 0xff000000);
  2364. QColor textAlphaColor(active ? 0xffffff : 0xff000000 );
  2365. {
  2366. // Fill title bar gradient
  2367. QColor titlebarColor = QColor(active ? highlight: qt_palette_bg_color(palette));
  2368. QLinearGradient gradient(option->rect.center().x(), option->rect.top(),
  2369. option->rect.center().x(), option->rect.bottom());
  2370. gradient.setColorAt(0, titlebarColor.lighter(114));
  2371. gradient.setColorAt(0.5, titlebarColor.lighter(102));
  2372. gradient.setColorAt(0.51, titlebarColor.darker(104));
  2373. gradient.setColorAt(1, titlebarColor);
  2374. painter->fillRect(option->rect.adjusted(1, 1, -1, 0), gradient);
  2375. // Frame and rounded corners
  2376. painter->setPen(titleBarFrameBorder);
  2377. // top outline
  2378. painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top());
  2379. painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom());
  2380. const QPoint points[5] = {
  2381. QPoint(fullRect.left() + 4, fullRect.top() + 1),
  2382. QPoint(fullRect.left() + 3, fullRect.top() + 1),
  2383. QPoint(fullRect.left() + 2, fullRect.top() + 2),
  2384. QPoint(fullRect.left() + 1, fullRect.top() + 3),
  2385. QPoint(fullRect.left() + 1, fullRect.top() + 4)
  2386. };
  2387. painter->drawPoints(points, 5);
  2388. painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom());
  2389. const QPoint points2[5] = {
  2390. QPoint(fullRect.right() - 3, fullRect.top() + 1),
  2391. QPoint(fullRect.right() - 4, fullRect.top() + 1),
  2392. QPoint(fullRect.right() - 2, fullRect.top() + 2),
  2393. QPoint(fullRect.right() - 1, fullRect.top() + 3),
  2394. QPoint(fullRect.right() - 1, fullRect.top() + 4)
  2395. };
  2396. painter->drawPoints(points2, 5);
  2397. // draw bottomline
  2398. painter->drawLine(fullRect.right(), fullRect.bottom(), fullRect.left(), fullRect.bottom());
  2399. // top highlight
  2400. painter->setPen(titleBarHighlight);
  2401. painter->drawLine(fullRect.left() + 6, fullRect.top() + 1, fullRect.right() - 6, fullRect.top() + 1);
  2402. }
  2403. // draw title
  2404. QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
  2405. painter->setPen(active? (titleBar->palette.text().color().lighter(120)) :
  2406. titleBar->palette.text().color() );
  2407. // Note workspace also does elliding but it does not use the correct font
  2408. QString title = painter->fontMetrics().elidedText(titleBar->text, Qt::ElideRight, textRect.width() - 14);
  2409. painter->drawText(textRect.adjusted(1, 1, 1, 1), title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter));
  2410. painter->setPen(Qt::white);
  2411. if (active)
  2412. painter->drawText(textRect, title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter));
  2413. // min button
  2414. if ((titleBar->subControls & SC_TitleBarMinButton) && (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
  2415. !(titleBar->titleBarState& Qt::WindowMinimized)) {
  2416. QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
  2417. if (minButtonRect.isValid()) {
  2418. bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver);
  2419. bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken);
  2420. qt_fusion_draw_mdibutton(painter, titleBar, minButtonRect, hover, sunken);
  2421. QRect minButtonIconRect = minButtonRect.adjusted(buttonMargin ,buttonMargin , -buttonMargin, -buttonMargin);
  2422. painter->setPen(textColor);
  2423. painter->drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 3,
  2424. minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 3);
  2425. painter->drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 4,
  2426. minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 4);
  2427. painter->setPen(textAlphaColor);
  2428. painter->drawLine(minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 3,
  2429. minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 4);
  2430. painter->drawLine(minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 3,
  2431. minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 4);
  2432. }
  2433. }
  2434. // max button
  2435. if ((titleBar->subControls & SC_TitleBarMaxButton) && (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
  2436. !(titleBar->titleBarState & Qt::WindowMaximized)) {
  2437. QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
  2438. if (maxButtonRect.isValid()) {
  2439. bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver);
  2440. bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken);
  2441. qt_fusion_draw_mdibutton(painter, titleBar, maxButtonRect, hover, sunken);
  2442. QRect maxButtonIconRect = maxButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
  2443. painter->setPen(textColor);
  2444. painter->drawRect(maxButtonIconRect.adjusted(0, 0, -1, -1));
  2445. painter->drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1,
  2446. maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1);
  2447. painter->setPen(textAlphaColor);
  2448. const QPoint points[4] = {
  2449. maxButtonIconRect.topLeft(),
  2450. maxButtonIconRect.topRight(),
  2451. maxButtonIconRect.bottomLeft(),
  2452. maxButtonIconRect.bottomRight()
  2453. };
  2454. painter->drawPoints(points, 4);
  2455. }
  2456. }
  2457. // close button
  2458. if ((titleBar->subControls & SC_TitleBarCloseButton) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
  2459. QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
  2460. if (closeButtonRect.isValid()) {
  2461. bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver);
  2462. bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken);
  2463. qt_fusion_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken);
  2464. QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
  2465. painter->setPen(textAlphaColor);
  2466. const QLine lines[4] = {
  2467. QLine(closeIconRect.left() + 1, closeIconRect.top(),
  2468. closeIconRect.right(), closeIconRect.bottom() - 1),
  2469. QLine(closeIconRect.left(), closeIconRect.top() + 1,
  2470. closeIconRect.right() - 1, closeIconRect.bottom()),
  2471. QLine(closeIconRect.right() - 1, closeIconRect.top(),
  2472. closeIconRect.left(), closeIconRect.bottom() - 1),
  2473. QLine(closeIconRect.right(), closeIconRect.top() + 1,
  2474. closeIconRect.left() + 1, closeIconRect.bottom())
  2475. };
  2476. painter->drawLines(lines, 4);
  2477. const QPoint points[4] = {
  2478. closeIconRect.topLeft(),
  2479. closeIconRect.topRight(),
  2480. closeIconRect.bottomLeft(),
  2481. closeIconRect.bottomRight()
  2482. };
  2483. painter->drawPoints(points, 4);
  2484. painter->setPen(textColor);
  2485. painter->drawLine(closeIconRect.left() + 1, closeIconRect.top() + 1,
  2486. closeIconRect.right() - 1, closeIconRect.bottom() - 1);
  2487. painter->drawLine(closeIconRect.left() + 1, closeIconRect.bottom() - 1,
  2488. closeIconRect.right() - 1, closeIconRect.top() + 1);
  2489. }
  2490. }
  2491. // normalize button
  2492. if ((titleBar->subControls & SC_TitleBarNormalButton) &&
  2493. (((titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
  2494. (titleBar->titleBarState & Qt::WindowMinimized)) ||
  2495. ((titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
  2496. (titleBar->titleBarState & Qt::WindowMaximized)))) {
  2497. QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
  2498. if (normalButtonRect.isValid()) {
  2499. bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver);
  2500. bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken);
  2501. QRect normalButtonIconRect = normalButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
  2502. qt_fusion_draw_mdibutton(painter, titleBar, normalButtonRect, hover, sunken);
  2503. QRect frontWindowRect = normalButtonIconRect.adjusted(0, 3, -3, 0);
  2504. painter->setPen(textColor);
  2505. painter->drawRect(frontWindowRect.adjusted(0, 0, -1, -1));
  2506. painter->drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1,
  2507. frontWindowRect.right() - 1, frontWindowRect.top() + 1);
  2508. painter->setPen(textAlphaColor);
  2509. const QPoint points[4] = {
  2510. frontWindowRect.topLeft(),
  2511. frontWindowRect.topRight(),
  2512. frontWindowRect.bottomLeft(),
  2513. frontWindowRect.bottomRight()
  2514. };
  2515. painter->drawPoints(points, 4);
  2516. QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3);
  2517. QRegion clipRegion = backWindowRect;
  2518. clipRegion -= frontWindowRect;
  2519. painter->save();
  2520. painter->setClipRegion(clipRegion);
  2521. painter->setPen(textColor);
  2522. painter->drawRect(backWindowRect.adjusted(0, 0, -1, -1));
  2523. painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1,
  2524. backWindowRect.right() - 1, backWindowRect.top() + 1);
  2525. painter->setPen(textAlphaColor);
  2526. const QPoint points2[4] = {
  2527. backWindowRect.topLeft(),
  2528. backWindowRect.topRight(),
  2529. backWindowRect.bottomLeft(),
  2530. backWindowRect.bottomRight()
  2531. };
  2532. painter->drawPoints(points2, 4);
  2533. painter->restore();
  2534. }
  2535. }
  2536. // context help button
  2537. if (titleBar->subControls & SC_TitleBarContextHelpButton
  2538. && (titleBar->titleBarFlags & Qt::WindowContextHelpButtonHint)) {
  2539. QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
  2540. if (contextHelpButtonRect.isValid()) {
  2541. bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
  2542. bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
  2543. qt_fusion_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken);
  2544. QImage image(qt_titlebar_context_help);
  2545. QColor alpha = textColor;
  2546. alpha.setAlpha(128);
  2547. image.setColor(1, textColor.rgba());
  2548. image.setColor(2, alpha.rgba());
  2549. painter->setRenderHint(QPainter::SmoothPixmapTransform);
  2550. painter->drawImage(contextHelpButtonRect.adjusted(4, 4, -4, -4), image);
  2551. }
  2552. }
  2553. // shade button
  2554. if (titleBar->subControls & SC_TitleBarShadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
  2555. QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
  2556. if (shadeButtonRect.isValid()) {
  2557. bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver);
  2558. bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken);
  2559. qt_fusion_draw_mdibutton(painter, titleBar, shadeButtonRect, hover, sunken);
  2560. QPixmap arrow = colorizedImage(QLatin1String(":/bitmaps/style/arrow.png"), textColor);
  2561. painter->drawPixmap(shadeButtonRect.adjusted(5, 7, -5, -7), arrow);
  2562. }
  2563. }
  2564. // unshade button
  2565. if (titleBar->subControls & SC_TitleBarUnshadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
  2566. QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
  2567. if (unshadeButtonRect.isValid()) {
  2568. bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver);
  2569. bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken);
  2570. qt_fusion_draw_mdibutton(painter, titleBar, unshadeButtonRect, hover, sunken);
  2571. QPixmap arrow = colorizedImage(QLatin1String(":/bitmaps/style/arrow.png"), textColor, 180);
  2572. painter->drawPixmap(unshadeButtonRect.adjusted(5, 7, -5, -7), arrow);
  2573. }
  2574. }
  2575. if ((titleBar->subControls & SC_TitleBarSysMenu) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
  2576. QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
  2577. if (iconRect.isValid()) {
  2578. if (!titleBar->icon.isNull()) {
  2579. titleBar->icon.paint(painter, iconRect);
  2580. } else {
  2581. QStyleOption tool(0);
  2582. tool.palette = titleBar->palette;
  2583. QPixmap pm = standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16);
  2584. tool.rect = iconRect;
  2585. painter->save();
  2586. proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
  2587. painter->restore();
  2588. }
  2589. }
  2590. }
  2591. }
  2592. painter->restore();
  2593. break;
  2594. case CC_ScrollBar:
  2595. painter->save();
  2596. if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
  2597. bool horizontal = scrollBar->orientation == Qt::Horizontal;
  2598. bool sunken = scrollBar->state & State_Sunken;
  2599. QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
  2600. QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
  2601. QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
  2602. QRect scrollBarGroove = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
  2603. QRect rect = option->rect;
  2604. QColor alphaOutline = outline;
  2605. alphaOutline.setAlpha(180);
  2606. QColor arrowColor = qt_palette_fg_color(option->palette);
  2607. arrowColor.setAlpha(220);
  2608. // Paint groove
  2609. if (scrollBar->subControls & SC_ScrollBarGroove) {
  2610. QLinearGradient gradient(rect.center().x(), rect.top(),
  2611. rect.center().x(), rect.bottom());
  2612. if (!horizontal)
  2613. gradient = QLinearGradient(rect.left(), rect.center().y(),
  2614. rect.right(), rect.center().y());
  2615. gradient.setColorAt(0, buttonColor.darker(107));
  2616. gradient.setColorAt(0.1, buttonColor.darker(105));
  2617. gradient.setColorAt(0.9, buttonColor.darker(105));
  2618. gradient.setColorAt(1, buttonColor.darker(107));
  2619. painter->fillRect(option->rect, gradient);
  2620. painter->setPen(Qt::NoPen);
  2621. painter->setPen(alphaOutline);
  2622. if (horizontal)
  2623. painter->drawLine(rect.topLeft(), rect.topRight());
  2624. else
  2625. painter->drawLine(rect.topLeft(), rect.bottomLeft());
  2626. QColor subtleEdge = alphaOutline;
  2627. subtleEdge.setAlpha(40);
  2628. painter->setPen(subtleEdge);
  2629. painter->setBrush(Qt::NoBrush);
  2630. painter->save();
  2631. painter->setClipRect(scrollBarGroove.adjusted(1, 0, -1, -3));
  2632. painter->drawRect(scrollBarGroove.adjusted(1, 0, -1, -1));
  2633. painter->restore();
  2634. }
  2635. QRect pixmapRect = scrollBarSlider;
  2636. QLinearGradient gradient(pixmapRect.center().x(), pixmapRect.top(),
  2637. pixmapRect.center().x(), pixmapRect.bottom());
  2638. if (!horizontal)
  2639. gradient = QLinearGradient(pixmapRect.left(), pixmapRect.center().y(),
  2640. pixmapRect.right(), pixmapRect.center().y());
  2641. QLinearGradient highlightedGradient = gradient;
  2642. QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40);
  2643. gradient.setColorAt(0, d->buttonColor(option->palette).lighter(108));
  2644. gradient.setColorAt(1, d->buttonColor(option->palette));
  2645. highlightedGradient.setColorAt(0, gradientStartColor.darker(102));
  2646. highlightedGradient.setColorAt(1, gradientStopColor.lighter(102));
  2647. // Paint slider
  2648. if (scrollBar->subControls & SC_ScrollBarSlider) {
  2649. QRect pixmapRect = scrollBarSlider;
  2650. painter->setPen(QPen(alphaOutline, 0));
  2651. if (option->state & State_Sunken && scrollBar->activeSubControls & SC_ScrollBarSlider)
  2652. painter->setBrush(midColor2);
  2653. else if (option->state & State_MouseOver && scrollBar->activeSubControls & SC_ScrollBarSlider)
  2654. painter->setBrush(highlightedGradient);
  2655. else
  2656. painter->setBrush(gradient);
  2657. painter->drawRect(pixmapRect.adjusted(horizontal ? -1 : 0, horizontal ? 0 : -1, horizontal ? 0 : 1, horizontal ? 1 : 0));
  2658. painter->setPen(d->innerContrastLine());
  2659. painter->drawRect(scrollBarSlider.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, -1, -1));
  2660. // Outer shadow
  2661. // painter->setPen(subtleEdge);
  2662. // if (horizontal) {
  2663. //// painter->drawLine(scrollBarSlider.topLeft() + QPoint(-2, 0), scrollBarSlider.bottomLeft() + QPoint(2, 0));
  2664. //// painter->drawLine(scrollBarSlider.topRight() + QPoint(-2, 0), scrollBarSlider.bottomRight() + QPoint(2, 0));
  2665. // } else {
  2666. //// painter->drawLine(pixmapRect.topLeft() + QPoint(0, -2), pixmapRect.bottomLeft() + QPoint(0, -2));
  2667. //// painter->drawLine(pixmapRect.topRight() + QPoint(0, 2), pixmapRect.bottomRight() + QPoint(0, 2));
  2668. // }
  2669. }
  2670. // The SubLine (up/left) buttons
  2671. if (scrollBar->subControls & SC_ScrollBarSubLine) {
  2672. if ((scrollBar->activeSubControls & SC_ScrollBarSubLine) && sunken)
  2673. painter->setBrush(gradientStopColor);
  2674. else if ((scrollBar->activeSubControls & SC_ScrollBarSubLine))
  2675. painter->setBrush(highlightedGradient);
  2676. else
  2677. painter->setBrush(gradient);
  2678. painter->setPen(Qt::NoPen);
  2679. painter->drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0));
  2680. painter->setPen(QPen(alphaOutline, 1));
  2681. if (option->state & State_Horizontal) {
  2682. if (option->direction == Qt::RightToLeft) {
  2683. pixmapRect.setLeft(scrollBarSubLine.left());
  2684. painter->drawLine(pixmapRect.topLeft(), pixmapRect.bottomLeft());
  2685. } else {
  2686. pixmapRect.setRight(scrollBarSubLine.right());
  2687. painter->drawLine(pixmapRect.topRight(), pixmapRect.bottomRight());
  2688. }
  2689. } else {
  2690. pixmapRect.setBottom(scrollBarSubLine.bottom());
  2691. painter->drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight());
  2692. }
  2693. painter->setBrush(Qt::NoBrush);
  2694. painter->setPen(d->innerContrastLine());
  2695. painter->drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0 , horizontal ? -2 : -1, horizontal ? -1 : -2));
  2696. // Arrows
  2697. int rotation = 0;
  2698. if (option->state & State_Horizontal)
  2699. rotation = option->direction == Qt::LeftToRight ? -90 : 90;
  2700. QRect upRect = scrollBarSubLine.translated(horizontal ? -2 : -1, 0);
  2701. QPixmap arrowPixmap = colorizedImage(QLatin1String(":/bitmaps/style/arrow.png"), arrowColor, rotation);
  2702. painter->drawPixmap(QRect(upRect.center().x() - arrowPixmap.width() / 4 + 2,
  2703. upRect.center().y() - arrowPixmap.height() / 4 + 1,
  2704. arrowPixmap.width()/2, arrowPixmap.height()/2), arrowPixmap);
  2705. }
  2706. // The AddLine (down/right) button
  2707. if (scrollBar->subControls & SC_ScrollBarAddLine) {
  2708. if ((scrollBar->activeSubControls & SC_ScrollBarAddLine) && sunken)
  2709. painter->setBrush(gradientStopColor);
  2710. else if ((scrollBar->activeSubControls & SC_ScrollBarAddLine))
  2711. painter->setBrush(midColor2);
  2712. else
  2713. painter->setBrush(gradient);
  2714. painter->setPen(Qt::NoPen);
  2715. painter->drawRect(scrollBarAddLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0));
  2716. painter->setPen(QPen(alphaOutline, 1));
  2717. if (option->state & State_Horizontal) {
  2718. if (option->direction == Qt::LeftToRight) {
  2719. pixmapRect.setLeft(scrollBarAddLine.left());
  2720. painter->drawLine(pixmapRect.topLeft(), pixmapRect.bottomLeft());
  2721. } else {
  2722. pixmapRect.setRight(scrollBarAddLine.right());
  2723. painter->drawLine(pixmapRect.topRight(), pixmapRect.bottomRight());
  2724. }
  2725. } else {
  2726. pixmapRect.setTop(scrollBarAddLine.top());
  2727. painter->drawLine(pixmapRect.topLeft(), pixmapRect.topRight());
  2728. }
  2729. painter->setPen(d->innerContrastLine());
  2730. painter->setBrush(Qt::NoBrush);
  2731. painter->drawRect(scrollBarAddLine.adjusted(1, 1, -1, -1));
  2732. int rotation = 180;
  2733. if (option->state & State_Horizontal)
  2734. rotation = option->direction == Qt::LeftToRight ? 90 : -90;
  2735. QRect downRect = scrollBarAddLine.translated(-1, 1);
  2736. QPixmap arrowPixmap = colorizedImage(QLatin1String(":/bitmaps/style/arrow.png"), arrowColor, rotation);
  2737. painter->drawPixmap(QRect(downRect.center().x() - arrowPixmap.width() / 4 + 2,
  2738. downRect.center().y() - arrowPixmap.height() / 4,
  2739. arrowPixmap.width()/2, arrowPixmap.height()/2), arrowPixmap);
  2740. }
  2741. }
  2742. painter->restore();
  2743. break;;
  2744. case CC_ComboBox:
  2745. painter->save();
  2746. if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
  2747. bool hasFocus = option->state & State_HasFocus && option->state & State_KeyboardFocusChange;
  2748. bool sunken = comboBox->state & State_On; // play dead, if combobox has no items
  2749. bool isEnabled = (comboBox->state & State_Enabled);
  2750. QPixmap cache;
  2751. QString pixmapName = uniqueName(QLatin1String("combobox"), option, comboBox->rect.size());
  2752. if (sunken)
  2753. pixmapName += QLatin1String("-sunken");
  2754. if (comboBox->editable)
  2755. pixmapName += QLatin1String("-editable");
  2756. if (isEnabled)
  2757. pixmapName += QLatin1String("-enabled");
  2758. if (!QPixmapCache::find(pixmapName, PIXMAPCACHE_VAR_PREFIX cache)) {
  2759. cache = styleCachePixmap(comboBox->rect.size());
  2760. cache.fill(Qt::transparent);
  2761. QPainter cachePainter(&cache);
  2762. QRect pixmapRect(0, 0, comboBox->rect.width(), comboBox->rect.height());
  2763. QStyleOptionComboBox comboBoxCopy = *comboBox;
  2764. comboBoxCopy.rect = pixmapRect;
  2765. QRect rect = pixmapRect;
  2766. QRect downArrowRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
  2767. SC_ComboBoxArrow, widget);
  2768. // Draw a line edit
  2769. if (comboBox->editable) {
  2770. QStyleOptionFrame buttonOption;
  2771. buttonOption.QStyleOption::operator=(*comboBox);
  2772. buttonOption.rect = rect;
  2773. buttonOption.state = (comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus))
  2774. | State_KeyboardFocusChange; // Always show hig
  2775. if (sunken) {
  2776. buttonOption.state |= State_Sunken;
  2777. buttonOption.state &= ~State_MouseOver;
  2778. }
  2779. proxy()->drawPrimitive(PE_FrameLineEdit, &buttonOption, &cachePainter, widget);
  2780. // Draw button clipped
  2781. cachePainter.save();
  2782. cachePainter.setClipRect(downArrowRect.adjusted(0, 0, 1, 0));
  2783. buttonOption.rect.setLeft(comboBox->direction == Qt::LeftToRight ?
  2784. downArrowRect.left() - 6: downArrowRect.right() + 6);
  2785. proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
  2786. cachePainter.restore();
  2787. cachePainter.setPen( QPen(hasFocus ? option->palette.highlight() : outline.lighter(110), 0));
  2788. if (!sunken) {
  2789. int borderSize = 1;
  2790. if (comboBox->direction == Qt::RightToLeft) {
  2791. cachePainter.drawLine(QPoint(downArrowRect.right() - 1, downArrowRect.top() + borderSize ),
  2792. QPoint(downArrowRect.right() - 1, downArrowRect.bottom() - borderSize));
  2793. } else {
  2794. cachePainter.drawLine(QPoint(downArrowRect.left() , downArrowRect.top() + borderSize),
  2795. QPoint(downArrowRect.left() , downArrowRect.bottom() - borderSize));
  2796. }
  2797. } else {
  2798. if (comboBox->direction == Qt::RightToLeft) {
  2799. cachePainter.drawLine(QPoint(downArrowRect.right(), downArrowRect.top() + 2),
  2800. QPoint(downArrowRect.right(), downArrowRect.bottom() - 2));
  2801. } else {
  2802. cachePainter.drawLine(QPoint(downArrowRect.left(), downArrowRect.top() + 2),
  2803. QPoint(downArrowRect.left(), downArrowRect.bottom() - 2));
  2804. }
  2805. }
  2806. } else {
  2807. QStyleOptionButton buttonOption;
  2808. buttonOption.QStyleOption::operator=(*comboBox);
  2809. buttonOption.rect = rect;
  2810. buttonOption.state = comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus | State_KeyboardFocusChange);
  2811. if (sunken) {
  2812. buttonOption.state |= State_Sunken;
  2813. buttonOption.state &= ~State_MouseOver;
  2814. }
  2815. proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
  2816. }
  2817. if (comboBox->subControls & SC_ComboBoxArrow) {
  2818. // Draw the up/down arrow
  2819. QColor arrowColor = option->palette.buttonText().color();
  2820. arrowColor.setAlpha(220);
  2821. QPixmap downArrow = colorizedImage(QLatin1String(":/bitmaps/style/arrow.png"), arrowColor, 180);
  2822. cachePainter.drawPixmap(QRect(downArrowRect.center().x() - downArrow.width() / 4 + 1,
  2823. downArrowRect.center().y() - downArrow.height() / 4 + 1,
  2824. downArrow.width()/2, downArrow.height()/2), downArrow);
  2825. }
  2826. cachePainter.end();
  2827. QPixmapCache::insert(pixmapName, cache);
  2828. }
  2829. painter->drawPixmap(comboBox->rect.topLeft(), cache);
  2830. }
  2831. painter->restore();
  2832. break;
  2833. case CC_Slider:
  2834. if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
  2835. QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
  2836. QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
  2837. bool horizontal = slider->orientation == Qt::Horizontal;
  2838. bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
  2839. bool ticksBelow = slider->tickPosition & QSlider::TicksBelow;
  2840. QColor activeHighlight = d->highlight(option->palette);
  2841. QPixmap cache;
  2842. QBrush oldBrush = painter->brush();
  2843. QPen oldPen = painter->pen();
  2844. QColor shadowAlpha(Qt::black);
  2845. shadowAlpha.setAlpha(10);
  2846. if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
  2847. outline = d->highlightedOutline(option->palette);
  2848. if ((option->subControls & SC_SliderGroove) && groove.isValid()) {
  2849. QColor grooveColor;
  2850. grooveColor.setHsv(buttonColor.hue(),
  2851. qMin(255, (int)(buttonColor.saturation())),
  2852. qMin(255, (int)(buttonColor.value()*0.9)));
  2853. QString groovePixmapName = uniqueName(QLatin1String("slider_groove"), option, groove.size());
  2854. QRect pixmapRect(0, 0, groove.width(), groove.height());
  2855. // draw background groove
  2856. if (!QPixmapCache::find(groovePixmapName, PIXMAPCACHE_VAR_PREFIX cache)) {
  2857. cache = styleCachePixmap(pixmapRect.size());
  2858. cache.fill(Qt::transparent);
  2859. QPainter groovePainter(&cache);
  2860. groovePainter.setRenderHint(QPainter::Antialiasing, true);
  2861. groovePainter.translate(0.5, 0.5);
  2862. QLinearGradient gradient;
  2863. if (horizontal) {
  2864. gradient.setStart(pixmapRect.center().x(), pixmapRect.top());
  2865. gradient.setFinalStop(pixmapRect.center().x(), pixmapRect.bottom());
  2866. }
  2867. else {
  2868. gradient.setStart(pixmapRect.left(), pixmapRect.center().y());
  2869. gradient.setFinalStop(pixmapRect.right(), pixmapRect.center().y());
  2870. }
  2871. groovePainter.setPen(QPen(outline, 0));
  2872. gradient.setColorAt(0, grooveColor.darker(110));
  2873. gradient.setColorAt(1, grooveColor.lighter(110));//palette.button().color().darker(115));
  2874. groovePainter.setBrush(gradient);
  2875. groovePainter.drawRoundedRect(pixmapRect.adjusted(1, 1, -2, -2), 1, 1);
  2876. groovePainter.end();
  2877. QPixmapCache::insert(groovePixmapName, cache);
  2878. }
  2879. painter->drawPixmap(groove.topLeft(), cache);
  2880. // draw blue groove highlight
  2881. QRect clipRect;
  2882. groovePixmapName += QLatin1String("_blue");
  2883. if (!QPixmapCache::find(groovePixmapName, PIXMAPCACHE_VAR_PREFIX cache)) {
  2884. cache = styleCachePixmap(pixmapRect.size());
  2885. cache.fill(Qt::transparent);
  2886. QPainter groovePainter(&cache);
  2887. QLinearGradient gradient;
  2888. if (horizontal) {
  2889. gradient.setStart(pixmapRect.center().x(), pixmapRect.top());
  2890. gradient.setFinalStop(pixmapRect.center().x(), pixmapRect.bottom());
  2891. }
  2892. else {
  2893. gradient.setStart(pixmapRect.left(), pixmapRect.center().y());
  2894. gradient.setFinalStop(pixmapRect.right(), pixmapRect.center().y());
  2895. }
  2896. QColor highlight = d->highlight(option->palette);
  2897. QColor highlightedoutline = highlight.darker(140);
  2898. if (qGray(outline.rgb()) > qGray(highlightedoutline.rgb()))
  2899. outline = highlightedoutline;
  2900. groovePainter.setRenderHint(QPainter::Antialiasing, true);
  2901. groovePainter.translate(0.5, 0.5);
  2902. groovePainter.setPen(QPen(outline, 0));
  2903. gradient.setColorAt(0, activeHighlight);
  2904. gradient.setColorAt(1, activeHighlight.lighter(130));
  2905. groovePainter.setBrush(gradient);
  2906. groovePainter.drawRoundedRect(pixmapRect.adjusted(1, 1, -2, -2), 1, 1);
  2907. groovePainter.setPen(d->innerContrastLine());
  2908. groovePainter.setBrush(Qt::NoBrush);
  2909. groovePainter.drawRoundedRect(pixmapRect.adjusted(2, 2, -3, -3), 1, 1);
  2910. groovePainter.end();
  2911. QPixmapCache::insert(groovePixmapName, cache);
  2912. }
  2913. if (horizontal) {
  2914. if (slider->upsideDown)
  2915. clipRect = QRect(handle.right(), groove.top(), groove.right() - handle.right(), groove.height());
  2916. else
  2917. clipRect = QRect(groove.left(), groove.top(), handle.left(), groove.height());
  2918. } else {
  2919. if (slider->upsideDown)
  2920. clipRect = QRect(groove.left(), handle.bottom(), groove.width(), groove.height() - handle.bottom());
  2921. else
  2922. clipRect = QRect(groove.left(), groove.top(), groove.width(), handle.top() - groove.top());
  2923. }
  2924. painter->save();
  2925. painter->setClipRect(clipRect.adjusted(0, 0, 1, 1));
  2926. painter->drawPixmap(groove.topLeft(), cache);
  2927. painter->restore();
  2928. }
  2929. if (option->subControls & SC_SliderTickmarks) {
  2930. painter->setPen(outline);
  2931. int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
  2932. int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
  2933. int interval = slider->tickInterval;
  2934. if (interval <= 0) {
  2935. interval = slider->singleStep;
  2936. if (QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, interval,
  2937. available)
  2938. - QStyle::sliderPositionFromValue(slider->minimum, slider->maximum,
  2939. 0, available) < 3)
  2940. interval = slider->pageStep;
  2941. }
  2942. if (interval <= 0)
  2943. interval = 1;
  2944. int v = slider->minimum;
  2945. int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
  2946. while (v <= slider->maximum + 1) {
  2947. if (v == slider->maximum + 1 && interval == 1)
  2948. break;
  2949. const int v_ = qMin(v, slider->maximum);
  2950. int pos = sliderPositionFromValue(slider->minimum, slider->maximum,
  2951. v_, (horizontal
  2952. ? slider->rect.width()
  2953. : slider->rect.height()) - len,
  2954. slider->upsideDown) + len / 2;
  2955. int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0);
  2956. if (horizontal) {
  2957. if (ticksAbove) {
  2958. painter->drawLine(pos, slider->rect.top() + extra,
  2959. pos, slider->rect.top() + tickSize);
  2960. }
  2961. if (ticksBelow) {
  2962. painter->drawLine(pos, slider->rect.bottom() - extra,
  2963. pos, slider->rect.bottom() - tickSize);
  2964. }
  2965. } else {
  2966. if (ticksAbove) {
  2967. painter->drawLine(slider->rect.left() + extra, pos,
  2968. slider->rect.left() + tickSize, pos);
  2969. }
  2970. if (ticksBelow) {
  2971. painter->drawLine(slider->rect.right() - extra, pos,
  2972. slider->rect.right() - tickSize, pos);
  2973. }
  2974. }
  2975. // in the case where maximum is max int
  2976. int nextInterval = v + interval;
  2977. if (nextInterval < v)
  2978. break;
  2979. v = nextInterval;
  2980. }
  2981. }
  2982. // draw handle
  2983. if ((option->subControls & SC_SliderHandle) ) {
  2984. QString handlePixmapName = uniqueName(QLatin1String("slider_handle"), option, handle.size());
  2985. if (!QPixmapCache::find(handlePixmapName, PIXMAPCACHE_VAR_PREFIX cache)) {
  2986. cache = styleCachePixmap(handle.size());
  2987. cache.fill(Qt::transparent);
  2988. QRect pixmapRect(0, 0, handle.width(), handle.height());
  2989. QPainter handlePainter(&cache);
  2990. QRect gradRect = pixmapRect.adjusted(2, 2, -2, -2);
  2991. // gradient fill
  2992. QRect r = pixmapRect.adjusted(1, 1, -2, -2);
  2993. QLinearGradient gradient = qt_fusion_gradient(gradRect, d->buttonColor(option->palette),horizontal ? TopDown : FromLeft);
  2994. handlePainter.setRenderHint(QPainter::Antialiasing, true);
  2995. handlePainter.translate(0.5, 0.5);
  2996. handlePainter.setPen(Qt::NoPen);
  2997. handlePainter.setBrush(QColor(0, 0, 0, 40));
  2998. handlePainter.drawRect(r.adjusted(-1, 2, 1, -2));
  2999. handlePainter.setPen(QPen(d->outline(option->palette), 1));
  3000. if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
  3001. handlePainter.setPen(QPen(d->highlightedOutline(option->palette), 1));
  3002. handlePainter.setBrush(gradient);
  3003. handlePainter.drawRoundedRect(r, 2, 2);
  3004. handlePainter.setBrush(Qt::NoBrush);
  3005. handlePainter.setPen(d->innerContrastLine());
  3006. handlePainter.drawRoundedRect(r.adjusted(1, 1, -1, -1), 2, 2);
  3007. QColor cornerAlpha = outline.darker(120);
  3008. cornerAlpha.setAlpha(80);
  3009. //handle shadow
  3010. handlePainter.setPen(shadowAlpha);
  3011. handlePainter.drawLine(QPoint(r.left() + 2, r.bottom() + 1), QPoint(r.right() - 2, r.bottom() + 1));
  3012. handlePainter.drawLine(QPoint(r.right() + 1, r.bottom() - 3), QPoint(r.right() + 1, r.top() + 4));
  3013. handlePainter.drawLine(QPoint(r.right() - 1, r.bottom()), QPoint(r.right() + 1, r.bottom() - 2));
  3014. handlePainter.end();
  3015. QPixmapCache::insert(handlePixmapName, cache);
  3016. }
  3017. painter->drawPixmap(handle.topLeft(), cache);
  3018. }
  3019. painter->setBrush(oldBrush);
  3020. painter->setPen(oldPen);
  3021. }
  3022. break;
  3023. case CC_Dial:
  3024. if (const QStyleOptionSlider* dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
  3025. drawDial(dial, painter);
  3026. break;
  3027. default:
  3028. QCommonStyle::drawComplexControl(control, option, painter, widget);
  3029. break;
  3030. }
  3031. }
  3032. /*!
  3033. \reimp
  3034. */
  3035. int CarlaStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
  3036. {
  3037. switch (metric)
  3038. {
  3039. case PM_SliderTickmarkOffset:
  3040. return 4;
  3041. case PM_HeaderMargin:
  3042. return 2;
  3043. case PM_ToolTipLabelFrameWidth:
  3044. return 2;
  3045. case PM_ButtonDefaultIndicator:
  3046. return 0;
  3047. case PM_ButtonShiftHorizontal:
  3048. case PM_ButtonShiftVertical:
  3049. return 0;
  3050. case PM_MessageBoxIconSize:
  3051. return 48;
  3052. case PM_ListViewIconSize:
  3053. return 24;
  3054. case PM_DialogButtonsSeparator:
  3055. case PM_ScrollBarSliderMin:
  3056. return 26;
  3057. case PM_TitleBarHeight:
  3058. return 24;
  3059. case PM_ScrollBarExtent:
  3060. return 14;
  3061. case PM_SliderThickness:
  3062. return 15;
  3063. case PM_SliderLength:
  3064. return 15;
  3065. case PM_DockWidgetTitleMargin:
  3066. return 1;
  3067. case PM_DefaultFrameWidth:
  3068. return 1;
  3069. case PM_SpinBoxFrameWidth:
  3070. return 2;
  3071. case PM_MenuVMargin:
  3072. case PM_MenuHMargin:
  3073. return 0;
  3074. case PM_MenuPanelWidth:
  3075. return 0;
  3076. case PM_MenuBarItemSpacing:
  3077. return 6;
  3078. case PM_MenuBarVMargin:
  3079. return 0;
  3080. case PM_MenuBarHMargin:
  3081. return 0;
  3082. case PM_MenuBarPanelWidth:
  3083. return 0;
  3084. case PM_ToolBarHandleExtent:
  3085. return 9;
  3086. case PM_ToolBarItemSpacing:
  3087. return 1;
  3088. case PM_ToolBarFrameWidth:
  3089. return 2;
  3090. case PM_ToolBarItemMargin:
  3091. return 2;
  3092. case PM_SmallIconSize:
  3093. return 16;
  3094. case PM_ButtonIconSize:
  3095. return 16;
  3096. case PM_DockWidgetTitleBarButtonMargin:
  3097. return 2;
  3098. case PM_MaximumDragDistance:
  3099. return -1;
  3100. case PM_TabCloseIndicatorWidth:
  3101. case PM_TabCloseIndicatorHeight:
  3102. return 20;
  3103. case PM_TabBarTabVSpace:
  3104. return 12;
  3105. case PM_TabBarTabOverlap:
  3106. return 1;
  3107. case PM_TabBarBaseOverlap:
  3108. return 2;
  3109. case PM_SubMenuOverlap:
  3110. return -1;
  3111. case PM_DockWidgetHandleExtent:
  3112. case PM_SplitterWidth:
  3113. return 4;
  3114. case PM_IndicatorHeight:
  3115. case PM_IndicatorWidth:
  3116. case PM_ExclusiveIndicatorHeight:
  3117. case PM_ExclusiveIndicatorWidth:
  3118. return 14;
  3119. case PM_ScrollView_ScrollBarSpacing:
  3120. return 0;
  3121. default:
  3122. break;
  3123. }
  3124. return QCommonStyle::pixelMetric(metric, option, widget);
  3125. }
  3126. /*!
  3127. \reimp
  3128. */
  3129. QSize CarlaStyle::sizeFromContents(ContentsType type, const QStyleOption* option,
  3130. const QSize& size, const QWidget* widget) const
  3131. {
  3132. QSize newSize = QCommonStyle::sizeFromContents(type, option, size, widget);
  3133. switch (type)
  3134. {
  3135. case CT_PushButton:
  3136. if (const QStyleOptionButton* btn = qstyleoption_cast<const QStyleOptionButton *>(option))
  3137. {
  3138. if (!btn->text.isEmpty() && newSize.width() < 80)
  3139. newSize.setWidth(80);
  3140. if (!btn->icon.isNull() && btn->iconSize.height() > 16)
  3141. newSize -= QSize(0, 2);
  3142. }
  3143. break;
  3144. case CT_GroupBox:
  3145. if (option)
  3146. {
  3147. int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin;
  3148. newSize += QSize(10, topMargin); // Add some space below the groupbox
  3149. }
  3150. break;
  3151. case CT_RadioButton:
  3152. case CT_CheckBox:
  3153. newSize += QSize(0, 1);
  3154. break;
  3155. case CT_ToolButton:
  3156. newSize += QSize(3, 3);
  3157. break;
  3158. case CT_SpinBox:
  3159. newSize += QSize(0, -3);
  3160. break;
  3161. case CT_ComboBox:
  3162. newSize += QSize(2, 4);
  3163. break;
  3164. case CT_LineEdit:
  3165. newSize += QSize(0, 4);
  3166. break;
  3167. case CT_MenuBarItem:
  3168. newSize += QSize(8, 5);
  3169. break;
  3170. case CT_MenuItem:
  3171. if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option))
  3172. {
  3173. int w = newSize.width();
  3174. int maxpmw = menuItem->maxIconWidth;
  3175. int tabSpacing = 20;
  3176. if (menuItem->text.contains(QLatin1Char('\t')))
  3177. w += tabSpacing;
  3178. else if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu)
  3179. w += 2 * CarlaStylePrivate::menuArrowHMargin;
  3180. else if (menuItem->menuItemType == QStyleOptionMenuItem::DefaultItem) {
  3181. QFontMetrics fm(menuItem->font);
  3182. QFont fontBold = menuItem->font;
  3183. fontBold.setBold(true);
  3184. QFontMetrics fmBold(fontBold);
  3185. w += fontMetricsHorizontalAdvance(fmBold, menuItem->text) - fontMetricsHorizontalAdvance(fm, menuItem->text);
  3186. }
  3187. int checkcol = qMax<int>(maxpmw, CarlaStylePrivate::menuCheckMarkWidth); // Windows always shows a check column
  3188. w += checkcol;
  3189. w += int(CarlaStylePrivate::menuRightBorder) + 10;
  3190. newSize.setWidth(w);
  3191. if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
  3192. if (!menuItem->text.isEmpty()) {
  3193. newSize.setHeight(menuItem->fontMetrics.height());
  3194. }
  3195. }
  3196. else if (!menuItem->icon.isNull())
  3197. {
  3198. if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget)) {
  3199. newSize.setHeight(qMax(combo->iconSize().height() + 2, newSize.height()));
  3200. }
  3201. }
  3202. newSize.setWidth(newSize.width() + 12);
  3203. newSize.setWidth(qMax(newSize.width(), 120));
  3204. }
  3205. break;
  3206. case CT_SizeGrip:
  3207. newSize += QSize(4, 4);
  3208. break;
  3209. case CT_MdiControls:
  3210. if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option))
  3211. {
  3212. int width = 0;
  3213. if (styleOpt->subControls & SC_MdiMinButton)
  3214. width += 19 + 1;
  3215. if (styleOpt->subControls & SC_MdiNormalButton)
  3216. width += 19 + 1;
  3217. if (styleOpt->subControls & SC_MdiCloseButton)
  3218. width += 19 + 1;
  3219. newSize = QSize(width, 19);
  3220. }
  3221. else
  3222. {
  3223. newSize = QSize(60, 19);
  3224. }
  3225. break;
  3226. default:
  3227. break;
  3228. }
  3229. return newSize;
  3230. }
  3231. void CarlaStyle::polish(QApplication* app)
  3232. {
  3233. QCommonStyle::polish(app);
  3234. }
  3235. void CarlaStyle::polish(QPalette& pal)
  3236. {
  3237. QCommonStyle::polish(pal);
  3238. }
  3239. /*!
  3240. \reimp
  3241. */
  3242. void CarlaStyle::polish(QWidget *widget)
  3243. {
  3244. QCommonStyle::polish(widget);
  3245. if (qobject_cast<QAbstractButton*>(widget)
  3246. || qobject_cast<QComboBox *>(widget)
  3247. || qobject_cast<QProgressBar *>(widget)
  3248. || qobject_cast<QScrollBar *>(widget)
  3249. || qobject_cast<QSplitterHandle *>(widget)
  3250. || qobject_cast<QAbstractSlider *>(widget)
  3251. || qobject_cast<QAbstractSpinBox *>(widget)
  3252. || (widget->inherits("QDockSeparator"))
  3253. || (widget->inherits("QDockWidgetSeparator"))
  3254. ) {
  3255. widget->setAttribute(Qt::WA_Hover, true);
  3256. }
  3257. }
  3258. void CarlaStyle::unpolish(QApplication* app)
  3259. {
  3260. QCommonStyle::unpolish(app);
  3261. }
  3262. /*!
  3263. \reimp
  3264. */
  3265. void CarlaStyle::unpolish(QWidget *widget)
  3266. {
  3267. QCommonStyle::unpolish(widget);
  3268. if (qobject_cast<QAbstractButton*>(widget)
  3269. || qobject_cast<QComboBox *>(widget)
  3270. || qobject_cast<QProgressBar *>(widget)
  3271. || qobject_cast<QScrollBar *>(widget)
  3272. || qobject_cast<QSplitterHandle *>(widget)
  3273. || qobject_cast<QAbstractSlider *>(widget)
  3274. || qobject_cast<QAbstractSpinBox *>(widget)
  3275. || (widget->inherits("QDockSeparator"))
  3276. || (widget->inherits("QDockWidgetSeparator"))
  3277. ) {
  3278. widget->setAttribute(Qt::WA_Hover, false);
  3279. }
  3280. }
  3281. /*!
  3282. \reimp
  3283. */
  3284. QRect CarlaStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option,
  3285. SubControl subControl, const QWidget *widget) const
  3286. {
  3287. QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget);
  3288. switch (control) {
  3289. case CC_Slider:
  3290. if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
  3291. int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
  3292. switch (subControl) {
  3293. case SC_SliderHandle: {
  3294. if (slider->orientation == Qt::Horizontal) {
  3295. rect.setHeight(proxy()->pixelMetric(PM_SliderThickness));
  3296. rect.setWidth(proxy()->pixelMetric(PM_SliderLength));
  3297. int centerY = slider->rect.center().y() - rect.height() / 2;
  3298. if (slider->tickPosition & QSlider::TicksAbove)
  3299. centerY += tickSize;
  3300. if (slider->tickPosition & QSlider::TicksBelow)
  3301. centerY -= tickSize;
  3302. rect.moveTop(centerY);
  3303. } else {
  3304. rect.setWidth(proxy()->pixelMetric(PM_SliderThickness));
  3305. rect.setHeight(proxy()->pixelMetric(PM_SliderLength));
  3306. int centerX = slider->rect.center().x() - rect.width() / 2;
  3307. if (slider->tickPosition & QSlider::TicksAbove)
  3308. centerX += tickSize;
  3309. if (slider->tickPosition & QSlider::TicksBelow)
  3310. centerX -= tickSize;
  3311. rect.moveLeft(centerX);
  3312. }
  3313. }
  3314. break;
  3315. case SC_SliderGroove: {
  3316. QPoint grooveCenter = slider->rect.center();
  3317. if (slider->orientation == Qt::Horizontal) {
  3318. rect.setHeight(7);
  3319. if (slider->tickPosition & QSlider::TicksAbove)
  3320. grooveCenter.ry() += tickSize;
  3321. if (slider->tickPosition & QSlider::TicksBelow)
  3322. grooveCenter.ry() -= tickSize;
  3323. } else {
  3324. rect.setWidth(7);
  3325. if (slider->tickPosition & QSlider::TicksAbove)
  3326. grooveCenter.rx() += tickSize;
  3327. if (slider->tickPosition & QSlider::TicksBelow)
  3328. grooveCenter.rx() -= tickSize;
  3329. }
  3330. rect.moveCenter(grooveCenter);
  3331. break;
  3332. }
  3333. default:
  3334. break;
  3335. }
  3336. }
  3337. break;
  3338. case CC_SpinBox:
  3339. if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
  3340. QSize bs;
  3341. const float center = spinbox->rect.height() / 2.0;
  3342. const int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
  3343. const int y = 1;
  3344. bs.setHeight(qMax(8, int(floor(center) - y)));
  3345. bs.setWidth(14);
  3346. int x, lx, rx;
  3347. x = spinbox->rect.width() - y - bs.width();
  3348. lx = fw;
  3349. rx = x - fw;
  3350. switch (subControl) {
  3351. case SC_SpinBoxUp:
  3352. if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
  3353. return QRect();
  3354. rect = QRect(x, y, bs.width(), bs.height());
  3355. break;
  3356. case SC_SpinBoxDown:
  3357. if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
  3358. return QRect();
  3359. rect = QRect(x, ceil(center), bs.width(), bs.height());
  3360. break;
  3361. case SC_SpinBoxEditField:
  3362. if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) {
  3363. rect = QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw);
  3364. } else {
  3365. rect = QRect(lx, fw, rx - qMax(fw - 1, 0), spinbox->rect.height() - 2*fw);
  3366. }
  3367. break;
  3368. case SC_SpinBoxFrame:
  3369. rect = spinbox->rect;
  3370. default:
  3371. break;
  3372. }
  3373. rect = visualRect(spinbox->direction, spinbox->rect, rect);
  3374. }
  3375. break;
  3376. case CC_GroupBox:
  3377. if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
  3378. rect = option->rect;
  3379. if (subControl == SC_GroupBoxFrame)
  3380. return rect.adjusted(0, 0, 0, 0);
  3381. else if (subControl == SC_GroupBoxContents) {
  3382. QRect frameRect = option->rect.adjusted(0, 0, 0, -groupBoxBottomMargin);
  3383. int margin = 3;
  3384. int leftMarginExtension = 0;
  3385. int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin;
  3386. return frameRect.adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin);
  3387. }
  3388. QSize textSize = option->fontMetrics.boundingRect(groupBox->text).size() + QSize(2, 2);
  3389. int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
  3390. int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
  3391. rect = QRect();
  3392. if (subControl == SC_GroupBoxCheckBox) {
  3393. rect.setWidth(indicatorWidth);
  3394. rect.setHeight(indicatorHeight);
  3395. rect.moveTop(textSize.height() > indicatorHeight ? (textSize.height() - indicatorHeight) / 2 : 0);
  3396. rect.moveLeft(1);
  3397. } else if (subControl == SC_GroupBoxLabel) {
  3398. rect.setSize(textSize);
  3399. rect.moveTop(1);
  3400. if (option->subControls & QStyle::SC_GroupBoxCheckBox)
  3401. rect.translate(indicatorWidth + 5, 0);
  3402. }
  3403. return visualRect(option->direction, option->rect, rect);
  3404. }
  3405. return rect;
  3406. case CC_ComboBox:
  3407. switch (subControl) {
  3408. case SC_ComboBoxArrow:
  3409. rect = visualRect(option->direction, option->rect, rect);
  3410. rect.setRect(rect.right() - 18, rect.top() - 2,
  3411. 19, rect.height() + 4);
  3412. rect = visualRect(option->direction, option->rect, rect);
  3413. break;
  3414. case SC_ComboBoxEditField: {
  3415. int frameWidth = 2;
  3416. rect = visualRect(option->direction, option->rect, rect);
  3417. rect.setRect(option->rect.left() + frameWidth, option->rect.top() + frameWidth,
  3418. option->rect.width() - 19 - 2 * frameWidth,
  3419. option->rect.height() - 2 * frameWidth);
  3420. if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
  3421. if (!box->editable) {
  3422. rect.adjust(2, 0, 0, 0);
  3423. if (box->state & (State_Sunken | State_On))
  3424. rect.translate(1, 1);
  3425. }
  3426. }
  3427. rect = visualRect(option->direction, option->rect, rect);
  3428. break;
  3429. }
  3430. default:
  3431. break;
  3432. }
  3433. break;
  3434. case CC_TitleBar:
  3435. if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
  3436. SubControl sc = subControl;
  3437. QRect &ret = rect;
  3438. const int indent = 3;
  3439. const int controlTopMargin = 3;
  3440. const int controlBottomMargin = 3;
  3441. const int controlWidthMargin = 2;
  3442. const int controlHeight = tb->rect.height() - controlTopMargin - controlBottomMargin ;
  3443. const int delta = controlHeight + controlWidthMargin;
  3444. int offset = 0;
  3445. bool isMinimized = tb->titleBarState & Qt::WindowMinimized;
  3446. bool isMaximized = tb->titleBarState & Qt::WindowMaximized;
  3447. switch (sc) {
  3448. case SC_TitleBarLabel:
  3449. if (tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint)) {
  3450. ret = tb->rect;
  3451. if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
  3452. ret.adjust(delta, 0, -delta, 0);
  3453. if (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)
  3454. ret.adjust(0, 0, -delta, 0);
  3455. if (tb->titleBarFlags & Qt::WindowMaximizeButtonHint)
  3456. ret.adjust(0, 0, -delta, 0);
  3457. if (tb->titleBarFlags & Qt::WindowShadeButtonHint)
  3458. ret.adjust(0, 0, -delta, 0);
  3459. if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
  3460. ret.adjust(0, 0, -delta, 0);
  3461. }
  3462. break;
  3463. case SC_TitleBarContextHelpButton:
  3464. if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
  3465. offset += delta;
  3466. // fall through
  3467. case SC_TitleBarMinButton:
  3468. if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
  3469. offset += delta;
  3470. else if (sc == SC_TitleBarMinButton)
  3471. break;
  3472. // fall through
  3473. case SC_TitleBarNormalButton:
  3474. if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
  3475. offset += delta;
  3476. else if (isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
  3477. offset += delta;
  3478. else if (sc == SC_TitleBarNormalButton)
  3479. break;
  3480. // fall through
  3481. case SC_TitleBarMaxButton:
  3482. if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
  3483. offset += delta;
  3484. else if (sc == SC_TitleBarMaxButton)
  3485. break;
  3486. // fall through
  3487. case SC_TitleBarShadeButton:
  3488. if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
  3489. offset += delta;
  3490. else if (sc == SC_TitleBarShadeButton)
  3491. break;
  3492. // fall through
  3493. case SC_TitleBarUnshadeButton:
  3494. if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
  3495. offset += delta;
  3496. else if (sc == SC_TitleBarUnshadeButton)
  3497. break;
  3498. // fall through
  3499. case SC_TitleBarCloseButton:
  3500. if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
  3501. offset += delta;
  3502. else if (sc == SC_TitleBarCloseButton)
  3503. break;
  3504. ret.setRect(tb->rect.right() - indent - offset, tb->rect.top() + controlTopMargin,
  3505. controlHeight, controlHeight);
  3506. break;
  3507. case SC_TitleBarSysMenu:
  3508. if (tb->titleBarFlags & Qt::WindowSystemMenuHint) {
  3509. ret.setRect(tb->rect.left() + controlWidthMargin + indent, tb->rect.top() + controlTopMargin,
  3510. controlHeight, controlHeight);
  3511. }
  3512. break;
  3513. default:
  3514. break;
  3515. }
  3516. ret = visualRect(tb->direction, tb->rect, ret);
  3517. }
  3518. break;
  3519. default:
  3520. break;
  3521. }
  3522. return rect;
  3523. }
  3524. /*!
  3525. \reimp
  3526. */
  3527. QPixmap CarlaStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption* opt, const QWidget* widget) const
  3528. {
  3529. #if 0 // ndef QT_NO_IMAGEFORMAT_XPM
  3530. switch (standardPixmap) {
  3531. case SP_TitleBarNormalButton:
  3532. return QPixmap((const char **)dock_widget_restore_xpm);
  3533. case SP_TitleBarMinButton:
  3534. return QPixmap((const char **)workspace_minimize);
  3535. case SP_TitleBarCloseButton:
  3536. case SP_DockWidgetCloseButton:
  3537. return QPixmap((const char **)dock_widget_close_xpm);
  3538. default:
  3539. break;
  3540. }
  3541. #endif //QT_NO_IMAGEFORMAT_XPM
  3542. QPixmap pixmap = QCommonStyle::standardPixmap(standardPixmap, opt, widget);
  3543. if(!pixmap.isNull())
  3544. return pixmap;
  3545. #if 0 // ndef QT_NO_IMAGEFORMAT_XPM
  3546. switch (standardPixmap) {
  3547. case SP_TitleBarMenuButton:
  3548. return QPixmap(qt_menu_xpm);
  3549. case SP_TitleBarShadeButton:
  3550. return QPixmap(qt_shade_xpm);
  3551. case SP_TitleBarUnshadeButton:
  3552. return QPixmap(qt_unshade_xpm);
  3553. case SP_TitleBarMaxButton:
  3554. return QPixmap(qt_maximize_xpm);
  3555. case SP_TitleBarCloseButton:
  3556. return QPixmap(qt_close_xpm);
  3557. case SP_TitleBarContextHelpButton:
  3558. return QPixmap(qt_help_xpm);
  3559. case SP_MessageBoxInformation:
  3560. return QPixmap(information_xpm);
  3561. case SP_MessageBoxWarning:
  3562. return QPixmap(warning_xpm);
  3563. case SP_MessageBoxCritical:
  3564. return QPixmap(critical_xpm);
  3565. case SP_MessageBoxQuestion:
  3566. return QPixmap(question_xpm);
  3567. default:
  3568. break;
  3569. }
  3570. #endif //QT_NO_IMAGEFORMAT_XPM
  3571. return QPixmap();
  3572. }
  3573. /*!
  3574. \reimp
  3575. */
  3576. int CarlaStyle::styleHint(StyleHint hint, const QStyleOption* option, const QWidget* widget,
  3577. QStyleHintReturn* returnData) const
  3578. {
  3579. switch (hint)
  3580. {
  3581. case SH_Slider_SnapToValue:
  3582. case SH_PrintDialog_RightAlignButtons:
  3583. case SH_FontDialog_SelectAssociatedText:
  3584. case SH_MenuBar_AltKeyNavigation:
  3585. case SH_ComboBox_ListMouseTracking:
  3586. case SH_ScrollBar_StopMouseOverSlider:
  3587. case SH_ScrollBar_MiddleClickAbsolutePosition:
  3588. case SH_TitleBar_AutoRaise:
  3589. case SH_TitleBar_NoBorder:
  3590. case SH_ItemView_ShowDecorationSelected:
  3591. case SH_ItemView_ArrowKeysNavigateIntoChildren:
  3592. case SH_ItemView_ChangeHighlightOnFocus:
  3593. case SH_MenuBar_MouseTracking:
  3594. case SH_Menu_MouseTracking:
  3595. return 1;
  3596. case SH_ComboBox_Popup:
  3597. case SH_EtchDisabledText:
  3598. case SH_ToolBox_SelectedPageTitleBold:
  3599. case SH_ScrollView_FrameOnlyAroundContents:
  3600. case SH_Menu_AllowActiveAndDisabled:
  3601. case SH_MainWindow_SpaceBelowMenuBar:
  3602. //case SH_DialogButtonBox_ButtonsHaveIcons:
  3603. case SH_MessageBox_CenterButtons:
  3604. case SH_RubberBand_Mask:
  3605. case SH_UnderlineShortcut:
  3606. return 0;
  3607. case SH_Table_GridLineColor:
  3608. return option ? qt_palette_bg_color(option->palette).darker(120).rgb() : 0;
  3609. case SH_MessageBox_TextInteractionFlags:
  3610. return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse;
  3611. case SH_WizardStyle:
  3612. return QWizard::ClassicStyle;
  3613. case SH_Menu_SubMenuPopupDelay:
  3614. return 225; // default from GtkMenu
  3615. case SH_WindowFrame_Mask:
  3616. if (QStyleHintReturnMask* mask = qstyleoption_cast<QStyleHintReturnMask*>(returnData)) {
  3617. //left rounded corner
  3618. mask->region = option->rect;
  3619. mask->region -= QRect(option->rect.left(), option->rect.top(), 5, 1);
  3620. mask->region -= QRect(option->rect.left(), option->rect.top() + 1, 3, 1);
  3621. mask->region -= QRect(option->rect.left(), option->rect.top() + 2, 2, 1);
  3622. mask->region -= QRect(option->rect.left(), option->rect.top() + 3, 1, 2);
  3623. //right rounded corner
  3624. mask->region -= QRect(option->rect.right() - 4, option->rect.top(), 5, 1);
  3625. mask->region -= QRect(option->rect.right() - 2, option->rect.top() + 1, 3, 1);
  3626. mask->region -= QRect(option->rect.right() - 1, option->rect.top() + 2, 2, 1);
  3627. mask->region -= QRect(option->rect.right() , option->rect.top() + 3, 1, 2);
  3628. return 1;
  3629. }
  3630. default:
  3631. break;
  3632. }
  3633. return QCommonStyle::styleHint(hint, option, widget, returnData);
  3634. }
  3635. /*! \reimp */
  3636. QRect CarlaStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const
  3637. {
  3638. QRect r = QCommonStyle::subElementRect(sr, opt, w);
  3639. switch (sr) {
  3640. case SE_ProgressBarLabel:
  3641. case SE_ProgressBarContents:
  3642. case SE_ProgressBarGroove:
  3643. return opt->rect;
  3644. case SE_PushButtonFocusRect:
  3645. r.adjust(0, 1, 0, -1);
  3646. break;
  3647. case SE_DockWidgetTitleBarText: {
  3648. if (const QStyleOptionDockWidget *titlebar = qstyleoption_cast<const QStyleOptionDockWidget*>(opt)) {
  3649. Q_UNUSED(titlebar);
  3650. bool verticalTitleBar = false;
  3651. if (verticalTitleBar) {
  3652. r.adjust(0, 0, 0, -4);
  3653. } else {
  3654. if (opt->direction == Qt::LeftToRight)
  3655. r.adjust(4, 0, 0, 0);
  3656. else
  3657. r.adjust(0, 0, -4, 0);
  3658. }
  3659. }
  3660. break;
  3661. }
  3662. default:
  3663. break;
  3664. }
  3665. return r;
  3666. }