Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Slider
Qt 6.11 is out! See what's new in the release blog

Slider

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
8 Posts 2 Posters 1.4k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean connect the MediaPlayer::position property or the Video::position property to the Slider::value property ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

        media player position property where we use media player and video output, i have displayed video and did all the things, i want to know how to move slider as video progresses, could u help ?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Did you already read the Property Binding chapter of Qt's documentation ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          ? 1 Reply Last reply
          0
          • SGaistS SGaist

            Did you already read the Property Binding chapter of Qt's documentation ?

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            @SGaist i read, but i am not getting idea how to do it

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Can you show the QML code you are using ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                Qml code:

                Window
                {
                visible: true
                width: 640
                height: 480
                title: qsTr("Hello World")

                Slider
                {
                    id: slid
                    x: 26
                    y: 118
                    width: 585
                    height: 32
                    from:0
                    to:100
                    stepSize: 1     // here can we give 100ms check for that.
                }
                
                Rectangle
                {
                    id: start
                    x: 217
                    y: 269
                    width: 71
                    height: 45
                    border.color: "black"
                
                    Text
                    {
                        id: starttxt
                        text: qsTr("Start")
                        anchors.centerIn: parent
                    }
                
                    MouseArea
                    {
                        anchors.fill: parent
                        onClicked:
                        {
                            bhushanuser.checkbutton(1)
                        }
                    }
                
                }
                
                Rectangle
                {
                    id: stop
                    x: 360
                    y: 269
                    width: 71
                    height: 45
                    border.color: "black"
                
                    Text
                    {
                        id: stoptxt
                        text: qsTr("stop")
                        anchors.centerIn: parent
                    }
                
                    MouseArea
                    {
                        anchors.fill: parent
                        onClicked:
                        {
                            bhushanuser.checkbutton(0)
                        }
                    }
                
                }
                
                Connections
                {
                  target: bhushanuser
                  onPlay:
                  {
                   slid.increase()
                  }
                
                  onPause:
                  {
                   slid.decrease()
                  }
                }
                

                }

                main.cpp:-

                #include <QGuiApplication>
                #include <QQmlApplicationEngine>
                #include <QQmlContext>
                #include <QQmlEngine>
                #include "slider.h"

                int main(int argc, char *argv[])
                {
                QGuiApplication app(argc, argv);

                slider *user = new slider;
                
                QQmlApplicationEngine engine;
                QQmlContext *context = engine.rootContext();
                context->setContextProperty("bhushanuser",user);
                
                engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
                if (engine.rootObjects().isEmpty())
                    return -1;
                
                return app.exec();
                

                }

                slider.cpp

                #include "slider.h"
                #include <QDebug>

                slider::slider(QObject *parent) : QObject(parent)
                {

                }

                void slider::checkbutton(int playpause)
                {
                if(playpause==1)
                {
                emit play();
                }

                if(playpause==0)
                {
                    emit pause();
                }
                

                }

                slider.h

                #ifndef SLIDER_H
                #define SLIDER_H

                #include <QObject>

                class slider : public QObject
                {
                Q_OBJECT
                public:
                explicit slider(QObject *parent = nullptr);

                signals:
                void play();
                void pause();
                public slots:
                void checkbutton(int playpause);
                };

                #endif // SLIDER_H

                As of know, i am doing this thing that after clicking on start button slider will move, i want it to move continue, until i dont pressed stop button.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  You now have an answer in your other thread on almost the same subject.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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