当前位置: 首页>>代码示例>>C++>>正文


C++ QScrollArea::setVisible方法代码示例

本文整理汇总了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"));
	}
开发者ID:cguebert,项目名称:SofaViewer,代码行数:7,代码来源:ListPropertyWidget.cpp

示例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);
}
开发者ID:techscientist,项目名称:client,代码行数:32,代码来源:shareusergroupwidget.cpp

示例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);
	}
开发者ID:cguebert,项目名称:SofaViewer,代码行数:42,代码来源:ListPropertyWidget.cpp

示例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);
}
开发者ID:bbxfork,项目名称:client,代码行数:37,代码来源:shareusergroupwidget.cpp


注:本文中的QScrollArea::setVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。