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. [SOLVED] enum QMediaPlaylist::PlaybackMode does not work properly

[SOLVED] enum QMediaPlaylist::PlaybackMode does not work properly

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.8k Views
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello, I am trying to make an option for playlist to random choose songs...

    It works if I put it into main function...
    @MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow), ignoreSliderChanges(false)
    {
    ui->setupUi(this);

    playlist->setPlaybackMode(QMediaPlaylist::Loop);

    }@

    But it does not work if I place it in any other function (code below)... It show text in label but does not change playing state...
    @
    void testApp::playRandom()
    if (ui->pushButton->isChecked())
    {
    playlist->setPlaybackMode(QMediaPlaylist::Loop);
    ui->label->setText("Loop");
    }
    else
    {
    playlist->setPlaybackMode(QMediaPlaylist::CurrentItemOnce);
    ui->label->setText("Once");
    }

    }@

    Is this a bug or I am doing something wrong???

    Thanks in advance...

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Ahhh... I forgot to add ::PlaybackMode... Works now...

      @if (ui->pushButton->isChecked())
      {
      playlist->setPlaybackMode(QMediaPlaylist::PlaybackMode::Random);
      }
      else
      {
      playlist->setPlaybackMode(QMediaPlaylist::PlaybackMode::Loop);
      }
      @

      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