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. No cursor in QLineEdit after QEvent::FocusIn SOLVED
Forum Updated to NodeBB v4.3 + New Features

No cursor in QLineEdit after QEvent::FocusIn SOLVED

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.6k Views 1 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.
  • V Offline
    V Offline
    Vittorio
    wrote on last edited by
    #1

    hi all,

    I try to clear a QLineEdit, when it gets the focus. For that I installed an eventFIlter. Basically it works, as it should do, but additional to that there is NO cursor though the QLineEdit has the focus and is editable! This is very irritating...

    Here is my code:

    First the installation of the filter in the constructor of class mainWindow:
    @ui->lineEditFilter->installEventFilter(this);@

    and then the corresponding function:
    @bool MainWindow::eventFilter(QObject *target, QEvent *event)
    {
    if(target == ui->lineEditFilter && event->type() == QEvent::FocusIn)
    {
    ui->lineEditFilter->clear();
    return true;
    }
    else
    {
    event->ignore();
    return false;
    }
    }@

    Can anybody help me?

    Thanks in advance,

    Vittorio

    Qt 5.2 on Linux Debian Wheezy
    i7 Quadcore
    8 GB RAM
    Nvidia Geforce GTX 285M

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      It works as expected i.e cursor is indeed shown. I just tried with QWidget instead of mainwindow. Just see whether someother widget is consuming the focusevent in your program.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vittorio
        wrote on last edited by
        #3

        thx!

        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