QScroller not working on multiple widgets?



  • 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.



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



  • 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?



  • 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();



  • 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?



  • It doesn't work that way,


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.