本文整理汇总了C++中plasma::DataEngine::disconnectSource方法的典型用法代码示例。如果您正苦于以下问题:C++ DataEngine::disconnectSource方法的具体用法?C++ DataEngine::disconnectSource怎么用?C++ DataEngine::disconnectSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plasma::DataEngine
的用法示例。
在下文中一共展示了DataEngine::disconnectSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisconnectSource
void ControlWidget::DisconnectSource()
{
Plasma::DataEngine* engine = m_parent->getDataEngine();
if (engine && engine->isValid())
{
Logger::Log(DEBUG, "Disconnecting source %s", m_unit.address());
engine->disconnectSource(m_unit.address(), this);
}
}
示例2: connectToEngine
void Clock::connectToEngine()
{
resetLastTimeSeen();
Plasma::DataEngine* timeEngine = dataEngine("time");
timeEngine->disconnectSource(m_oldTimezone, this);
m_oldTimezone = currentTimezone();
if (m_showSecondHand) {
timeEngine->connectSource(currentTimezone(), this, 500);
} else {
timeEngine->connectSource(currentTimezone(), this, 6000, Plasma::AlignToMinute);
}
}
示例3: dataUpdated
void PoTD::dataUpdated(const QString &source, const Plasma::DataEngine::Data &data)
{
if (source == QLatin1String("Providers")) {
m_providers = data;
if (!m_provider.isEmpty() && !m_providers.contains(m_provider)) {
Plasma::DataEngine *engine = dataEngine(QLatin1String("potd"));
engine->disconnectSource(m_provider, this);
m_provider = DEFAULT_PROVIDER;
engine->connectSource(m_provider, this);
}
} else if (source == m_provider) {
QImage image = data["Image"].value<QImage>();
render(image, boundingRect().size().toSize(), MaxpectResize);
} else {
dataEngine(QLatin1String("potd"))->disconnectSource(source, this);
}
}
示例4: paint
void PoTD::paint(QPainter *painter, const QRectF& exposedRect)
{
if (m_image.isNull()) {
painter->fillRect(exposedRect, QBrush(Qt::black));
const QString provider = m_providers.isEmpty() || m_provider.isEmpty() ? QString()
: m_providers.value(m_provider).toString();
const QString text = provider.isEmpty() ? i18n("Loading the picture of the day...")
: i18n("Loading the picture of the day from %1...", provider);
QRect textRect = painter->fontMetrics().boundingRect(text);
textRect.moveCenter(boundingRect().center().toPoint());
painter->setPen(Qt::white);
painter->drawText(textRect.topLeft(), text);
} else {
if (m_image.size() != boundingRect().size().toSize()) {
Plasma::DataEngine *engine = dataEngine(QLatin1String("potd"));
// refresh the data which will trigger a re-render
engine->disconnectSource(m_provider, this);
engine->connectSource(m_provider, this);
}
painter->drawImage(exposedRect, m_image, exposedRect);
}
}