本文整理汇总了C++中QWidgetList::constEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidgetList::constEnd方法的具体用法?C++ QWidgetList::constEnd怎么用?C++ QWidgetList::constEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWidgetList
的用法示例。
在下文中一共展示了QWidgetList::constEnd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyBuddy
bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode, QLabel *label)
{
if (buddyName.isEmpty()) {
label->setBuddy(0);
return false;
}
const QWidgetList widgets = qFindChildren<QWidget*>(label->topLevelWidget(), buddyName);
if (widgets.empty()) {
label->setBuddy(0);
return false;
}
const QWidgetList::const_iterator cend = widgets.constEnd();
for ( QWidgetList::const_iterator it = widgets.constBegin(); it != cend; ++it) {
if (applyMode == BuddyApplyAll || !(*it)->isHidden()) {
label->setBuddy(*it);
return true;
}
}
label->setBuddy(0);
return false;
}
示例2: getFeatures
int QgsGml::getFeatures( const QString &uri, QgsWkbTypes::Type *wkbType, QgsRectangle *extent, const QString &userName, const QString &password, const QString &authcfg )
{
//start with empty extent
mExtent.setMinimal();
QNetworkRequest request( uri );
if ( !authcfg.isEmpty() )
{
if ( !QgsApplication::authManager()->updateNetworkRequest( request, authcfg ) )
{
QgsMessageLog::logMessage(
tr( "GML Getfeature network request update failed for authcfg %1" ).arg( authcfg ),
tr( "Network" ),
Qgis::Critical
);
return 1;
}
}
else if ( !userName.isNull() || !password.isNull() )
{
request.setRawHeader( "Authorization", "Basic " + QStringLiteral( "%1:%2" ).arg( userName, password ).toLatin1().toBase64() );
}
QNetworkReply *reply = QgsNetworkAccessManager::instance()->get( request );
if ( !authcfg.isEmpty() )
{
if ( !QgsApplication::authManager()->updateNetworkReply( reply, authcfg ) )
{
reply->deleteLater();
QgsMessageLog::logMessage(
tr( "GML Getfeature network reply update failed for authcfg %1" ).arg( authcfg ),
tr( "Network" ),
Qgis::Critical
);
return 1;
}
}
connect( reply, &QNetworkReply::finished, this, &QgsGml::setFinished );
connect( reply, &QNetworkReply::downloadProgress, this, &QgsGml::handleProgressEvent );
//find out if there is a QGIS main window. If yes, display a progress dialog
QProgressDialog *progressDialog = nullptr;
QWidget *mainWindow = nullptr;
QWidgetList topLevelWidgets = qApp->topLevelWidgets();
for ( QWidgetList::const_iterator it = topLevelWidgets.constBegin(); it != topLevelWidgets.constEnd(); ++it )
{
if ( ( *it )->objectName() == QLatin1String( "QgisApp" ) )
{
mainWindow = *it;
break;
}
}
if ( mainWindow )
{
progressDialog = new QProgressDialog( tr( "Loading GML data\n%1" ).arg( mTypeName ), tr( "Abort" ), 0, 0, mainWindow );
progressDialog->setWindowModality( Qt::ApplicationModal );
connect( this, &QgsGml::dataReadProgress, progressDialog, &QProgressDialog::setValue );
connect( this, &QgsGml::totalStepsUpdate, progressDialog, &QProgressDialog::setMaximum );
connect( progressDialog, &QProgressDialog::canceled, this, &QgsGml::setFinished );
progressDialog->show();
}
int atEnd = 0;
while ( !atEnd )
{
if ( mFinished )
{
atEnd = 1;
}
QByteArray readData = reply->readAll();
if ( !readData.isEmpty() )
{
QString errorMsg;
if ( !mParser.processData( readData, atEnd, errorMsg ) )
QgsMessageLog::logMessage( errorMsg, QObject::tr( "WFS" ) );
}
QCoreApplication::processEvents();
}
fillMapsFromParser();
QNetworkReply::NetworkError replyError = reply->error();
QString replyErrorString = reply->errorString();
delete reply;
delete progressDialog;
if ( replyError )
{
QgsMessageLog::logMessage(
tr( "GML Getfeature network request failed with error: %1" ).arg( replyErrorString ),
tr( "Network" ),
Qgis::Critical
);
return 1;
}
*wkbType = mParser.wkbType();
//.........这里部分代码省略.........
示例3: getFeatures
int QgsGml::getFeatures( const QString& uri, QGis::WkbType* wkbType, QgsRectangle* extent, const QString& userName, const QString& password , const QString& authcfg )
{
mUri = uri;
mWkbType = wkbType;
XML_Parser p = XML_ParserCreateNS( nullptr, NS_SEPARATOR );
XML_SetUserData( p, this );
XML_SetElementHandler( p, QgsGml::start, QgsGml::end );
XML_SetCharacterDataHandler( p, QgsGml::chars );
//start with empty extent
mExtent.setMinimal();
QNetworkRequest request( mUri );
if ( !authcfg.isEmpty() )
{
if ( !QgsAuthManager::instance()->updateNetworkRequest( request, authcfg ) )
{
QgsMessageLog::logMessage(
tr( "GML Getfeature network request update failed for authcfg %1" ).arg( authcfg ),
tr( "Network" ),
QgsMessageLog::CRITICAL
);
return 1;
}
}
else if ( !userName.isNull() || !password.isNull() )
{
request.setRawHeader( "Authorization", "Basic " + QString( "%1:%2" ).arg( userName, password ).toAscii().toBase64() );
}
QNetworkReply* reply = QgsNetworkAccessManager::instance()->get( request );
connect( reply, SIGNAL( finished() ), this, SLOT( setFinished() ) );
connect( reply, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( handleProgressEvent( qint64, qint64 ) ) );
//find out if there is a QGIS main window. If yes, display a progress dialog
QProgressDialog* progressDialog = nullptr;
QWidget* mainWindow = nullptr;
QWidgetList topLevelWidgets = qApp->topLevelWidgets();
for ( QWidgetList::const_iterator it = topLevelWidgets.constBegin(); it != topLevelWidgets.constEnd(); ++it )
{
if (( *it )->objectName() == "QgisApp" )
{
mainWindow = *it;
break;
}
}
if ( mainWindow )
{
progressDialog = new QProgressDialog( tr( "Loading GML data\n%1" ).arg( mTypeName ), tr( "Abort" ), 0, 0, mainWindow );
progressDialog->setWindowModality( Qt::ApplicationModal );
connect( this, SIGNAL( dataReadProgress( int ) ), progressDialog, SLOT( setValue( int ) ) );
connect( this, SIGNAL( totalStepsUpdate( int ) ), progressDialog, SLOT( setMaximum( int ) ) );
connect( progressDialog, SIGNAL( canceled() ), this, SLOT( setFinished() ) );
progressDialog->show();
}
int atEnd = 0;
while ( !atEnd )
{
if ( mFinished )
{
atEnd = 1;
}
QByteArray readData = reply->readAll();
if ( !readData.isEmpty() )
{
if ( XML_Parse( p, readData.constData(), readData.size(), atEnd ) == 0 )
{
XML_Error errorCode = XML_GetErrorCode( p );
QString errorString = tr( "Error: %1 on line %2, column %3" )
.arg( XML_ErrorString( errorCode ) )
.arg( XML_GetCurrentLineNumber( p ) )
.arg( XML_GetCurrentColumnNumber( p ) );
QgsMessageLog::logMessage( errorString, tr( "WFS" ) );
}
}
QCoreApplication::processEvents();
}
QNetworkReply::NetworkError replyError = reply->error();
QString replyErrorString = reply->errorString();
delete reply;
delete progressDialog;
if ( replyError )
{
QgsMessageLog::logMessage(
tr( "GML Getfeature network request failed with error: %1" ).arg( replyErrorString ),
tr( "Network" ),
QgsMessageLog::CRITICAL
);
return 1;
}
if ( *mWkbType != QGis::WKBNoGeometry )
{
if ( mExtent.isEmpty() )
{
//.........这里部分代码省略.........