Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Show a BMP image
Forum Updated to NodeBB v4.3 + New Features

Show a BMP image

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    enaud84
    wrote on last edited by
    #1

    Hi all,
    I'm making a program to display a bmp image after a video ends ..
    I wrote this code:
    @
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <Phonon/VideoPlayer>
    #include <Phonon/MediaObject>
    #include <Phonon/MediaSource>
    #include <QString>
    #include <QImageReader>
    #include <QImage>
    #include <QGraphicsScene>
    #include <QGraphicsView>
    #include <QGraphicsPixmapItem>
    #include <QLabel>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    Phonon::MediaObject *media = new Phonon::MediaObject(this);
    media->setCurrentSource(Phonon::MediaSource(QString("/home/user/Desktop/video.avi")));
    ui->videoPlayer->play(media->currentSource());
    

    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::changeEvent(QEvent *e)
    {
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
    ui->retranslateUi(this);
    break;
    default:
    break;
    }
    }

    void MainWindow::on_videoPlayer_finished()
    {
    ui->videoPlayer->close();
    QGraphicsScene scene;
    QGraphicsView view(&scene);
    QGraphicsPixmapItem item(QPixmap("/home/user/Desktop/mappa.bmp"));
    scene.addItem(&item);
    view.show();

    }

    @

    At finished i not view BMP image..

    You can help me, please?
    thanks at all

    1 Reply Last reply
    0
    • J Offline
      J Offline
      joonhwan
      wrote on last edited by
      #2

      You didn't position(and/or layout) your QGraphicsView in your central widget.
      But, it seems to me even if you do that, the design would look bad in this case.

      Though I did't have any experience with phonon videoplayer widget class, it should be able to show any simple image file to its display or at least you can derive your own videoplayer class from it, and override QWidget::paintEvent() to show your image whenever you want.

      joonhwan at gmail dot com

      1 Reply Last reply
      0
      • E Offline
        E Offline
        enaud84
        wrote on last edited by
        #3

        i've resolved thanks

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved