本文整理汇总了C++中QWeakPointer::data方法的典型用法代码示例。如果您正苦于以下问题:C++ QWeakPointer::data方法的具体用法?C++ QWeakPointer::data怎么用?C++ QWeakPointer::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWeakPointer
的用法示例。
在下文中一共展示了QWeakPointer::data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
// The access function for guarded QObject pointers.
static void *qpointer_access_func(sipSimpleWrapper *w, AccessFuncOp op)
{
#if QT_VERSION >= 0x040500
QWeakPointer<QObject> *guard = reinterpret_cast<QWeakPointer<QObject> *>(w->data);
#else
QObjectGuard *guard = reinterpret_cast<QObjectGuard *>(w->data);
#endif
void *addr;
switch (op)
{
case UnguardedPointer:
#if QT_VERSION >= 0x040500
addr = guard->data();
#else
addr = guard->unguarded;
#endif
break;
case GuardedPointer:
#if QT_VERSION >= 0x040500
addr = guard->isNull() ? 0 : guard->data();
#else
addr = (QObject *)guard->guarded;
#endif
break;
case ReleaseGuard:
delete guard;
addr = 0;
break;
}
return addr;
}
示例2: buttonClicked
void LocationEditor::buttonClicked() {
const QWeakPointer<LocationDialog> dialogPtr(new LocationDialog(this));
if (LocationDialog *const dialog = dialogPtr.data()) {
dialog->setLongitude(this->startLongitude);
dialog->setLatitude(this->startLatitude);
dialog->setAltitude(this->startAltitude);
dialog->exec();
}
if (LocationDialog *const dialog = dialogPtr.data()) {
const double lon = dialog->getLongitude();
const double lat = dialog->getLatitude();
const double alt = dialog->getAltitude();
startAltitude = alt;
startLongitude = lon;
startLatitude = lat;
if (dialog->okPressed()) {
NoteTable ntable(global.db);
if (lon == 0.0 && lat == 0.0) {
setText(defaultText);
ntable.resetGeography(currentLid, true);
} else {
setText(dialog->locationText());
ntable.setGeography(currentLid, lon,lat,alt, true);
}
}
delete dialog;
}
}
示例3: sender
void
MetaQueryWidget::populateComboBox( QStringList results )
{
QObject* query = sender();
if( !query )
return;
QWeakPointer<KComboBox> combo = m_runningQueries.value(query);
if( combo.isNull() )
return;
// note: adding items seems to reset the edit text, so we have
// to take care of that.
disconnect( combo.data(), 0, this, 0 );
// want the results unique and sorted
const QSet<QString> dataSet = results.toSet();
QStringList dataList = dataSet.toList();
dataList.sort();
combo.data()->addItems( dataList );
KCompletion* comp = combo.data()->completionObject();
comp->setItems( dataList );
// reset the text and re-enable the signal
combo.data()->setEditText( m_filter.value );
connect( combo.data(), SIGNAL(editTextChanged( const QString& ) ),
SLOT(valueChanged(const QString&)) );
}
示例4: addBrowseView
void Workspace::addBrowseView(QString cubename) {
/* Close the last browse window if necessary. */
if (subWindowList().size()) {
QWeakPointer<QMdiSubWindow> windowToRemove =
subWindowList()[subWindowList().size() - 1];
removeSubWindow(windowToRemove.data());
delete windowToRemove.data();
}
addCubeViewport(cubename);
}
示例5:
static QObject *createInstance()
{
static QWeakPointer<QObject> instance;
if (!instance)
instance = QWeakPointer<QObject>(new qutim_sdk_0_3::ScriptExtensionPlugin);
return instance.data();
}
示例6: onHeadersComplete
int onHeadersComplete(http_parser *parser)
{
TcpSocket *socket = static_cast<TcpSocket*>(parser->data);
#ifndef NO_LOG
sLog(LogEndpoint::LogLevel::DEBUG) << " === parsed header ====";
const QHash<QString, QSharedPointer<QString>> &headers = socket->getHeader().getHeaderInfo();
QHash<QString, QSharedPointer<QString>>::const_iterator i = headers.constBegin();
while (i != headers.constEnd())
{
sLog(LogEndpoint::LogLevel::DEBUG) << i.key() << *(i.value().data());
++i;
}
sLog(LogEndpoint::LogLevel::DEBUG) << " === ============= ====";
sLogFlush();
#endif
QWeakPointer<QString> host = socket->getHeader().getHeaderInfo("Host");
if (!host.isNull())
{
socket->getHeader().setHost(*host.data());
}
return 0;
}
示例7: updateCompositingScrollPosition
void QGraphicsWebViewPrivate::updateCompositingScrollPosition()
{
if (rootGraphicsLayer && q->page() && q->page()->mainFrame()) {
const QPoint scrollPosition = q->page()->mainFrame()->scrollPosition();
rootGraphicsLayer.data()->setPos(-scrollPosition);
}
}
示例8:
QNetworkAccessManager*
nam()
{
if ( s_nam.isNull() )
return 0;
return s_nam.data();
}
示例9: saveReport
//static
void DrKonqi::saveReport(const QString & reportText, QWidget *parent)
{
if (KCmdLineArgs::parsedArgs()->isSet("safer")) {
KTemporaryFile tf;
tf.setSuffix(".kcrash.txt");
tf.setAutoRemove(false);
if (tf.open()) {
QTextStream textStream(&tf);
textStream << reportText;
textStream.flush();
KMessageBox::information(parent, i18nc("@info",
"Report saved to <filename>%1</filename>.",
tf.fileName()));
} else {
KMessageBox::sorry(parent, i18nc("@info","Could not create a file in which to save the report."));
}
} else {
QString defname = getSuggestedKCrashFilename(crashedApplication());
QWeakPointer<KFileDialog> dlg = new KFileDialog(defname, QString(), parent);
dlg.data()->setSelection(defname);
dlg.data()->setCaption(i18nc("@title:window","Select Filename"));
dlg.data()->setOperationMode(KFileDialog::Saving);
dlg.data()->setMode(KFile::File);
dlg.data()->setConfirmOverwrite(true);
dlg.data()->exec();
if (dlg.isNull()) {
//Dialog is invalid, it was probably deleted (ex. via DBus call)
//return and do not crash
return;
}
KUrl fileUrl = dlg.data()->selectedUrl();
delete dlg.data();
if (fileUrl.isValid()) {
KTemporaryFile tf;
if (tf.open()) {
QTextStream ts(&tf);
ts << reportText;
ts.flush();
} else {
KMessageBox::sorry(parent, i18nc("@info","Cannot open file <filename>%1</filename> "
"for writing.", tf.fileName()));
return;
}
if (!KIO::NetAccess::upload(tf.fileName(), fileUrl, parent)) {
KMessageBox::sorry(parent, KIO::NetAccess::lastErrorString());
}
}
}
}
示例10: qDebug
void
setProxy( QNetworkProxy* proxy )
{
s_proxy = proxy;
s_nam.data()->setProxy( *proxy );
qDebug() << Q_FUNC_INFO << "setting proxy to use proxy DNS?" << (TomahawkSettings::instance()->proxyDns() ? "true" : "false");
if ( !TomahawkSettings::instance()->proxyDns() )
s_proxy->setCapabilities( QNetworkProxy::TunnelingCapability | QNetworkProxy::ListeningCapability | QNetworkProxy::UdpTunnelingCapability );
}
示例11: setRootGraphicsLayer
void QGraphicsWebViewPrivate::setRootGraphicsLayer(QGraphicsItem* layer)
{
if (rootGraphicsLayer) {
rootGraphicsLayer.data()->setParentItem(0);
q->scene()->removeItem(rootGraphicsLayer.data());
QWebFramePrivate::core(q->page()->mainFrame())->view()->syncCompositingStateRecursive();
}
rootGraphicsLayer = layer ? layer->toGraphicsObject() : 0;
if (layer) {
layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
layer->setParentItem(q);
layer->setZValue(RootGraphicsLayerZValue);
updateCompositingScrollPosition();
}
createOrDeleteOverlay();
}
示例12: enableHeader
/**
* \brief Initialization
*
* Initializes the TabsApplet with default parameters
*/
void
TabsApplet::init()
{
// applet base initialization
Context::Applet::init();
// create the header label
enableHeader( true );
setHeaderText( i18nc( "Guitar tablature", "Tabs" ) );
// creates the tab view
m_tabsView = new TabsView( this );
// Set the collapse size
setCollapseOffHeight( -1 );
setCollapseHeight( m_header->height() );
setMinimumHeight( collapseHeight() );
setPreferredHeight( collapseHeight() );
// create the reload icon
QAction* reloadAction = new QAction( this );
reloadAction->setIcon( KIcon( "view-refresh" ) );
reloadAction->setVisible( true );
reloadAction->setEnabled( true );
reloadAction->setText( i18nc( "Guitar tablature", "Reload tabs" ) );
m_reloadIcon = addLeftHeaderAction( reloadAction );
m_reloadIcon.data()->setEnabled( false );
connect( m_reloadIcon.data(), SIGNAL(clicked()), this, SLOT(reloadTabs()) );
// create the settings icon
QAction* settingsAction = new QAction( this );
settingsAction->setIcon( KIcon( "preferences-system" ) );
settingsAction->setEnabled( true );
settingsAction->setText( i18n( "Settings" ) );
QWeakPointer<Plasma::IconWidget> settingsIcon = addRightHeaderAction( settingsAction );
connect( settingsIcon.data(), SIGNAL(clicked()), this, SLOT(showConfigurationInterface()) );
m_layout = new QGraphicsLinearLayout( Qt::Vertical );
m_layout->addItem( m_header );
m_layout->addItem( m_tabsView );
setLayout( m_layout );
// read configuration data and update the engine.
KConfigGroup config = Amarok::config("Tabs Applet");
m_fetchGuitar = config.readEntry( "FetchGuitar", true );
m_fetchBass = config.readEntry( "FetchBass", true );
Plasma::DataEngine *engine = dataEngine( "amarok-tabs" );
engine->setProperty( "fetchGuitarTabs", m_fetchGuitar );
engine->setProperty( "fetchBassTabs", m_fetchBass );
engine->connectSource( "tabs", this );
updateInterface( InitState );
}
示例13: addModel
void addModel(QAbstractItemModel *model, ViewType viewtype, Kickoff::MenuView::ModelOptions options = Kickoff::MenuView::MergeFirstLevel, int formattype = -1)
{
Kickoff::MenuView* mainView = menuview.data();
Kickoff::MenuView* m = mainView;
if (viewtypes.count() > 1 || !m) {
m = new Kickoff::MenuView(mainView, viewText(viewtype), KIcon(viewIcon(viewtype)));
m->setFormatType((formattype >= 0 || !mainView) ? (Kickoff::MenuView::FormatType)formattype : mainView->formatType());
mainView->addMenu(m);
}
m->addModel(model, options);
}
示例14: items
tSidebarPageTroll::tSidebarPageTroll(
const QWeakPointer<tMercuryStyle>& xStyle,
const QWeakPointer<tMercurySettings>& xSettings,
const QWeakPointer<tMercuryDataManager>& xDataManager,
QGraphicsItem* pParent)
: Base(xStyle, xSettings, pParent)
, m_xDataManager(xDataManager)
, m_pStatus(0)
, m_pIndicator(0)
, m_pButton(0)
, m_pUp(0)
, m_pDown(0)
, m_CurrentRPM(0)
, m_TimeoutTicks(0)
, m_TrollAllowed(true)
, m_RotaryFocus(false)
{
tSidebarPage::ItemsCollection items(this);
tSidebarControlTitle* objTitle = new tSidebarControlTitle(xStyle.data(),
tr("VESSEL CONTROL", "Mercury Vessel Control section heading"),
tr("TROLL", "Mercury Troll Control page title"),
tSidebarControlTitle::eModeBack);
Connect(objTitle, SIGNAL(Triggered()), this, SIGNAL(Back()));
items
.Add(objTitle, 1.f, Qt::AlignAbsolute)
.Add(m_pUp = new tSidebarControlSpinButton(xStyle.data(), tSidebarControlSpinButton::eDirectionUp),
1.5f, Qt::AlignAbsolute)
.Add(m_pIndicator = new tSidebarControlIndicator(
xStyle.data(), "", "", "", tSidebarControlIndicator::eModeNormal, true),
-1.f, Qt::AlignAbsolute)
.Add(m_pDown = new tSidebarControlSpinButton(xStyle.data(), tSidebarControlSpinButton::eDirectionDown),
1.5f, Qt::AlignAbsolute)
.Add(m_pStatus = new tSidebarStaticText(xStyle.data(), ""), 0.5f, Qt::AlignAbsolute)
.Add(m_pButton = new tSidebarControlButtonToggle(xStyle.data(), tr("Enable"), tr("Disable")),
1.f, Qt::AlignBottom)
.End();
Connect(m_pUp, SIGNAL(Triggered()), this, SLOT(OnUpClicked()));
Connect(m_pDown, SIGNAL(Triggered()), this, SLOT(OnDownClicked()));
Connect(m_pButton, SIGNAL(Triggered()), this, SLOT(OnEnableClicked()));
Connect(m_pIndicator, SIGNAL(Triggered()), this, SLOT(OnIndicatorTouched()));
if( !m_xDataManager.isNull() )
{
tMercuryCommand* command = m_xDataManager.data()->MercuryCommand();
if( command != 0 )
{
m_CurrentRPM = static_cast<int>(command->TrollRpmSetpoint());
UpdateStatus(command->IsTrollActive());
SetTrollAllowed(command->IsTrollAllowed());
Connect(command, SIGNAL(TrollEngaged(int)), this, SLOT(StatusEnable()));
Connect(command, SIGNAL(TrollDisengaged(int)), this, SLOT(StatusDisable()));
Connect(command, SIGNAL(TrollActiveDetected()), this, SLOT(StatusEnable()));
Connect(command, SIGNAL(TrollInactiveDetected()), this, SLOT(StatusDisable()));
Connect(command, SIGNAL(TrollAllowedChanged(bool)), this, SLOT(SetTrollAllowed(bool)));
}
示例15: switch
// The access function for guarded QObject pointers.
static void *qpointer_access_func(sipSimpleWrapper *w, AccessFuncOp op)
{
QWeakPointer<QObject> *guard = reinterpret_cast<QWeakPointer<QObject> *>(w->data);
void *addr;
switch (op)
{
case UnguardedPointer:
addr = guard->data();
break;
case GuardedPointer:
addr = guard->isNull() ? 0 : guard->data();
break;
case ReleaseGuard:
delete guard;
addr = 0;
break;
}
return addr;
}