mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-03 19:17:02 -05:00 
			
		
		
		
	Make toolbar separators stand out a bit more in dark themes
This commit is contained in:
		
							parent
							
								
									7f991ad084
								
							
						
					
					
						commit
						6fb8c25e89
					
				@ -10,6 +10,7 @@
 | 
			
		||||
#include <QFormLayout>
 | 
			
		||||
#include <QDialogButtonBox>
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <qdrawutil.h>
 | 
			
		||||
 | 
			
		||||
QProgressIndicator::QProgressIndicator(QWidget* parent, int size, int interval)
 | 
			
		||||
        : QWidget(parent),
 | 
			
		||||
@ -214,6 +215,47 @@ class CalibreStyle: public QProxyStyle {
 | 
			
		||||
                        return QProxyStyle::drawPrimitive(element, &opt, painter, widget);
 | 
			
		||||
                    }
 | 
			
		||||
                    break;
 | 
			
		||||
				case PE_IndicatorToolBarSeparator:
 | 
			
		||||
					// Make toolbar separators stand out a bit more in dark themes
 | 
			
		||||
					{
 | 
			
		||||
						QRect rect = option->rect;
 | 
			
		||||
						const int margin = 6;
 | 
			
		||||
						QColor bg = option->palette.color(QPalette::Window);
 | 
			
		||||
						QColor first, second;
 | 
			
		||||
						if (bg.valueF() < 0.45) {
 | 
			
		||||
							first = bg.darker(115);
 | 
			
		||||
							second = bg.lighter(115);
 | 
			
		||||
						} else {
 | 
			
		||||
							first = bg.darker(110);
 | 
			
		||||
							second = bg.lighter(110);
 | 
			
		||||
						}
 | 
			
		||||
						if (option->state & State_Horizontal) {
 | 
			
		||||
							const int offset = rect.width()/2;
 | 
			
		||||
							painter->setPen(QPen(first));
 | 
			
		||||
							painter->drawLine(rect.bottomLeft().x() + offset,
 | 
			
		||||
									rect.bottomLeft().y() - margin,
 | 
			
		||||
									rect.topLeft().x() + offset,
 | 
			
		||||
									rect.topLeft().y() + margin);
 | 
			
		||||
							painter->setPen(QPen(second));
 | 
			
		||||
							painter->drawLine(rect.bottomLeft().x() + offset + 1,
 | 
			
		||||
									rect.bottomLeft().y() - margin,
 | 
			
		||||
									rect.topLeft().x() + offset + 1,
 | 
			
		||||
									rect.topLeft().y() + margin);
 | 
			
		||||
						} else { //Draw vertical separator
 | 
			
		||||
							const int offset = rect.height()/2;
 | 
			
		||||
							painter->setPen(QPen(first));
 | 
			
		||||
							painter->drawLine(rect.topLeft().x() + margin ,
 | 
			
		||||
									rect.topLeft().y() + offset,
 | 
			
		||||
									rect.topRight().x() - margin,
 | 
			
		||||
									rect.topRight().y() + offset);
 | 
			
		||||
							painter->setPen(QPen(second));
 | 
			
		||||
							painter->drawLine(rect.topLeft().x() + margin ,
 | 
			
		||||
									rect.topLeft().y() + offset + 1,
 | 
			
		||||
									rect.topRight().x() - margin,
 | 
			
		||||
									rect.topRight().y() + offset + 1);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					return;
 | 
			
		||||
                default:
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user