recalculate all the margin sizes when the plasma theme changes
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=772465
This commit is contained in:
parent
5f0afdd61c
commit
2f6a8de658
19
dialog.cpp
19
dialog.cpp
@ -35,6 +35,7 @@
|
|||||||
#include <NETRootInfo>
|
#include <NETRootInfo>
|
||||||
|
|
||||||
#include <plasma/svgpanel.h>
|
#include <plasma/svgpanel.h>
|
||||||
|
#include <plasma/theme.h>
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
@ -62,17 +63,23 @@ Dialog::Dialog( QWidget * parent, Qt::WindowFlags f )
|
|||||||
d->background->setBorderFlags(SvgPanel::DrawAllBorders);
|
d->background->setBorderFlags(SvgPanel::DrawAllBorders);
|
||||||
d->background->resize(size());
|
d->background->resize(size());
|
||||||
|
|
||||||
|
connect(d->background, SIGNAL(repaintNeeded()), this, SLOT(update()));
|
||||||
|
|
||||||
|
connect(Plasma::Theme::self(), SIGNAL(changed()), this, SLOT(themeUpdated()));
|
||||||
|
themeUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
Dialog::~Dialog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::themeUpdated()
|
||||||
|
{
|
||||||
const int topHeight = d->background->marginSize(Plasma::TopMargin);
|
const int topHeight = d->background->marginSize(Plasma::TopMargin);
|
||||||
const int leftWidth = d->background->marginSize(Plasma::LeftMargin);
|
const int leftWidth = d->background->marginSize(Plasma::LeftMargin);
|
||||||
const int rightWidth = d->background->marginSize(Plasma::RightMargin);
|
const int rightWidth = d->background->marginSize(Plasma::RightMargin);
|
||||||
const int bottomHeight = d->background->marginSize(Plasma::BottomMargin);
|
const int bottomHeight = d->background->marginSize(Plasma::BottomMargin);
|
||||||
setContentsMargins(leftWidth, topHeight, rightWidth, bottomHeight);
|
setContentsMargins(leftWidth, topHeight, rightWidth, bottomHeight);
|
||||||
|
|
||||||
connect(d->background, SIGNAL(repaintNeeded()), this, SLOT(update()));
|
|
||||||
}
|
|
||||||
|
|
||||||
Dialog::~Dialog()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog::paintEvent(QPaintEvent *e)
|
void Dialog::paintEvent(QPaintEvent *e)
|
||||||
|
6
dialog.h
6
dialog.h
@ -75,6 +75,12 @@ class PLASMA_EXPORT Dialog : public QWidget
|
|||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
/**
|
||||||
|
* React to theme changes
|
||||||
|
*/
|
||||||
|
void themeUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Private;
|
class Private;
|
||||||
Private * const d;
|
Private * const d;
|
||||||
|
@ -195,11 +195,6 @@ ToolTip::ToolTip()
|
|||||||
|
|
||||||
d->background = new SvgPanel("widgets/tooltip", this);
|
d->background = new SvgPanel("widgets/tooltip", this);
|
||||||
d->background->setBorderFlags(SvgPanel::DrawAllBorders);
|
d->background->setBorderFlags(SvgPanel::DrawAllBorders);
|
||||||
const int topHeight = d->background->marginSize(Plasma::TopMargin);
|
|
||||||
const int leftWidth = d->background->marginSize(Plasma::LeftMargin);
|
|
||||||
const int rightWidth = d->background->marginSize(Plasma::RightMargin);
|
|
||||||
const int bottomHeight = d->background->marginSize(Plasma::BottomMargin);
|
|
||||||
setContentsMargins(leftWidth, topHeight, rightWidth, bottomHeight);
|
|
||||||
|
|
||||||
connect(d->background, SIGNAL(repaintNeeded()), this, SLOT(update()));
|
connect(d->background, SIGNAL(repaintNeeded()), this, SLOT(update()));
|
||||||
|
|
||||||
@ -216,8 +211,8 @@ ToolTip::ToolTip()
|
|||||||
connect(d->showTimer, SIGNAL(timeout()), SLOT(showToolTip()));
|
connect(d->showTimer, SIGNAL(timeout()), SLOT(showToolTip()));
|
||||||
connect(d->hideTimer, SIGNAL(timeout()), SLOT(resetShownState()));
|
connect(d->hideTimer, SIGNAL(timeout()), SLOT(resetShownState()));
|
||||||
|
|
||||||
connect(Plasma::Theme::self(), SIGNAL(changed()), this, SLOT(resetPalette()));
|
connect(Plasma::Theme::self(), SIGNAL(changed()), this, SLOT(themeUpdated()));
|
||||||
resetPalette();
|
themeUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTip::~ToolTip()
|
ToolTip::~ToolTip()
|
||||||
@ -242,8 +237,14 @@ void ToolTip::setData(const Plasma::ToolTipData &data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTip::resetPalette()
|
void ToolTip::themeUpdated()
|
||||||
{
|
{
|
||||||
|
const int topHeight = d->background->marginSize(Plasma::TopMargin);
|
||||||
|
const int leftWidth = d->background->marginSize(Plasma::LeftMargin);
|
||||||
|
const int rightWidth = d->background->marginSize(Plasma::RightMargin);
|
||||||
|
const int bottomHeight = d->background->marginSize(Plasma::BottomMargin);
|
||||||
|
setContentsMargins(leftWidth, topHeight, rightWidth, bottomHeight);
|
||||||
|
|
||||||
// Make the tooltip use Plasma's colorscheme
|
// Make the tooltip use Plasma's colorscheme
|
||||||
QPalette plasmaPalette = QPalette();
|
QPalette plasmaPalette = QPalette();
|
||||||
plasmaPalette.setColor(QPalette::Window, Plasma::Theme::self()->backgroundColor());
|
plasmaPalette.setColor(QPalette::Window, Plasma::Theme::self()->backgroundColor());
|
||||||
|
@ -60,7 +60,7 @@ protected:
|
|||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void resetShownState();
|
void resetShownState();
|
||||||
void showToolTip();
|
void showToolTip();
|
||||||
void resetPalette();
|
void themeUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setData(const Plasma::ToolTipData &data);
|
void setData(const Plasma::ToolTipData &data);
|
||||||
|
Loading…
Reference in New Issue
Block a user