本文整理汇总了C++中QLayout::invalidate方法的典型用法代码示例。如果您正苦于以下问题:C++ QLayout::invalidate方法的具体用法?C++ QLayout::invalidate怎么用?C++ QLayout::invalidate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLayout
的用法示例。
在下文中一共展示了QLayout::invalidate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateTheme
void WindowPreview::updateTheme() {
QLayout *layout = this->layout();
m_background->clearCache();
// frame around preview:
qreal hoverLeft = 0, hoverTop = 0, hoverRight = 0, hoverBottom = 0;
qreal normalLeft = 0, normalTop = 0, normalRight = 0, normalBottom = 0;
m_background->setElementPrefix(HOVER);
m_background->getMargins(hoverLeft, hoverTop, hoverRight, hoverBottom);
m_background->setElementPrefix(NORMAL);
m_background->getMargins(normalLeft, normalTop, normalRight, normalBottom);
qreal left = qMax(normalLeft, hoverLeft);
qreal top = qMax(normalTop, hoverTop);
qreal right = qMax(normalRight, hoverRight);
qreal bottom = qMax(normalBottom, hoverBottom);
QSizeF normalSize(
normalLeft + m_previewSize.width() + normalRight,
normalTop + m_previewSize.height() + normalBottom);
m_background->setElementPrefix(HOVER);
// m_background->resizeFrame(QSizeF(
// hoverLeft + m_previewSize.width() + hoverRight,
// hoverTop + m_previewSize.height() + hoverBottom));
m_background->resizeFrame(normalSize);
m_background->setElementPrefix(NORMAL);
m_background->resizeFrame(normalSize);
// placeholder for preview:
if (m_previewSpace) {
m_previewSpace->changeSize(
left + m_previewSize.width() + right,
top + m_previewSize.height() + bottom,
QSizePolicy::Minimum,
QSizePolicy::Minimum);
m_previewSpace->invalidate();
}
layout->invalidate();
layout->activate();
update();
if (KWindowSystem::compositingActive()) {
if (m_toolTip->applet()->previewLayout() == Applet::NewPreviewLayout) {
m_taskNameLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum);
}
else {
m_taskNameLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
}
}
else {
m_taskNameLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
}
adjustSize();
}