forked from qt-creator/qt-creator
Add add/remove splitter buttons to the editor view
Task-number: QTCREATORBUG-232 Change-Id: I71b517e09455bfdbe1b835515161e818a4f618f0 Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -843,6 +843,12 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
||||
switch (control) {
|
||||
case CC_ToolButton:
|
||||
if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
|
||||
bool reverse = option->direction == Qt::RightToLeft;
|
||||
bool drawborder = (widget && widget->property("showborder").toBool());
|
||||
|
||||
if (drawborder)
|
||||
drawButtonSeparator(painter, rect, reverse);
|
||||
|
||||
QRect button, menuarea;
|
||||
button = subControlRect(control, toolbutton, SC_ToolButton, widget);
|
||||
menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
|
||||
@@ -918,25 +924,9 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
||||
bool drawborder = !(widget && widget->property("hideborder").toBool());
|
||||
bool alignarrow = !(widget && widget->property("alignarrow").toBool());
|
||||
|
||||
// Draw tool button
|
||||
if (drawborder) {
|
||||
QLinearGradient grad(option->rect.topRight(), option->rect.bottomRight());
|
||||
grad.setColorAt(0, QColor(255, 255, 255, 20));
|
||||
grad.setColorAt(0.4, QColor(255, 255, 255, 60));
|
||||
grad.setColorAt(0.7, QColor(255, 255, 255, 50));
|
||||
grad.setColorAt(1, QColor(255, 255, 255, 40));
|
||||
painter->setPen(QPen(grad, 0));
|
||||
painter->drawLine(rect.topRight(), rect.bottomRight());
|
||||
grad.setColorAt(0, QColor(0, 0, 0, 30));
|
||||
grad.setColorAt(0.4, QColor(0, 0, 0, 70));
|
||||
grad.setColorAt(0.7, QColor(0, 0, 0, 70));
|
||||
grad.setColorAt(1, QColor(0, 0, 0, 40));
|
||||
painter->setPen(QPen(grad, 0));
|
||||
if (!reverse)
|
||||
painter->drawLine(rect.topRight() - QPoint(1,0), rect.bottomRight() - QPoint(1,0));
|
||||
else
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
}
|
||||
if (drawborder)
|
||||
drawButtonSeparator(painter, rect, reverse);
|
||||
|
||||
QStyleOption toolbutton = *option;
|
||||
if (isEmpty)
|
||||
toolbutton.state &= ~(State_Enabled | State_Sunken);
|
||||
@@ -985,3 +975,23 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ManhattanStyle::drawButtonSeparator(QPainter *painter, const QRect &rect, bool reverse) const
|
||||
{
|
||||
QLinearGradient grad(rect.topRight(), rect.bottomRight());
|
||||
grad.setColorAt(0, QColor(255, 255, 255, 20));
|
||||
grad.setColorAt(0.4, QColor(255, 255, 255, 60));
|
||||
grad.setColorAt(0.7, QColor(255, 255, 255, 50));
|
||||
grad.setColorAt(1, QColor(255, 255, 255, 40));
|
||||
painter->setPen(QPen(grad, 0));
|
||||
painter->drawLine(rect.topRight(), rect.bottomRight());
|
||||
grad.setColorAt(0, QColor(0, 0, 0, 30));
|
||||
grad.setColorAt(0.4, QColor(0, 0, 0, 70));
|
||||
grad.setColorAt(0.7, QColor(0, 0, 0, 70));
|
||||
grad.setColorAt(1, QColor(0, 0, 0, 40));
|
||||
painter->setPen(QPen(grad, 0));
|
||||
if (!reverse)
|
||||
painter->drawLine(rect.topRight() - QPoint(1,0), rect.bottomRight() - QPoint(1,0));
|
||||
else
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user