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. Flickable in qt
Forum Updated to NodeBB v4.3 + New Features

Flickable in qt

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 5.2k 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.
  • P Offline
    P Offline
    pragati
    wrote on last edited by
    #1

    Hi all,

    I have a Gui screen which is working fine. But I am out of space in the screen, hence I have to add the scroll feature in this screen. Since it is a touchscreen hence i want to use a flickable scroll bar in it.

    Can you please help me to understand how to start for this, I had gone through qt examples but they all deal with List widget....which is not in my case. I don't want to disturb the Gui of my screen I just want to add the flickable scrolling feature in it.
    Is that possible? If yes, then how it can be done.

    Thanks in advance,
    Pragati

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      If you are not on QML (whose lists are flickable by default) the "flick charm":http://labs.qt.nokia.com/2008/11/15/flick-list-or-kinetic-scrolling/ might be of interest for you, which supports all C++ classes inheriting QAbstractScrollArea (there is a "solution":http://labs.qt.nokia.com/2009/07/19/kinetic-scrolling-on-any-widgets/ for classes not inheriting it as well, which is slightly more complicated).

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pragati
        wrote on last edited by
        #3

        Yeah I am not on QML......So its complicated than a simple scrollbar...or equivalent.....;)

        I have to use scroll feature anyhow but flickable will be better so thought to give it a try....I don't know from where and how to start....Thanks for your reply....:)

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pragati
          wrote on last edited by
          #4

          These two examples which you had mention I have gone through tjem but they are expalined for just how to make a qlist flickable...am i right here?

          I am not using any of it...I will show you one of my screen's code:

          DMMMenu.h:

          @
          #ifndef DMMMenu_H
          #define DMMMenu_H
          #include <QtGui>
          #include <QWidget>
          #include "../../DMM/Include/Voltage.h"
          #include "../../DMM/Include/Current.h"
          #include "../../DMM/Include/Resistance.h"
          #include "../../DMM/Include/Memory.h"
          namespace DMM
          {
          namespace Ui {
          class DMMMenu;
          }
          class DMMMenu: public QWidget
          {
          Q_OBJECT

          public:

          DMMMenu(QWidget *parent = 0);
          ~DMMMenu();

          public slots:
          void OnVoltageClicked();
          void OnCurrentClicked();
          void OnResistanceClicked();
          void OnMemoryClicked();
          private:
          Ui::DMMMenu *ui;

          public:
          DMM::Voltage *voltage;
          DMM::Current *current;
          DMM::Resistance *resistance;
          DMM::Memory *memory;
          };

          }

          #endif // DMMMenu_H

          @

          DMMMenu.cpp

          @
          #include "../../DMM/Include/DMMMenu.h"
          #include "ui_DMMMenu.h"
          #include <QDateTime>

          namespace DMM
          {

          DMMMenu::DMMMenu(QWidget *parent) :
          QWidget(parent),

          ui (new Ui::DMMMenu)
          

          {

          ui->setupUi(this);
          

          voltage=new Voltage();
          voltage->HO = this;
          voltage->hide();

          current=new Current();
          current->current_home =this;
          current->hide();

          resistance=new Resistance ();
          resistance->resistance_home=this;
          resistance->hide();

          memory=new Memory ();
          memory->Memory_home=this;
          memory->hide();

          connect(ui->voltage_Button, SIGNAL(clicked()), this, SLOT(OnVoltageClicked()));
          connect(ui->current_Button, SIGNAL(clicked()), this, SLOT(OnCurrentClicked()));
          connect(ui->resistance_Button, SIGNAL(clicked()), this, SLOT(OnResistanceClicked()));
          connect(ui->memory_Button, SIGNAL(clicked()), this, SLOT(OnMemoryClicked()));

          //get current date
          QDate date = QDate::currentDate();
          QString dateString = date.toString();
          ui->Label_Date->setText(dateString);

          // get current time
          QTime time = QTime::currentTime();
          QString timeString = time.toString();
          ui->Label_Time->setText(timeString);

          }

          void DMMMenu::OnVoltageClicked()
          {
          voltage->show();
          this->hide();
          }

          void DMMMenu::OnCurrentClicked()
          {
          current->show();
          this->hide();
          }

          void DMMMenu::OnResistanceClicked()
          {
          resistance->show();
          this->hide();
          }

          void DMMMenu::OnMemoryClicked()
          {
          memory->show();
          this->hide();
          }

          DMMMenu::~DMMMenu()
          {

          }

          }

          @

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lgeyer
            wrote on last edited by
            #5

            Yes, both solutions can be used to make lists flickable. Take a look at "QT-BUG9054":https://bugreports.qt-project.org/browse/QTBUG-9054 as well.

            If Qt5 is an option for you take a look at "QScroller":http://doc-snapshot.qt-project.org/5.0/qscroller.html#details.

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pragati
              wrote on last edited by
              #6

              Okay ....thanks...will come back to you after going through these two links.....

              :)

              1 Reply Last reply
              0
              • P Offline
                P Offline
                pragati
                wrote on last edited by
                #7

                Is Flickable scroll of widget is supported in Qt 4.0?

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  Bhupal
                  wrote on last edited by
                  #8

                  Hope this will help you
                  doc.qt.nokia.com/4.7-snapshot/demos-embedded-flickable-flickable-cpp.html

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    pragati
                    wrote on last edited by
                    #9

                    Hi all,

                    I followed exactly as explained in this link
                    http://qt-project.org/forums/viewthread/4059

                    Used the same qskinecticscroller.h and .cpp files but still my code is working not I am not able to scroll it......Is there any changes I have to make in theqs kinecticscroller files?

                    here is my .cpp file in which setupUi is mentioned

                    @

                    #include <QtGui>
                    #include "kinectic.h"
                    #include "ui_kinectic.h"
                    #include "QDateTime"
                    #include "scroller.h"

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

                    scroller = new Scroller(this);
                    scroller->enableKineticScrollFor(ui->scrollArea);

                    // // get current date
                    // QDate date = QDate::currentDate();
                    // QString dateString = date.toString();
                    // ui->label_date->setText(dateString);

                    // // get current time
                    // QTime time = QTime::currentTime();
                    // QString timeString = time.toString();
                    // ui->label_time->setText(timeString);
                    }

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

                    @

                    Include file for the same:

                    @
                    #ifndef KINECTIC_H
                    #define KINECTIC_H

                    #include "scroller.h"

                    #include <QWidget>
                    class Scroller;
                    namespace Ui {
                    class kinectic;
                    }

                    class kinectic : public QWidget
                    {
                    Q_OBJECT

                    public:
                    explicit kinectic(QWidget *parent = 0);
                    ~kinectic();

                    private:
                    Ui::kinectic ui;
                    Scroller
                    scroller;
                    };

                    #endif // KINECTIC_H

                    @

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      pragati
                      wrote on last edited by
                      #10

                      Please reply!!!!

                      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