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 184KB

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