Test menu context creation on QTableView



  • Hi,
    I've added ContextMenu support on customContextMenuRequested signal.
    Now, in test I would like to trigger this signal by clicking proper table cell (as different cell should create different QMenu content).
    I've

    QPoint clickPos{0,0};
    for(unsigned int column = 0;column < Fleets::fc_FirstOrder;column++)
      clickPos.rx()+=view->columnWidth(static_cast<Fleets::FleetsColumns>(column));
    clickPos.rx()+=view->columnWidth(Fleets::fc_FirstOrder)/2;
    clickPos.ry()+=view->rowHeight(0)/2;
    view->resizeColumnsToContents();
    
    // WHEN
    QTest::mouseClick(view.get(),Qt::LeftButton,Qt::NoModifier, clickPos);
    

    However, when this code is executed I receive warnings
    WARNING: FleetsOrdersModelTest::test_context_menu_on_order_field() Mouse event "MousePress" not accepted by receiving widget
    WARNING: FleetsOrdersModelTest::test_context_menu_on_order_field() Mouse event "MouseRelease" not accepted by receiving widget

    How should I execute trigger this test?


Log in to reply
 

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