Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QScroller crash after deleting QListWidget on Android
Forum Updated to NodeBB v4.3 + New Features

QScroller crash after deleting QListWidget on Android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 343 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.
  • M Offline
    M Offline
    mikhail_kr
    wrote on last edited by mikhail_kr
    #1

    To test QScroller on my Android device,
    I have written a simple HelloWorld-like application with QStackedWidget with 2 pages.
    Every page has a single QListWidget with a number of items.
    On startup, the app shows page_2 of the stacked widget with a number of items. QScroller is attached programmatically to this QListWidget:

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

    ui->stackedWidget->setCurrentIndex(1);
    
    scroller = QScroller::scroller(ui->listWidget_2);
    scroller->grabGesture(ui->listWidget_2);
    

    }

    On application startup everything is ok. QScroller attached is working fine with the QListWidget.

    After that I press "Go to page 1" button which removes the entire page from the stacked widget and attach QScroller to the second QListWidget :

    void MainWindow::on_pushButton_clicked()
    {
    QScroller::ungrabGesture(ui->listWidget_2);

    ui->stackedWidget->removeWidget(ui->page_2);
    ui->page_2->deleteLater();
    ui->page_2 = nullptr;
    
    QScroller* scroller2 = QScroller::scroller(ui->listWidget);
    scroller2->grabGesture(ui->listWidget);
    

    }

    The widget is displayed OK. But when I try to scroll it with my fingers, the app crashes with SIGSEGV(Segmentation fault) and the stack is:

    #10 qtMainLoopThread

    1. QWidget* object_cast<QWidget*>(QObject*)
    2. QFlickGestureRecognizer::recognize(QGesture*, QObject*, QEvent*)
    3. ???

    What am i doing wrong???

    The complete source code of the application:
    https://yadi.sk/d/hothr7gx3YpG2A

    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