本文整理汇总了C++中QDockWidget::d_func方法的典型用法代码示例。如果您正苦于以下问题:C++ QDockWidget::d_func方法的具体用法?C++ QDockWidget::d_func怎么用?C++ QDockWidget::d_func使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDockWidget
的用法示例。
在下文中一共展示了QDockWidget::d_func方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeFromContent
QSize QDockWidgetLayout::sizeFromContent(const QSize &content, bool floating) const
{
QSize result = content;
if (verticalTitleBar) {
result.setHeight(qMax(result.height(), minimumTitleWidth()));
result.setWidth(qMax(content.width(), 0));
} else {
result.setHeight(qMax(result.height(), 0));
result.setWidth(qMax(content.width(), minimumTitleWidth()));
}
QDockWidget *w = qobject_cast<QDockWidget*>(parentWidget());
bool customTitleBar = item_list[TitleBar] != 0;
bool nativeDeco = floating && !customTitleBar;
#if defined(Q_WS_X11) || defined(Q_WS_QWS)
nativeDeco = false;
#endif
int fw = floating && !nativeDeco
? w->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, 0)
: 0;
const int th = titleHeight();
if (!nativeDeco) {
if (verticalTitleBar)
result += QSize(th + 2*fw, 2*fw);
else
result += QSize(2*fw, th + 2*fw);
}
result.setHeight(qMin(result.height(), (int) QWIDGETSIZE_MAX));
result.setWidth(qMin(result.width(), (int) QWIDGETSIZE_MAX));
if (content.width() < 0)
result.setWidth(-1);
if (content.height() < 0)
result.setHeight(-1);
QSize min = w->minimumSize();
/* A floating dockwidget will automatically get its minimumSize set to the layout's
minimum size + deco. We're *not* interested in this, we only take minimumSize()
into account if the user set it herself. Otherwise we end up expanding the result
of a calculation for a non-floating dock widget to a floating dock widget's
minimum size + window decorations. */
uint explicitMin = 0;
if (w->d_func()->extra != 0)
explicitMin = w->d_func()->extra->explicitMinSize;
if (!(explicitMin & Qt::Horizontal) || min.width() == 0)
min.setWidth(-1);
if (!(explicitMin & Qt::Vertical) || min.height() == 0)
min.setHeight(-1);
return result.boundedTo(w->maximumSize()).expandedTo(min);
}
示例2: sizeFromContent
QSize QDockWidgetLayout::sizeFromContent(const QSize &content, bool floating) const
{
QSize result = content;
if (verticalTitleBar) {
result.setHeight(qMax(result.height(), minimumTitleWidth()));
result.setWidth(qMax(content.width(), 0));
} else {
result.setHeight(qMax(result.height(), 0));
result.setWidth(qMax(content.width(), minimumTitleWidth()));
}
QDockWidget *w = qobject_cast<QDockWidget*>(parentWidget());
const bool nativeDeco = nativeWindowDeco(floating);
int fw = floating && !nativeDeco
? w->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, w)
: 0;
const int th = titleHeight();
if (!nativeDeco) {
if (verticalTitleBar)
result += QSize(th + 2*fw, 2*fw);
else
result += QSize(2*fw, th + 2*fw);
}
result.setHeight(qMin(result.height(), (int) QWIDGETSIZE_MAX));
result.setWidth(qMin(result.width(), (int) QWIDGETSIZE_MAX));
if (content.width() < 0)
result.setWidth(-1);
if (content.height() < 0)
result.setHeight(-1);
int left, top, right, bottom;
w->getContentsMargins(&left, &top, &right, &bottom);
//we need to substract the contents margin (it will be added by the caller)
QSize min = w->minimumSize() - QSize(left + right, top + bottom);
QSize max = w->maximumSize() - QSize(left + right, top + bottom);
/* A floating dockwidget will automatically get its minimumSize set to the layout's
minimum size + deco. We're *not* interested in this, we only take minimumSize()
into account if the user set it herself. Otherwise we end up expanding the result
of a calculation for a non-floating dock widget to a floating dock widget's
minimum size + window decorations. */
uint explicitMin = 0;
uint explicitMax = 0;
if (w->d_func()->extra != 0) {
explicitMin = w->d_func()->extra->explicitMinSize;
explicitMax = w->d_func()->extra->explicitMaxSize;
}
if (!(explicitMin & Qt::Horizontal) || min.width() == 0)
min.setWidth(-1);
if (!(explicitMin & Qt::Vertical) || min.height() == 0)
min.setHeight(-1);
if (!(explicitMax & Qt::Horizontal))
max.setWidth(QWIDGETSIZE_MAX);
if (!(explicitMax & Qt::Vertical))
max.setHeight(QWIDGETSIZE_MAX);
return result.boundedTo(max).expandedTo(min);
}