void QQTScene::dropEvent(QGraphicsSceneDragDropEvent *event)
{
const QMimeData *mimeData
= event
->mimeData
();
if(text == tr("文本"))
{
item = new QQTText(text);
}
else if(text == tr("图åƒ"))
{
fileName
= QFileDialog::getOpenFileName(0, tr
("打开图片"),
"",
tr("Image Files (*.png *.jpg *.bmp)"));
if(!fileName.isEmpty()){
item = new QQTImage(pixmap);
QRectF r
= item
->boundingRect
();
if(r.width() > 800)
{
item->scale(0.5, 0.5);
}
//connect(qgraphicsitem_cast<QQTImage *>(item), SIGNAL(resize()), this, SLOT(resize()));
/* 修改当å‰å·¥ä½œç›®å½•ï¼Œä½¿ä¸‹æ¬¡æ‰“开图片的时候å¯ä»¥å‡å°‘é‡æ–°é€‰æ‹©ç›®å½•çš„æ“作 */
}
else
{
event->setDropAction(Qt::IgnoreAction);
return;
}
}
item->setPos(event->scenePos());
addItem(item);
event->setDropAction(Qt::CopyAction);
event->accept();
}
void QQTScene::dropEvent(QGraphicsSceneDragDropEvent *event)
{
const QMimeData *mimeData = event->mimeData();
QString text = mimeData->text();
QGraphicsItem *item;
if(text == tr("文本"))
{
item = new QQTText(text);
connect(qgraphicsitem_cast<QQTText *>(item), SIGNAL(selectedChange(QGraphicsItem*)), this, SIGNAL(itemSelected(QGraphicsItem*)));
}
else if(text == tr("图åƒ"))
{
QString fileName;
fileName = QFileDialog::getOpenFileName(0, tr("打开图片"), "",
tr("Image Files (*.png *.jpg *.bmp)"));
if(!fileName.isEmpty()){
QPixmap pixmap(fileName);
item = new QQTImage(pixmap);
QRectF r = item->boundingRect();
if(r.width() > 800)
{
item->scale(0.5, 0.5);
}
//connect(qgraphicsitem_cast<QQTImage *>(item), SIGNAL(resize()), this, SLOT(resize()));
/* 修改当å‰å·¥ä½œç›®å½•ï¼Œä½¿ä¸‹æ¬¡æ‰“开图片的时候å¯ä»¥å‡å°‘é‡æ–°é€‰æ‹©ç›®å½•çš„æ“作 */
QDir::setCurrent(QFileInfo(fileName).absolutePath());
}
else
{
event->setDropAction(Qt::IgnoreAction);
return;
}
}
item->setPos(event->scenePos());
addItem(item);
event->setDropAction(Qt::CopyAction);
event->accept();
}
To copy to clipboard, switch view to plain text mode
It crashes at
fileName
= QFileDialog::getOpenFileName(0, tr
("打开图片"),
"",
tr("Image Files (*.png *.jpg *.bmp)"));
fileName = QFileDialog::getOpenFileName(0, tr("打开图片"), "",
tr("Image Files (*.png *.jpg *.bmp)"));
To copy to clipboard, switch view to plain text mode
I debug it to find that it crashes in system function
void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
int const_alpha)
void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
int const_alpha)
To copy to clipboard, switch view to plain text mode
at line
BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, w, nullVector, half, one, colorMask, alphaMask);
BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, w, nullVector, half, one, colorMask, alphaMask);
To copy to clipboard, switch view to plain text mode
Bookmarks