Skip to content
QtWS25 Last Chance
  • 0 Votes
    4 Posts
    463 Views
    SGaistS
    The trick of the mouse to rotate is that the rendering is rotated independently from the item itself. As for the movement, unless I am mistaken, it's always moving "horizontally" with respect to the item rotation rotation. Much like when you are walking, you are going forward, when you rotate you still go forward but with a different angle than before.
  • 0 Votes
    14 Posts
    2k Views
    projectbavariaP
    @SGaist okey i will try
  • 0 Votes
    4 Posts
    763 Views
    SGaistS
    What would be nice is to have a minimal compilable example that shows that behaviour.
  • 0 Votes
    16 Posts
    6k Views
    K
    I got the answer . MainWindow.cpp is like that ui->listWidget->setFlow(QListView::LeftToRight); ui->listWidget->setMinimumSize(1050,800); ui->listWidget->setGridSize(QSize(340, 320)); ui->listWidget->setResizeMode(QListView::Adjust); ui->listWidget->setViewMode(QListView::ListMode); ui->listWidget->setWrapping(true); QDir directory = QFileDialog::getExistingDirectory(this, tr("Open Directory"),"/home", QFileDialog::ShowDirsOnly| QFileDialog::DontResolveSymlinks); directory.setNameFilters({"*.mp4" , "*.avi" , "*.flv" , "*.mwv"}); for(const QFileInfo & finfo: directory.entryInfoList()){ QMediaPlayer *mediaPlayer = new QMediaPlayer(); mediaPlayer->setMedia(QUrl::fromLocalFile(finfo.absoluteFilePath())); videoItem = new QGraphicsVideoItem; videoItem->setSize(QSize(300,240)); QGraphicsScene *scene = new QGraphicsScene(this); QGraphicsView *graphicsView = new QGraphicsView(scene); mediaPlayer->setVideoOutput(videoItem); QPushButton *m_playButton = new QPushButton(); m_playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); connect(m_playButton, &QAbstractButton::clicked, [mediaPlayer]() { switch (mediaPlayer->state()) { case QMediaPlayer::PlayingState: mediaPlayer->pause(); break; default: mediaPlayer->play(); break; } }); connect(mediaPlayer, &QMediaPlayer::stateChanged, [m_playButton, this](QMediaPlayer::State state) { switch(state) { case QMediaPlayer::PlayingState: m_playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause)); break; default: m_playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); break; } }); QSlider *m_positionSlider = new QSlider(Qt::Horizontal,this); m_positionSlider->setRange(0,mediaPlayer->duration() / 1000); connect(mediaPlayer, &QMediaPlayer::positionChanged ,[m_positionSlider, this](qint64 position){ m_positionSlider->setValue(position); }); connect(mediaPlayer, &QMediaPlayer::durationChanged ,[m_positionSlider, this](qint64 duration){ m_positionSlider->setRange(0,duration); }); connect(m_positionSlider ,&QAbstractSlider::sliderMoved, [mediaPlayer ,this] (int position){ mediaPlayer->setPosition(position); }); auto item = new QListWidgetItem("", ui->listWidget); auto widget = new QWidget; auto label = new QLabel(finfo.fileName()); auto vb = new QVBoxLayout; QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); controlLayout->addWidget(m_playButton); controlLayout->addWidget(m_positionSlider); vb->addWidget(label); vb->addWidget(graphicsView); vb->addLayout(controlLayout); widget->setLayout(vb); widget->setMinimumSize(320, 320); ui->listWidget->setItemWidget(item,widget); player.append(mediaPlayer); scene->addItem(videoItem); }
  • 0 Votes
    4 Posts
    1k Views
    mrjjM
    Hi I was wondering if you could use QRectF QGraphicsProxyWidget::subWidgetRect(const QWidget * widget) const
  • 0 Votes
    1 Posts
    444 Views
    No one has replied
  • 0 Votes
    2 Posts
    2k Views
    SGaistS
    Hi and welcome to devnet, Did you put your widgets in layouts ? You might also be interested by QGraphicsView::fitInView.
  • Draw on a QChart

    Unsolved General and Desktop charts graphics view draw
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    3 Posts
    2k Views
    SGaistS
    Hi and welcome to devnet, Since your widgett is called PixmapView then in your CanvaTest class you can use ui->PixmapView ..