Don't crash. Thanks to gallium for pointing this out.

svn path=/trunk/kdebase/kwin/; revision=97773
icc-effect-5.14.5
Rik Hemsley 2001-05-19 01:58:07 +00:00
parent 8b5d812a5f
commit 8a597cc22e
1 changed files with 18 additions and 24 deletions

View File

@ -70,17 +70,13 @@ extern "C"
}
Web::Web(Workspace * ws, WId w, bool tool, QWidget * parent, const char * name)
: Client(ws, w, parent, name, WResizeNoErase),
tool_(tool),
mainLayout_(0),
titleSpacer_(0)
: Client (ws, w, parent, name, WResizeNoErase),
tool_ (tool),
mainLayout_ (0),
titleSpacer_ (0)
{
setBackgroundMode(NoBackground);
KConfig c(locate("config", "kwinwebrc"));
c.setGroup("General");
shape_ = c.readBoolEntry("Shape", true);
_resetLayout();
leftButtonList_ .setAutoDelete(true);
@ -166,7 +162,9 @@ Web::paintEvent(QPaintEvent * pe)
}
p.setFont(options->font(isActive(), tool_));
p.setPen(options->color(Options::Font, isActive()));
p.drawText(titleSpacer_->geometry(), AlignCenter, caption());
}
@ -420,6 +418,10 @@ Web::_createButtons()
void
Web::_resetLayout()
{
KConfig c(locate("config", "kwinwebrc"));
c.setGroup("General");
shape_ = c.readBoolEntry("Shape", true);
// ____________________________________
// | | | |
// |Xo| titleSpacer |v^| <--- topLayout
@ -444,26 +446,18 @@ Web::_resetLayout()
if (0 != titleHeight % 2)
titleHeight += 1;
if (0 == titleSpacer_)
{
titleSpacer_ =
new QSpacerItem
(
0,
titleHeight,
QSizePolicy::Expanding,
QSizePolicy::Fixed
);
}
delete mainLayout_;
mainLayout_ = 0;
// -------------------------------------------------------------------
mainLayout_ = new QVBoxLayout(this, 0, 0);
// -------------------------------------------------------------------
titleSpacer_ =
new QSpacerItem
(
0,
titleHeight,
QSizePolicy::Expanding,
QSizePolicy::Fixed
);
QHBoxLayout * topLayout = new QHBoxLayout(mainLayout_, 0, 0);