PushButton::PushButton(QGraphicsWidget *parent) : QGraphicsProxyWidget(parent), d(new PushButtonPrivate(this)) { d->background = new FrameSvg(this); d->background->setImagePath("widgets/button"); d->background->setCacheAllRenderedFrames(true); d->background->setElementPrefix("normal"); d->hoverAnimation = Animator::create(Animator::PixmapTransitionAnimation); d->hoverAnimation->setTargetWidget(this); KPushButton *native = new KPushButton; connect(native, SIGNAL(pressed()), this, SIGNAL(pressed())); connect(native, SIGNAL(pressed()), this, SLOT(pressedChanged())); connect(native, SIGNAL(released()), this, SIGNAL(released())); connect(native, SIGNAL(released()), this, SLOT(pressedChanged())); connect(native, SIGNAL(clicked()), this, SIGNAL(clicked())); connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool))); setWidget(native); native->setAttribute(Qt::WA_NoSystemBackground); native->setWindowIcon(QIcon()); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); d->focusIndicator = new FocusIndicator(this, d->background); d->syncBorders(); setAcceptHoverEvents(true); connect(d->background, SIGNAL(repaintNeeded()), SLOT(syncBorders())); d->initTheming(); d->syncFrame(); }
Frame::Frame(QGraphicsWidget *parent) : QGraphicsWidget(parent), d(new FramePrivate(this)) { d->svg = new Plasma::FrameSvg(this); d->svg->setImagePath("widgets/frame"); d->svg->setElementPrefix("plain"); d->syncBorders(); connect(d->svg, SIGNAL(repaintNeeded()), SLOT(syncBorders())); d->initTheming(); }