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