case CC_SpinBox:
if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
bool hover = hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver);
- QRect optr = opt->rect, arUp = subControlRect( cc, spin, SC_SpinBoxUp, w ),
- arDown = subControlRect( cc, spin, SC_SpinBoxDown, w );
+ QRect optr = opt->rect, arUp = subControlRect( cc, spin, SC_SpinBoxUp, w );
optr.setWidth( arUp.x()-optr.x()+1 );
double aRad = getDblValue( Style_Model::edit_rad );
bool antialized = getBoolValue( Style_Model::all_antialized );
aBrdBotCol, getBoolValue( Style_Model::all_antialized ), true, aStateOn );
break;
}
+ case CE_ComboBoxLabel:
+ if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
+ QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, w);
+ p->save();
+ p->setClipRect(editRect);
+ if (!cb->currentIcon.isNull()) {
+ QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
+ : QIcon::Disabled;
+ QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
+ QRect iconRect(editRect);
+ iconRect.setWidth(cb->iconSize.width() + 4);
+ iconRect = alignedRect(QApplication::layoutDirection(),
+ Qt::AlignLeft | Qt::AlignVCenter,
+ iconRect.size(), editRect);
+ // Here's absent filling of pixmap on basic color for editable comboBox
+ drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);
+
+ if (cb->direction == Qt::RightToLeft)
+ editRect.translate(-4 - cb->iconSize.width(), 0);
+ else
+ editRect.translate(cb->iconSize.width() + 4, 0);
+ }
+ if (!cb->currentText.isEmpty() && !cb->editable) {
+ drawItemText(p, editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, cb->palette,
+ cb->state & State_Enabled, cb->currentText);
+ }
+ p->restore();
+ }
+ break;
case CE_ScrollBarSubLine:
case CE_ScrollBarAddLine: {
bool aStateOn = opt->state & ( State_Sunken | State_On );
case CC_SpinBox: {
int x = res.x(), w = res.width(), h = res.height();
if ( sc==SC_SpinBoxUp || sc==SC_SpinBoxDown ) {
- res.setX( x-2*h+w );
- res.setWidth( 2*h );
+ QRect frame_r = QWindowsStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid );
+ h = frame_r.height();
+ res.setX( x+w-h );
+ res.setWidth( h );
}
else if ( sc==QStyle::SC_SpinBoxEditField ) {
- QRect old_r = QWindowsStyle::subControlRect( cc, opt, SC_SpinBoxUp, wid );
- res.setWidth( w-h+old_r.width()-2 );
- res.setTopLeft( QPoint( res.x()+aHalfRect-1, res.y() - SHADOW ) );
+ res.setWidth( w-h );
+ res.setTopLeft( QPoint( res.x()+aHalfRect, res.y()-SHADOW ) );
}
break;
}
res = cb->rect;
int x = res.x(), w = res.width(), h = res.height();
if ( sc==SC_ComboBoxArrow ) {
- res.setX( x-h+w );
+ res.setX( x+w-h );
res.setWidth( h );
}
else if ( sc==QStyle::SC_ComboBoxEditField ) {
- QRect old_r = QWindowsStyle::subControlRect( cc, opt, SC_ComboBoxArrow, wid );
- res.setWidth( w - h+old_r.width()-2 );
+ res.setWidth( w-h );
res.setTopLeft( QPoint( res.x()+aHalfRect, res.y()-SHADOW ) );
}
}
case SE_ProgressBarGroove:
return opt->rect;
}
- if( hasHover() ) {
- if( qobject_cast<const QRadioButton*>(wid) ||
- qobject_cast<const QCheckBox*>(wid) )
- res = res.adjusted(0, 0, 2, 0);
+ if( qobject_cast<const QRadioButton*>(wid) ||
+ qobject_cast<const QCheckBox*>(wid) ) {
+ if( hasHover() )
+ res = res.adjusted(0, 0, 2, 0);
}
return res;
}
QPainterPath arrow1;
int x = r.x(), y = r.y(), w = r.right()-x, h = r.bottom()-y;
int x11 = 0, x12 = 0, y11 = 0, y12 = 0;
- int deltaX = (int)(w/4.), deltaY = (int)(h/4.);
+ int aDelta = qMin( (int)(w/3.5), (int)(h/3.5) );
+ int deltaX = aDelta, deltaY = aDelta;
QLineF line( 0, 0, 1, 0 );
int xc = r.center().x(), yc = r.center().y();
p->translate( xc, yc );
case QStyle::PE_IndicatorArrowDown:
correct = true;
case QStyle::PE_IndicatorArrowUp: {
- deltaX = (int)(w/3.5), deltaY = (int)(w/3.5);
int widthArr2 = (int)(deltaX/3.);
if ( correct )
deltaY = -deltaY; // change arrow direction
case QStyle::PE_IndicatorArrowLeft: // to change
correct = true;
case QStyle::PE_IndicatorArrowRight: {
- deltaX = (int)(w/3.5), deltaY = (int)(w/3.5);
int widthArr2 = (int)(deltaX/3.);
if ( correct )
deltaX = -deltaX; // change arrow direction
case QStyle::PE_IndicatorSpinDown:
correct = true;
case QStyle::PE_IndicatorSpinUp: {
- deltaY = (int)(w/3.5);
- deltaX = (int)(w/3.5);
- int aDelta = (int)(deltaY/2);
+ aDelta = (int)(deltaY/2);
if ( correct ) {
aDelta = (int)(-aDelta/2);
deltaY = -deltaY;