×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    5

    Focus to the forms list widget only gets after one click by the mouse.

    Hi all,
    Please advice on the below problem that i am facing.

    Dev version : QT with 2.1 creator.
    component/lib used :: QT 4.6.3.
    target platform tested on device :: 3rd Edition FP2. device E72/E5

    This problem happens on all the screens of my application.

    Layout is simple. Each screen has a list widget in which we have custom list widget items.
    irrespective of the screen i need to click the tracker button two times- ( ONLY for the first time the screen opens )- to select an option which leads to list_widget_on_item_activated slot and i am able
    process ahead with code like showing a dialog or changing text or toggling a check box.

    I am saying only for the first time the screen opens because even the toggle of the check box does reflect a tracker click.
    i can am able to focus down and up on list widget with tracker ( different items highlighted as we scroll)
    but the single click does go through and land on the list_widget_on_item_activated slot.

    I have tried different combinations like .
    - changing the focus policy, current i have no focus policy.
    - settings focus/ edit focus once the widget is rendered.
    - calling grab keyboard / grabmouse function as the soon as the widget is rendered.
    - calling list widget raise function as the soon as the widget is rendered.
    - post/sending a mouse clicked/ item selected event. as the soon as the widget is rendered.
    - emitting a item activated signal as the soon as the widget is rendered.

    none of the above seem to be helping me.
    please do see that once the item is selected ( after double click ) every things as expected like toggling of check boxes etc.

    Please advice if you have faced similar issue and work around.

    Regards
    Pushkal.

  2. #2
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Focus to the forms list widget only gets after one click by the mouse.

    what is a tracker for you?

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    5

    Re: Focus to the forms list widget only gets after one click by the mouse.

    Quote Originally Posted by gnuton View Post
    what is a tracker for you?
    when i said tracker/mouse - i mean the optical track pad.
    Apologize for the late reply.

    please see - i have some more observation... we are using list widget and we add items to it.
    if i have push button on the window- the focus is on the pushbutton and first click of the track pad does let to push botton click event of the push button.
    but if i only have listwidget with items in it. i have to do two clicks of the optical track pad to get to the slot on_listWidget_itemActivated() of the listwidget.

  4. #4
    Registered User
    Join Date
    Sep 2011
    Posts
    5

    Re: Focus to the forms list widget only gets after one click by the mouse.

    i have a work around.. code...

    bool MainWindow::event(QEvent *e)
    {
    qDebug()<< " event for main window " << e << e->type();
    if( e->type()== QEvent::ShortcutOverride)
    {
    QKeyEvent * ke = static_cast<QKeyEvent*>(e);
    if (ke->key() != Qt::Key_Select)
    return QMainWindow::event(e);
    int mainwindowfocuslost = qSettings.value("mainwindowfocuslost",0).toInt();
    qDebug()<< " mainwindowfocuslost is " << mainwindowfocuslost;
    if (onceFlag == false || mainwindowfocuslost)
    {
    QListWidgetItem* item =ui->listWidget->currentItem();
    if ( item == NULL)
    item= ui->listWidget->itemAt(0,0);
    on_listWidget_itemActivated(item);
    onceFlag= true ;
    qSettings.setValue("mainwindowfocuslost",QVariant(0));
    return true;
    }
    }
    return QMainWindow::event(e);
    }

Similar Threads

  1. calling a widget screen from a click event.
    By kathir.s in forum [Archived] Beginning Qt
    Replies: 1
    Last Post: 2011-09-27, 16:22
  2. Dynamically adding a mouse click event to button movieclip
    By ranco in forum [Archived] Flash Lite on Nokia Devices
    Replies: 7
    Last Post: 2010-01-05, 21:52
  3. Mouse click Event
    By abhimanyu1 in forum Symbian
    Replies: 2
    Last Post: 2009-10-09, 08:10
  4. Replies: 4
    Last Post: 2009-07-13, 12:30
  5. Download & Install Engine and Widget with One Click?
    By brett.sheeran@gmail.com in forum Symbian
    Replies: 1
    Last Post: 2009-02-06, 13:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •