diff --git a/bottombuttongroup.cpp b/bottombuttongroup.cpp index 370eff8..f2c3f98 100644 --- a/bottombuttongroup.cpp +++ b/bottombuttongroup.cpp @@ -21,6 +21,7 @@ BottomButtonGroup::BottomButtonGroup(QWidget *parent) "QPushButton {" "background-color:rgba(225,255,255,0);" "color: white;" + "border-style: none;" "}"); auto newBtn = [](QString text) -> QPushButton * { diff --git a/graphicsscene.cpp b/graphicsscene.cpp index 8f619f3..f64ac43 100644 --- a/graphicsscene.cpp +++ b/graphicsscene.cpp @@ -6,6 +6,8 @@ #include #include #include +#include +#include GraphicsScene::GraphicsScene(QObject *parent) : QGraphicsScene(parent) @@ -42,3 +44,16 @@ void GraphicsScene::showSvg(const QString &filepath) m_theThing = svgItem; this->setSceneRect(m_theThing->boundingRect()); } + +void GraphicsScene::showGif(const QString &filepath) +{ + this->clear(); + QMovie * movie = new QMovie(filepath); + QLabel * label = new QLabel; + label->setStyleSheet("background-color:white;"); + label->setMovie(movie); + this->addWidget(label); + movie->start(); + m_theThing = this->addRect(QRect(QPoint(0, 0), movie->scaledSize())); + this->setSceneRect(m_theThing->boundingRect()); +} diff --git a/graphicsscene.h b/graphicsscene.h index 1ffc632..7e24882 100644 --- a/graphicsscene.h +++ b/graphicsscene.h @@ -13,6 +13,7 @@ public: void showImage(const QPixmap &pixmap); void showText(const QString &text); void showSvg(const QString &filepath); + void showGif(const QString &filepath); private: QGraphicsItem * m_theThing; diff --git a/graphicsview.cpp b/graphicsview.cpp index 3810739..55bfb02 100644 --- a/graphicsview.cpp +++ b/graphicsview.cpp @@ -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(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(); diff --git a/graphicsview.h b/graphicsview.h index 4939b1b..e6d42f8 100644 --- a/graphicsview.h +++ b/graphicsview.h @@ -12,6 +12,7 @@ public: void showImage(const QPixmap &pixmap); void showText(const QString &text); void showSvg(const QString &filepath); + void showGif(const QString &filepath); GraphicsScene * scene() const; void setScene(GraphicsScene *scene);