本文整理汇总了C++中QQuickItem::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickItem::setVisible方法的具体用法?C++ QQuickItem::setVisible怎么用?C++ QQuickItem::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQuickItem
的用法示例。
在下文中一共展示了QQuickItem::setVisible方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatePositionMarker
void Tracking::updatePositionMarker()
{
if ( m_marbleQuickItem && m_positionMarker && m_positionMarkerType == Circle ) {
Coordinate* position = 0;
bool visible = (m_marbleQuickItem->model()->planetId() == QLatin1String("earth"));
if ( m_positionSource && m_positionSource->hasPosition() ) {
position = m_positionSource->position();
} else if ( hasLastKnownPosition() ) {
position = lastKnownPosition();
} else {
visible = false;
}
qreal x(0), y(0);
if ( position ) {
Marble::GeoDataCoordinates const pos( position->longitude(), position->latitude(), 0.0, GeoDataCoordinates::Degree );
visible = visible && m_marbleQuickItem->map()->viewport()->screenCoordinates( pos.longitude(), pos.latitude(), x, y );
QQuickItem* item = qobject_cast<QQuickItem*>( m_positionMarker );
if ( item ) {
item->setVisible( visible );
if ( visible ) {
item->setX( x - item->width() / 2.0 );
item->setY( y - item->height() / 2.0 );
}
}
}
} else if ( m_positionMarkerType != Circle ) {
QQuickItem* item = qobject_cast<QQuickItem*>( m_positionMarker );
if ( item ) {
item->setVisible( false );
}
}
}
示例2: setVideoOnlyMode
void PlayerComponent::setVideoOnlyMode(bool enable)
{
if (m_window)
{
QQuickItem *web = m_window->findChild<QQuickItem *>("web");
if (web)
web->setVisible(!enable);
}
}
示例3: QQmlComponent
QQuickItem * DataSetView::createColumnHeader(int col)
{
//std::cout << "createColumnHeader("<<col<<") called!\n" << std::flush;
if(_columnHeaderDelegate == NULL)
{
_columnHeaderDelegate = new QQmlComponent(qmlEngine(this));
_columnHeaderDelegate->setData("import QtQuick 2.10\nItem {\n"
"property alias text: tekst.text\n"
"Rectangle { color: \"lightGrey\"; anchors.fill: parent }\n"
"Text { id: tekst; anchors.centerIn: parent }\n"
"}", QUrl());
}
QQuickItem * columnHeader = NULL;
if(_columnHeaderItems.count(col) == 0 || _columnHeaderItems[col] == NULL)
{
if(_columnHeaderStorage.size() > 0)
{
#ifdef DEBUG_VIEWPORT
std::cout << "createColumnHeader("<<col<<") from storage!\n" << std::flush;
#endif
columnHeader = _columnHeaderStorage.top();
_columnHeaderStorage.pop();
}
else
{
#ifdef DEBUG_VIEWPORT
std::cout << "createColumnHeader("<<col<<") ex nihilo!\n" << std::flush;
#endif
columnHeader = qobject_cast<QQuickItem*>(_columnHeaderDelegate->create());
columnHeader->setParent(this);
columnHeader->setParentItem(this);
}
columnHeader->setProperty("z", 10);
columnHeader->setProperty("text", _model->headerData(col, Qt::Orientation::Horizontal).toString());
columnHeader->setZ(-3);
columnHeader->setHeight(_dataRowsMaxHeight);
columnHeader->setWidth(_dataColsMaxWidth[col]);
columnHeader->setVisible(true);
_columnHeaderItems[col] = columnHeader;
}
else
columnHeader = _columnHeaderItems[col];
columnHeader->setX(_colXPositions[col]);
columnHeader->setY(_viewportY);
return columnHeader;
}
示例4: ind
QQuickItem * DataSetView::createTextItem(int row, int col)
{
//std::cout << "createTextItem("<<row<<", "<<col<<") called!\n" << std::flush;
if((_cellTextItems.count(col) == 0 && _cellTextItems[col].count(row) == 0) || _cellTextItems[col][row] == NULL)
{
if(_itemDelegate == NULL)
{
_itemDelegate = new QQmlComponent(qmlEngine(this));
_itemDelegate->setData("import QtQuick 2.10\nText { property bool active: true; text: \"???\"; color: active ? 'black' : 'grey' }", QUrl());
}
QQuickItem * textItem = NULL;
if(_textItemStorage.size() > 0)
{
#ifdef DEBUG_VIEWPORT
std::cout << "createTextItem("<<row<<", "<<col<<") from storage!\n" << std::flush;
#endif
textItem = _textItemStorage.top();
_textItemStorage.pop();
}
else
{
#ifdef DEBUG_VIEWPORT
std::cout << "createTextItem("<<row<<", "<<col<<") ex nihilo!\n" << std::flush;
#endif
textItem = qobject_cast<QQuickItem*>(_itemDelegate->create());
textItem->setParent(this);
textItem->setParentItem(this);
}
QModelIndex ind(_model->index(row, col));
bool active = _model->data(ind, _roleNameToRole["active"]).toBool();
textItem->setProperty("color", active ? "black" : "grey");
textItem->setProperty("text", _model->data(ind));
textItem->setX(_colXPositions[col] + _itemHorizontalPadding);
textItem->setY(-2 + _dataRowsMaxHeight + _itemVerticalPadding + row * _dataRowsMaxHeight);
textItem->setZ(-4);
textItem->setVisible(true);
_cellTextItems[col][row] = textItem;
}
return _cellTextItems[col][row];
}
示例5: storeColumnHeader
void DataSetView::storeColumnHeader(int col)
{
#ifdef DEBUG_VIEWPORT
std::cout << "storeColumnHeader("<<col<<") in storage!\n" << std::flush;
#endif
if(_columnHeaderItems.count(col) == 0 || _columnHeaderItems[col] == NULL) return;
QQuickItem * columnHeader = _columnHeaderItems[col];
_columnHeaderItems[col] = NULL;
_columnHeaderItems.erase(col);
columnHeader->setVisible(false);
_columnHeaderStorage.push(columnHeader);
}
示例6: storeRowNumber
void DataSetView::storeRowNumber(int row)
{
#ifdef DEBUG_VIEWPORT
std::cout << "storeRowNumber("<<row<<") in storage!\n" << std::flush;
#endif
if(_rowNumberItems.count(row) == 0 || _rowNumberItems[row] == NULL) return;
QQuickItem * rowNumber = _rowNumberItems[row];
_rowNumberItems[row] = NULL;
_rowNumberItems.erase(row);
rowNumber->setVisible(false);
_rowNumberStorage.push(rowNumber);
}
示例7: storeTextItem
void DataSetView::storeTextItem(int row, int col, bool cleanUp)
{
#ifdef DEBUG_VIEWPORT
std::cout << "storeTextItem("<<row<<", "<<col<<") in storage!\n" << std::flush;
#endif
if((_cellTextItems.count(col) == 0 && _cellTextItems[col].count(row) == 0) || _cellTextItems[col][row] == NULL) return;
QQuickItem * textItem = _cellTextItems[col][row];
_cellTextItems[col][row] = NULL;
if(cleanUp)
{
_cellTextItems[col].erase(row);
if(_cellTextItems[col].size() == 0)
_cellTextItems.erase(col);
}
textItem->setVisible(false);
_textItemStorage.push(textItem);
}
示例8: updateStats
void Stats::updateStats(bool force) {
QQuickItem* parent = parentItem();
if (!force) {
if (!Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
if (parent->isVisible()) {
parent->setVisible(false);
}
return;
} else if (!parent->isVisible()) {
parent->setVisible(true);
}
}
auto nodeList = DependencyManager::get<NodeList>();
auto avatarManager = DependencyManager::get<AvatarManager>();
// we need to take one avatar out so we don't include ourselves
STAT_UPDATE(avatarCount, avatarManager->size() - 1);
STAT_UPDATE(updatedAvatarCount, avatarManager->getNumAvatarsUpdated());
STAT_UPDATE(notUpdatedAvatarCount, avatarManager->getNumAvatarsNotUpdated());
STAT_UPDATE(serverCount, (int)nodeList->size());
STAT_UPDATE_FLOAT(renderrate, qApp->getRenderLoopRate(), 0.1f);
if (qApp->getActiveDisplayPlugin()) {
auto displayPlugin = qApp->getActiveDisplayPlugin();
auto stats = displayPlugin->getHardwareStats();
STAT_UPDATE(appdropped, stats["app_dropped_frame_count"].toInt());
STAT_UPDATE(longrenders, stats["long_render_count"].toInt());
STAT_UPDATE(longsubmits, stats["long_submit_count"].toInt());
STAT_UPDATE(longframes, stats["long_frame_count"].toInt());
STAT_UPDATE_FLOAT(presentrate, displayPlugin->presentRate(), 0.1f);
STAT_UPDATE_FLOAT(presentnewrate, displayPlugin->newFramePresentRate(), 0.1f);
STAT_UPDATE_FLOAT(presentdroprate, displayPlugin->droppedFrameRate(), 0.1f);
STAT_UPDATE_FLOAT(stutterrate, displayPlugin->stutterRate(), 0.1f);
} else {
STAT_UPDATE(appdropped, -1);
STAT_UPDATE(longrenders, -1);
STAT_UPDATE(longsubmits, -1);
STAT_UPDATE(presentrate, -1);
STAT_UPDATE(presentnewrate, -1);
STAT_UPDATE(presentdroprate, -1);
}
STAT_UPDATE(gameLoopRate, (int)qApp->getGameLoopRate());
auto bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
STAT_UPDATE(packetInCount, (int)bandwidthRecorder->getCachedTotalAverageInputPacketsPerSecond());
STAT_UPDATE(packetOutCount, (int)bandwidthRecorder->getCachedTotalAverageOutputPacketsPerSecond());
STAT_UPDATE_FLOAT(mbpsIn, (float)bandwidthRecorder->getCachedTotalAverageInputKilobitsPerSecond() / 1000.0f, 0.01f);
STAT_UPDATE_FLOAT(mbpsOut, (float)bandwidthRecorder->getCachedTotalAverageOutputKilobitsPerSecond() / 1000.0f, 0.01f);
STAT_UPDATE_FLOAT(assetMbpsIn, (float)bandwidthRecorder->getAverageInputKilobitsPerSecond(NodeType::AssetServer) / 1000.0f, 0.01f);
STAT_UPDATE_FLOAT(assetMbpsOut, (float)bandwidthRecorder->getAverageOutputKilobitsPerSecond(NodeType::AssetServer) / 1000.0f, 0.01f);
// Second column: ping
SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer);
SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NodeType::AvatarMixer);
SharedNodePointer assetServerNode = nodeList->soloNodeOfType(NodeType::AssetServer);
SharedNodePointer messageMixerNode = nodeList->soloNodeOfType(NodeType::MessagesMixer);
STAT_UPDATE(audioPing, audioMixerNode ? audioMixerNode->getPingMs() : -1);
const int mixerLossRate = (int)roundf(_audioStats->data()->getMixerStream()->lossRateWindow() * 100.0f);
const int clientLossRate = (int)roundf(_audioStats->data()->getClientStream()->lossRateWindow() * 100.0f);
const int largestLossRate = mixerLossRate > clientLossRate ? mixerLossRate : clientLossRate;
STAT_UPDATE(audioPacketLoss, audioMixerNode ? largestLossRate : -1);
STAT_UPDATE(avatarPing, avatarMixerNode ? avatarMixerNode->getPingMs() : -1);
STAT_UPDATE(assetPing, assetServerNode ? assetServerNode->getPingMs() : -1);
STAT_UPDATE(messagePing, messageMixerNode ? messageMixerNode->getPingMs() : -1);
//// Now handle entity servers, since there could be more than one, we average their ping times
int totalPingOctree = 0;
int octreeServerCount = 0;
int pingOctreeMax = 0;
int totalEntityKbps = 0;
nodeList->eachNode([&](const SharedNodePointer& node) {
// TODO: this should also support entities
if (node->getType() == NodeType::EntityServer) {
totalPingOctree += node->getPingMs();
totalEntityKbps += node->getInboundBandwidth();
octreeServerCount++;
if (pingOctreeMax < node->getPingMs()) {
pingOctreeMax = node->getPingMs();
}
}
});
// update the entities ping with the average for all connected entity servers
STAT_UPDATE(entitiesPing, octreeServerCount ? totalPingOctree / octreeServerCount : -1);
// Third column, avatar stats
auto myAvatar = avatarManager->getMyAvatar();
glm::vec3 avatarPos = myAvatar->getWorldPosition();
STAT_UPDATE(position, QVector3D(avatarPos.x, avatarPos.y, avatarPos.z));
STAT_UPDATE_FLOAT(speed, glm::length(myAvatar->getWorldVelocity()), 0.01f);
STAT_UPDATE_FLOAT(yaw, myAvatar->getBodyYaw(), 0.1f);
if (_expanded || force) {
SharedNodePointer avatarMixer = nodeList->soloNodeOfType(NodeType::AvatarMixer);
if (avatarMixer) {
STAT_UPDATE(avatarMixerInKbps, (int)roundf(bandwidthRecorder->getAverageInputKilobitsPerSecond(NodeType::AvatarMixer)));
STAT_UPDATE(avatarMixerInPps, (int)roundf(bandwidthRecorder->getAverageInputPacketsPerSecond(NodeType::AvatarMixer)));
STAT_UPDATE(avatarMixerOutKbps, (int)roundf(bandwidthRecorder->getAverageOutputKilobitsPerSecond(NodeType::AvatarMixer)));
STAT_UPDATE(avatarMixerOutPps, (int)roundf(bandwidthRecorder->getAverageOutputPacketsPerSecond(NodeType::AvatarMixer)));
} else {
STAT_UPDATE(avatarMixerInKbps, -1);
//.........这里部分代码省略.........
示例9: setZoomSliderVisible
void QmlProfilerTraceView::setZoomSliderVisible(bool visible)
{
QQuickItem *zoomSlider = d->m_mainView->rootObject()->findChild<QQuickItem*>(QLatin1String("zoomSliderToolBar"));
if (zoomSlider->isVisible() != visible)
zoomSlider->setVisible(visible);
}