本文整理汇总了C++中dataSource函数的典型用法代码示例。如果您正苦于以下问题:C++ dataSource函数的具体用法?C++ dataSource怎么用?C++ dataSource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dataSource函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: columnInfo
void KexiDBImageBox::updateActionStrings()
{
if (!m_contextMenu)
return;
if (designMode()) {
/* QString titleString( i18n("Image Box") );
if (!dataSource().isEmpty())
titleString.prepend(dataSource() + " : ");
m_contextMenu->changeTitle(m_contextMenu->idAt(0), m_contextMenu->titlePixmap(m_contextMenu->idAt(0)), titleString);*/
} else {
//update title in data view mode, based on the data source
if (columnInfo()) {
KexiImageContextMenu::updateTitle(m_contextMenu, columnInfo()->captionOrAliasOrName(),
KexiFormManager::self()->library()->iconName(metaObject()->className()));
}
}
if (m_chooser) {
if (popupMenuAvailable() && dataSource().isEmpty()) { //this may work in the future (see @todo below)
m_chooser->setToolTip(i18n("Click to show actions for this image box"));
} else {
QString beautifiedImageBoxName;
if (designMode()) {
beautifiedImageBoxName = dataSource();
} else {
beautifiedImageBoxName = columnInfo() ? columnInfo()->captionOrAliasOrName() : QString();
/*! @todo look at makeFirstCharacterUpperCaseInCaptions setting [bool]
(see doc/dev/settings.txt) */
beautifiedImageBoxName = beautifiedImageBoxName[0].toUpper() + beautifiedImageBoxName.mid(1);
}
m_chooser->setToolTip(
i18n("Click to show actions for \"%1\" image box", beautifiedImageBoxName));
}
}
}
示例2: pm
void KexiDBImageBox::handlePasteAction()
{
if (isReadOnly() || (!designMode() && !hasFocus()))
return;
QPixmap pm(qApp->clipboard()->pixmap(QClipboard::Clipboard));
if (dataSource().isEmpty()) {
//static mode
KexiBLOBBuffer::Handle h = KexiBLOBBuffer::self()->insertPixmap(pm);
if (!h)
return;
setData(h);
} else {
//db-aware mode
m_pixmap = pm;
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(IO_WriteOnly);
if (m_pixmap.save(&buffer, "PNG")) { // write pixmap into ba in PNG format
setValueInternal(ba, true, false/* !loadPixmap */);
m_currentScaledPixmap = QPixmap(); // clear cache
} else {
setValueInternal(QByteArray(), true);
}
}
repaint();
if (!dataSource().isEmpty()) {
// emit pixmapChanged();
signalValueChanged();
}
}
示例3: dataSource
bool DataMatrix::isValid() const {
if (dataSource()) {
dataSource()->readLock();
bool fieldValid = dataSource()->matrix().isValid(_field);
dataSource()->unlock();
return fieldValid;
}
return false;
}
示例4: dataSource
/** return true if it has a valid file and field, or false otherwise */
bool VScalar::isValid() const {
if (dataSource()) {
dataSource()->readLock();
bool rc = dataSource()->vector().isValid(_field);
dataSource()->unlock();
return rc;
}
return false;
}
示例5: Q_ASSERT
void DataMatrix::reload() {
Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);
if (dataSource()) {
dataSource()->writeLock();
dataSource()->reset();
dataSource()->unlock();
reset();
}
}
示例6: dataSource
void KexiDBImageBox::slotUpdateActionsAvailabilityRequested(bool& valueIsNull, bool& valueIsReadOnly)
{
valueIsNull = !(
(dataSource().isEmpty() && !pixmap().isNull()) /*static pixmap available*/
|| (!dataSource().isEmpty() && !this->valueIsNull()) /*db-aware pixmap available*/
);
// read-only if static pixmap or db-aware pixmap for read-only widget:
valueIsReadOnly =
(!designMode() && dataSource().isEmpty())
|| (!dataSource().isEmpty() && isReadOnly())
|| (designMode() && !dataSource().isEmpty());
}
示例7: dataSource
QVariant StudentsModel::data(const QModelIndex &index, int role) const
{
if (role == Qt::DisplayRole)
if (source){
if (source->open(QIODevice::ReadOnly)){
Student st;
QDataStream dataSource(source);
source->seek(index.row()*sizeof(Student));
dataSource.readRawData(reinterpret_cast<char *>(&st), sizeof(Student));
source->close();
// если файл заполнялся с консоли
// понадобится смена кодировки
QTextCodec *codec = QTextCodec::codecForName("IBM866");
switch(index.column()){
case Student::Name:
return codec->toUnicode(QByteArray(st.name));
case Student::Course:
return QString::number(st.cource);
case Student::Group:
return QString::number(st.group);
default:
return QVariant();
}
}
}
return QVariant();
}
示例8: handleCutAction
void KexiDBImageBox::handleCutAction()
{
if (!dataSource().isEmpty() && isReadOnly())
return;
handleCopyAction();
clear();
}
示例9: dataSource
bool SingleLayerPluginContent::init()
{
CCDictionary* dataSource(NetworkState::sharedInstance()->getSubDictionary(SL_SERIALIZEKEY_PLUGIN_GLOBAL_SETTINGS));
// plugin information
dataSource->setObject(CCString::create(
"sample of a single layer implementation"
),SL_SERIALIZEKEY_PLUGIN_INFO_BRIEF);
dataSource->setObject(CCString::create(
"Nothing special\n"
),SL_SERIALIZEKEY_PLUGIN_INFO_DETAIL);
// task information
dataSource->setObject(CCString::create(
"Nothing special\n"
),SL_SERIALIZEKEY_PLUGIN_TASKS);
dataSource->setObject(CCString::create(
"Nothing special\n"
),SL_SERIALIZEKEY_PLUGIN_TASK_HINTS);
return SLBaseClass::init();
}
示例10: setData
void KexiDBImageBox::setDataSource(const QString &ds)
{
KexiFormDataItemInterface::setDataSource(ds);
setData(KexiBLOBBuffer::Handle());
updateActionStrings();
KexiFrame::setFocusPolicy(focusPolicy()); //set modified policy
if (m_chooser) {
m_chooser->setEnabled(popupMenuAvailable());
if (m_dropDownButtonVisible && popupMenuAvailable()) {
m_chooser->show();
} else {
m_chooser->hide();
}
}
// update some properties not changed by user
// //! @todo get default line width from global style settings
// if (!m_lineWidthChanged) {
// KexiFrame::setLineWidth(ds.isEmpty() ? 0 : 1);
// }
if (!m_paletteBackgroundColorChanged && parentWidget()) {
KexiFrame::setPaletteBackgroundColor(
dataSource().isEmpty() ? parentWidget()->paletteBackgroundColor() : palette().active().base());
}
}
示例11: Q_FOREACH
void QgsProjectBadLayerHandler::handleBadLayers( const QList<QDomNode> &layers )
{
QgsApplication::messageLog()->logMessage( QObject::tr( "%1 bad layers dismissed:" ).arg( layers.size() ) );
Q_FOREACH ( const QDomNode &layer, layers )
{
QgsApplication::messageLog()->logMessage( QObject::tr( " * %1" ).arg( dataSource( layer ) ) );
}
示例12: isTristateInternal
bool KexiDBCheckBox::isTristateInternal() const
{
if (m_tristate == TristateDefault)
return !dataSource().isEmpty();
return m_tristate == TristateOn;
}
示例13: error
void QgsAmsLegendFetcher::handleFinished()
{
// Parse result
QJson::Parser parser;
bool ok = false;
QVariantMap queryResults = parser.parse( mQueryReply, &ok ).toMap();
if ( !ok )
{
emit error( QString( "Parsing error at line %1: %2" ).arg( parser.errorLine() ).arg( parser.errorString() ) );
}
QgsDataSourceURI dataSource( mProvider->dataSourceUri() );
QList< QPair<QString, QImage> > legendEntries;
foreach ( const QVariant& result, queryResults["layers"].toList() )
{
QVariantMap queryResultMap = result.toMap();
QString layerId = queryResultMap["layerId"].toString();
if ( layerId != dataSource.param( "layer" ) && !mProvider->subLayers().contains( layerId ) )
{
continue;
}
QVariantList legendSymbols = queryResultMap["legend"].toList();
foreach ( const QVariant& legendEntry, legendSymbols )
{
QVariantMap legendEntryMap = legendEntry.toMap();
QString label = legendEntryMap["label"].toString();
if ( label.isEmpty() && legendSymbols.size() == 1 )
label = queryResultMap["layerName"].toString();
QByteArray imageData = QByteArray::fromBase64( legendEntryMap["imageData"].toByteArray() );
legendEntries.append( qMakePair( label, QImage::fromData( imageData ) ) );
}
}
示例14: QgsRasterDataProvider
QgsAmsProvider::QgsAmsProvider( const QString &uri, const ProviderOptions &options )
: QgsRasterDataProvider( uri, options )
{
mLegendFetcher = new QgsAmsLegendFetcher( this );
QgsDataSourceUri dataSource( dataSourceUri() );
const QString authcfg = dataSource.authConfigId();
mServiceInfo = QgsArcGisRestUtils::getServiceInfo( dataSource.param( QStringLiteral( "url" ) ), authcfg, mErrorTitle, mError );
mLayerInfo = QgsArcGisRestUtils::getLayerInfo( dataSource.param( QStringLiteral( "url" ) ) + "/" + dataSource.param( QStringLiteral( "layer" ) ), authcfg, mErrorTitle, mError );
const QVariantMap extentData = mLayerInfo.value( QStringLiteral( "extent" ) ).toMap();
mExtent.setXMinimum( extentData[QStringLiteral( "xmin" )].toDouble() );
mExtent.setYMinimum( extentData[QStringLiteral( "ymin" )].toDouble() );
mExtent.setXMaximum( extentData[QStringLiteral( "xmax" )].toDouble() );
mExtent.setYMaximum( extentData[QStringLiteral( "ymax" )].toDouble() );
mCrs = QgsArcGisRestUtils::parseSpatialReference( extentData[QStringLiteral( "spatialReference" )].toMap() );
if ( !mCrs.isValid() )
{
appendError( QgsErrorMessage( tr( "Could not parse spatial reference" ), QStringLiteral( "AMSProvider" ) ) );
return;
}
const QVariantList subLayersList = mLayerInfo.value( QStringLiteral( "subLayers" ) ).toList();
mSubLayers.reserve( subLayersList.size() );
for ( const QVariant &sublayer : subLayersList )
{
mSubLayers.append( sublayer.toMap()[QStringLiteral( "id" )].toString() );
mSubLayerVisibilities.append( true );
}
mTimestamp = QDateTime::currentDateTime();
mValid = true;
}
示例15: popupMenuAvailable
bool KexiDBImageBox::popupMenuAvailable()
{
/*! @todo add kexi-global setting which anyway, allows to show this button
(read-only actions like copy/save as/print can be available) */
//chooser button can be only visible when data source is specified
return !dataSource().isEmpty();
}