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. QScroller not working on multiple widgets?
Forum Updated to NodeBB v4.3 + New Features

QScroller not working on multiple widgets?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.9k 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.
  • A Offline
    A Offline
    adutzu89
    wrote on last edited by
    #1

    I have a QTableView and on click it opens a modal QDialog.
    If I a apply QScroller to both of them, only the one on table works, If I remove the one from the table, the one from the dialog works. I am confused.
    Any explanation/help?

    Qt 5.3.1
    Ubuntu 14.04.1, 64bit.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      adutzu89
      wrote on last edited by
      #2

      Update: The issue appears when modal dialogs are involved.
      Tried with modeless dialogs and it works, strange

      1 Reply Last reply
      0
      • JeroentjehomeJ Offline
        JeroentjehomeJ Offline
        Jeroentjehome
        wrote on last edited by
        #3

        Do you use event(filters). When the parent catches an event, the child (dialog) will not get it anymore.
        In default the model dialog is the most easy to use, because all the scroll/focus handling is set. The scroll should work when the dialog has focus. Could you share some code how you create the dialog and the scrollbar?

        Greetz, Jeroen

        1 Reply Last reply
        0
        • A Offline
          A Offline
          adutzu89
          wrote on last edited by
          #4

          I didn't used any custom event, used signals->slot.

          Well this is how I create the container for all the widgets that go inside the QDialog:
          @ wPrinc=new QWidget(this); //widget that will contain all others, created for the purpose of adding a scrollarea
          layout=new QVBoxLayout; //dialog layout
          QScrollArea *sa=new QScrollArea(this);
          sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
          sa->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
          sa->setFrameShape(QFrame::NoFrame);
          sa->setWidget(wPrinc);
          sa->setWidgetResizable(true);

          layout->addWidget(wPrinc);
          QScroller::grabGesture(sa,QScroller::LeftMouseButtonGesture);
          

          @

          The dialog I open is a basic modal QDialog:

          @DialIes *d=new DialIes(this);
          d->exec();@

          QScroller:

          @QScroller::grabGesture(tabel,QScroller::LeftMouseButtonGesture);@

          *tabel=new QTableView();

          1 Reply Last reply
          0
          • JeroentjehomeJ Offline
            JeroentjehomeJ Offline
            Jeroentjehome
            wrote on last edited by
            #5

            Hi, for QScroller::grabGesture shouldn't the target object be the widget that has the scrollArea installed? So in this case wPrinc instead of sa?

            Greetz, Jeroen

            1 Reply Last reply
            0
            • A Offline
              A Offline
              adutzu89
              wrote on last edited by
              #6

              It doesn't work that way,

              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