Changeset View
Changeset View
Standalone View
Standalone View
plugin/kquickstyleitem.cpp
Show First 20 Lines • Show All 535 Lines • ▼ Show 20 Line(s) | 535 | if (!m_styleoption) | |||
---|---|---|---|---|---|
536 | m_styleoption = new QStyleOptionComboBox(); | 536 | m_styleoption = new QStyleOptionComboBox(); | ||
537 | 537 | | |||
538 | QStyleOptionComboBox *opt = qstyleoption_cast<QStyleOptionComboBox*>(m_styleoption); | 538 | QStyleOptionComboBox *opt = qstyleoption_cast<QStyleOptionComboBox*>(m_styleoption); | ||
539 | 539 | | |||
540 | const QFont font = qApp->font("QPushButton"); //DAVE - QQC1 code does this, but if you look at QComboBox this doesn't make sense | 540 | const QFont font = qApp->font("QPushButton"); //DAVE - QQC1 code does this, but if you look at QComboBox this doesn't make sense | ||
541 | opt->fontMetrics = QFontMetrics(font); | 541 | opt->fontMetrics = QFontMetrics(font); | ||
542 | opt->currentText = text(); | 542 | opt->currentText = text(); | ||
543 | opt->editable = m_properties[QStringLiteral("editable")].toBool(); | 543 | opt->editable = m_properties[QStringLiteral("editable")].toBool(); | ||
544 | | ||||
545 | const QVariant icon = m_properties[QStringLiteral("currentIcon")]; | ||||
546 | if (icon.canConvert<QIcon>()) { | ||||
547 | opt->currentIcon = icon.value<QIcon>(); | ||||
548 | } else if (icon.canConvert<QString>()) { | ||||
549 | opt->currentIcon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>()); | ||||
550 | } | ||||
551 | auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); | ||||
552 | if (iconSize.isEmpty()) { | ||||
553 | int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); | ||||
554 | if (iconSize.width() <= 0) { | ||||
555 | iconSize.setWidth(e); | ||||
556 | } | ||||
557 | if (iconSize.height() <= 0) { | ||||
558 | iconSize.setHeight(e); | ||||
559 | } | ||||
560 | } | ||||
561 | opt->iconSize = iconSize; | ||||
544 | } | 562 | } | ||
545 | break; | 563 | break; | ||
546 | case SpinBox: { | 564 | case SpinBox: { | ||
547 | if (!m_styleoption) | 565 | if (!m_styleoption) | ||
548 | m_styleoption = new QStyleOptionSpinBox(); | 566 | m_styleoption = new QStyleOptionSpinBox(); | ||
549 | 567 | | |||
550 | QStyleOptionSpinBox *opt = qstyleoption_cast<QStyleOptionSpinBox*>(m_styleoption); | 568 | QStyleOptionSpinBox *opt = qstyleoption_cast<QStyleOptionSpinBox*>(m_styleoption); | ||
551 | opt->frame = true; | 569 | opt->frame = true; | ||
▲ Show 20 Lines • Show All 1213 Lines • Show Last 20 Lines |