本文整理汇总了C++中QScrollArea::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollArea::setVisible方法的具体用法?C++ QScrollArea::setVisible怎么用?C++ QScrollArea::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollArea
的用法示例。
在下文中一共展示了QScrollArea::setVisible方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toggleView
void toggleView(bool show)
{
if (show && !m_formLayout)
resize(-1);
m_scrollArea->setVisible(show);
m_toggleButton->setText(show ? QPushButton::tr("hide") : QPushButton::tr("show"));
}
示例2: slotSharesFetched
void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
{
QScrollArea *scrollArea = _ui->scrollArea;
auto newViewPort = new QWidget(scrollArea);
auto layout = new QVBoxLayout(newViewPort);
QSize minimumSize = newViewPort->sizeHint();
int x = 0;
foreach(const auto &share, shares) {
// We don't handle link shares
if (share->getShareType() == Share::TypeLink) {
continue;
}
ShareWidget *s = new ShareWidget(share, _ui->scrollArea);
layout->addWidget(s);
x++;
if (x <= 3) {
minimumSize = newViewPort->sizeHint();
}
}
minimumSize.rwidth() += layout->spacing();
minimumSize.rheight() += layout->spacing();
scrollArea->setMinimumSize(minimumSize);
scrollArea->setVisible(!shares.isEmpty());
scrollArea->setWidget(newViewPort);
}
示例3: resize
void resize(int nb)
{
if (nb == -1)
nb = list_traits::size(m_value);
int prevNb = m_propertyWidgets.size();
if (m_formLayout && nb == prevNb)
return; // No need to recreate the same widgets
bool visible = m_scrollArea->isVisible();
m_scrollArea->setVisible(false);
m_propertyWidgets.clear();
list_traits::resize(m_value, nb);
auto scrollAreaWidget = new QWidget;
m_formLayout = new QFormLayout;
m_formLayout->setContentsMargins(3, 3, 3, 3);
auto name = m_property->name();
const auto& metaProperties = m_propertyValue->metaContainer().properties();
for (int i = 0; i < nb; ++i)
{
auto& value = list_traits::value(m_value, i);
auto prop = property::createRefProperty(name, value);
auto propValue = prop->value<base_type>();
auto& metaContainer = propValue->metaContainer();
for (auto& metaProp : metaProperties)
metaContainer.addExisting(metaProp);
std::shared_ptr<BasePropertyWidget> propWidget = m_widgetCreator->create(prop, scrollAreaWidget);
propWidget->setParent(m_parent);
m_propertyWidgets.push_back(propWidget);
m_formLayout->addRow(QString::number(i), propWidget->createWidgets());
}
scrollAreaWidget->setLayout(m_formLayout);
m_scrollArea->setWidget(scrollAreaWidget);
if (visible)
m_scrollArea->setVisible(true);
}
示例4: slotSharesFetched
void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
{
QScrollArea *scrollArea = _ui->scrollArea;
auto newViewPort = new QWidget(scrollArea);
auto layout = new QVBoxLayout(newViewPort);
QSize minimumSize = newViewPort->sizeHint();
int x = 0;
foreach(const auto &share, shares) {
// We don't handle link shares
if (share->getShareType() == Share::TypeLink) {
continue;
}
ShareWidget *s = new ShareWidget(share, _isFile, _ui->scrollArea);
connect(s, SIGNAL(resizeRequested()), this, SLOT(slotAdjustScrollWidgetSize()));
layout->addWidget(s);
x++;
if (x <= 3) {
minimumSize = newViewPort->sizeHint();
} else {
minimumSize.rwidth() = qMax(newViewPort->sizeHint().width(), minimumSize.width());
}
}
minimumSize.rwidth() += layout->spacing();
minimumSize.rheight() += layout->spacing();
scrollArea->setMinimumSize(minimumSize);
scrollArea->setVisible(!shares.isEmpty());
scrollArea->setWidget(newViewPort);
_disableCompleterActivated = false;
_ui->shareeLineEdit->setEnabled(true);
}