代码拉取完成,页面将自动刷新
同步操作将从 openKylin/ukui-clipboard 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "data.h"
ContentMenu::ContentMenu(ContentType contentType, const QString &itemName, QObject *parent)
: m_contentType(contentType), m_itemName(itemName), QObject(parent) {
switch (contentType) {
case ContentType::PlainText:
m_iconName = "ukui-idtext-symbolic";
break;
case ContentType::RichText:
m_iconName = "ukui-idtext-symbolic";
break;
case ContentType::Image:
m_iconName = "image-x-generic-symbolic";
break;
case ContentType::Original:
m_iconName = "";
break;
default:
m_iconName = "";
break;
}
}
ContentMenu::ContentMenu(const ContentMenu &rhs)
{
m_contentType = rhs.contentType();
m_itemName = rhs.itemName();
}
ContentMenu &ContentMenu::operator=(const ContentMenu &rhs)
{
m_contentType = rhs.contentType();
m_itemName = rhs.itemName();
return *this;
}
InMemoryImageProvider::InMemoryImageProvider()
: QQuickImageProvider(QQuickImageProvider::Image)
{
}
QImage InMemoryImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
{
QImage image;
if (m_images.find(id) == m_images.end()) {
*size = QSize(0, 0);
return image;
}
int width = m_images[id].width();
int height = m_images[id].height();
if(size) {
*size = QSize(width, height);
}
image = m_images[id].scaled(requestedSize.width() > 0 ? requestedSize.width() : width, requestedSize.height() > 0 ? requestedSize.height() : height
, Qt::KeepAspectRatio, Qt::SmoothTransformation);
return image;
}
QList<QImage> InMemoryImageProvider::requestAllImage()
{
qDebug()<<"requestAllImage"<<m_images.values();
return m_images.values();
}
void InMemoryImageProvider::addImage(const QImage &image)
{
QString id = "Image" + QString::number(m_imageId);
m_imageId++;
m_images[id] = image;
}
void InMemoryImageProvider::clear()
{
m_images.clear();
m_imageId = 0;
}
int InMemoryImageProvider::imageNumber() const
{
return m_images.size();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。