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. Using an Eventfilter
Forum Updated to NodeBB v4.3 + New Features

Using an Eventfilter

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 4 Posters 6.5k Views 3 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.
  • M Offline
    M Offline
    mpergand
    wrote on 6 Aug 2019, 15:13 last edited by mpergand 8 Jun 2019, 15:14
    #21

    In the case of a form, you simply identify the field by its name:
    ui->field1
    ui->filed2
    etc

    in your slot you can do:

    void doubleClickOnField()
    {
    QObject* obj=sender();
    
    if(obj==ui->field1) { }
    else if(obj==ui->field2 {}
    ... etc
    }
    

    Also, you will need to do a cast to retreive the particular object data. For ex:

    QLineEdit* edit=qobject_cast<QLineEdit*>(sender());
    
    if(edit !=nullptr) // beware could be null
    {
    QString text=edit.tex();
    }
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 6 Aug 2019, 19:32 last edited by
      #22

      Not trying to undermine your efforts but I think your users are going to be pretty surprised.

      Personally, I don't expect anything other than text selection when I double click on a line edit type widget.

      If a report shall be generate, I would rather have an explicit button for that.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3

      21/22

      6 Aug 2019, 15:13

      • Login

      • Login or register to search.
      21 out of 22
      • First post
        21/22
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved