1
0
This commit is contained in:
Gary Wang
2019-09-30 13:11:43 +08:00
parent d106d9beee
commit 89c21bc90b
5 changed files with 25 additions and 0 deletions

View File

@@ -40,6 +40,11 @@ void GraphicsView::showSvg(const QString &filepath)
scene()->showSvg(filepath);
}
void GraphicsView::showGif(const QString &filepath)
{
scene()->showGif(filepath);
}
GraphicsScene *GraphicsView::scene() const
{
return qobject_cast<GraphicsScene*>(QGraphicsView::scene());
@@ -138,6 +143,8 @@ void GraphicsView::dropEvent(QDropEvent *event)
if (filePath.endsWith(".svg")) {
showSvg(filePath);
} else if (filePath.endsWith(".gif")) {
showGif(filePath);
} else {
QImageReader imageReader(filePath);
QImage::Format imageFormat = imageReader.imageFormat();