void QStylePainter::drawPrimitive (QStyle::PE_IndicatorSpinDown, styleOption)
#ifndef SPINCOMBOBOX_H#define SPINCOMBOBOX_H#include <QSpinBox>#include <QStyleOption>class TStyleOptionSpinComboBox : public QStyleOptionSpinBox{public: enum { SO_SpinComboBox = SO_ComplexCustomBase + 1 }; enum StyleOptionType { Type = SO_SpinComboBox }; enum StyleOptionVersion { Version = 1 }; QAbstractSpinBox::ButtonSymbols buttonSymbols; QAbstractSpinBox::StepEnabled stepEnabled; bool frame; bool editable; QRect popupRect; QString currentText; QIcon currentIcon; QSize iconSize; TStyleOptionSpinComboBox();};class TSpinComboBox : public QSpinBox{ Q_OBJECTpublic: TSpinComboBox(QWidget *parent = 0); ~TSpinComboBox();protected: void paintEvent(QPaintEvent *event);private:};#endif // SPINCOMBOBOX_H
#include "spincombobox.h"#include <QPainter>#include <QStylePainter>#include <QtDebug>TStyleOptionSpinComboBox::TStyleOptionSpinComboBox(): /*QStyleOptionComplex(Version, SO_SpinComboBox),*/ buttonSymbols(QAbstractSpinBox::UpDownArrows), stepEnabled(QAbstractSpinBox::StepNone), frame(true), editable(false){ activeSubControls = QStyle::SC_SpinBoxDown | QStyle::SC_ComboBoxArrow; // нужно ли?}TSpinComboBox::TSpinComboBox(QWidget *parent) : QSpinBox(parent){}TSpinComboBox::~TSpinComboBox(){}void TSpinComboBox::paintEvent(QPaintEvent *event){ TStyleOptionSpinComboBox option; option.initFrom(this); // инициализация стиля SpinBox QStylePainter spainter(this); spainter.drawComplexControl(QStyle::CC_SpinBox, option); spainter.drawComplexControl(QStyle::CC_ComboBox, option);}