qtssproxy.cpp 1.12 KB
#include "qtssproxy.h"
#include "QtStyleSheetStyle.h"
#include "qrenderruleproxy.h"
#include "qrenderrule.h"

QtSsProxy::QtSsProxy(QStyle *baseStyle):sss(new QtStyleSheetStyle(baseStyle))
{

}

bool QtSsProxy::canProxy(QStyle *style){
    if(auto p=qobject_cast<QtStyleSheetStyle*>(style))
    {
        return true;
    }
    return false;
}

QtSsProxy *QtSsProxy::proxy(QStyle *style){
    return new QtSsProxy(qobject_cast<QtStyleSheetStyle*>(style));
}

void QtSsProxy::setApplication(QApplication *app){
    app->setStyle(sss);
}

void QtSsProxy::setStyleSheet(const QString &css){
    sss->setStyleSheet(css);
}

QRenderRuleProxy QtSsProxy::renderRule(const QWidget *w, int element, quint64 state) const{
    return sss->renderRule(w,element,state);
}

QRenderRuleProxy QtSsProxy::renderRule(const QWidget *w, const QStyleOption *opt, int pseudoElement) const{
    return sss->renderRule(w,opt,pseudoElement);
}

QRect QtSsProxy::subControlRect(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QStyle::SubControl sc, const QWidget *w) const{
    return sss->subControlRect(cc,opt,sc,w);
}