use the shared style on slider
dinamically resize controls widget of videoplayer depending on the player size svn path=/trunk/KDE/kdelibs/; revision=962181
This commit is contained in:
parent
7de98d0048
commit
540090a1b7
@ -29,6 +29,8 @@
|
||||
#include "theme.h"
|
||||
#include "framesvg.h"
|
||||
|
||||
#include "private/style_p.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
@ -45,6 +47,7 @@ public:
|
||||
|
||||
Plasma::FrameSvg *background;
|
||||
Plasma::FrameSvg *handle;
|
||||
Plasma::Style::Ptr style;
|
||||
};
|
||||
|
||||
Slider::Slider(QGraphicsWidget *parent)
|
||||
@ -66,11 +69,15 @@ Slider::Slider(QGraphicsWidget *parent)
|
||||
d->handle = new Plasma::FrameSvg(this);
|
||||
d->handle->setImagePath("widgets/button");
|
||||
d->handle->setElementPrefix("normal");
|
||||
|
||||
d->style = Plasma::Style::sharedStyle();
|
||||
native->setStyle(d->style.data());
|
||||
}
|
||||
|
||||
Slider::~Slider()
|
||||
{
|
||||
delete d;
|
||||
Plasma::Style::doneWithSharedStyle();
|
||||
}
|
||||
|
||||
void Slider::paint(QPainter *painter,
|
||||
|
@ -521,7 +521,23 @@ void VideoWidget::resizeEvent(QGraphicsSceneResizeEvent *event)
|
||||
QGraphicsProxyWidget::resizeEvent(event);
|
||||
|
||||
if (d->controlsWidget) {
|
||||
d->controlsWidget->resize(event->newSize().width(), d->controlsWidget->size().height());
|
||||
QSize newControlsSize(event->newSize().width(), d->controlsWidget->size().height());
|
||||
int newHeight = event->newSize().height();
|
||||
qreal leftMargin, topMargin, rightMargin, bottomMargin;
|
||||
d->controlsWidget->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin);
|
||||
|
||||
if (newHeight/5 >= KIconLoader::SizeEnormous) {
|
||||
newControlsSize.setHeight(KIconLoader::SizeEnormous+topMargin+bottomMargin);
|
||||
} else if (newHeight/5 >= KIconLoader::SizeHuge) {
|
||||
newControlsSize.setHeight(KIconLoader::SizeHuge+topMargin+bottomMargin);
|
||||
} else if (newHeight/5 >= KIconLoader::SizeLarge) {
|
||||
newControlsSize.setHeight(KIconLoader::SizeLarge+topMargin+bottomMargin);
|
||||
} else if (newHeight/5 >= KIconLoader::SizeMedium) {
|
||||
newControlsSize.setHeight(KIconLoader::SizeMedium+topMargin+bottomMargin);
|
||||
} else {
|
||||
newControlsSize.setHeight(KIconLoader::SizeSmallMedium+topMargin+bottomMargin);
|
||||
}
|
||||
d->controlsWidget->resize(newControlsSize);
|
||||
|
||||
if (d->spaceForControlsAvailable()) {
|
||||
d->animateControlWidget(false);
|
||||
|
Loading…
Reference in New Issue
Block a user