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. QLineEdit is overwriting the first input character (bug?)

QLineEdit is overwriting the first input character (bug?)

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
androidqlineeditwidgetbug
3 Posts 3 Posters 625 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.
  • H Offline
    H Offline
    Hector_WPG
    wrote on last edited by
    #1

    Hello,

    I have been working with QT for and Android development.

    I have a problem with QLineEdit widgets. If the textbox is empty, because of the first time or I removed the previous text, when I write then the first character becomes highlighted so if I write another character I overwrite the first character.

    I have disabled several android features like "text-autocomplete", besides in QLineEdit property imhNonPredictiveText = true

    • Android version 9
    • QT 5.12.0 building for android_armv7

    How to reproduce:
    In a QLineEdit, remove all the characters using backspace, once it is empty, press backspace one or more times. Then write a character, it might be highlighted (selected).

    Mitigation:
    This is the way we are mitigating this problem, but we would like to if this is a known problem or a configuration problem, and how to solve it without using something like this:

    
    // QLineEdit bug fix
    connect(ui->qlineeditWidget, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(resetQLineEditSelectionIssue(int,int)));
    
    
    void FrmWifiSettings::resetQLineEditSelectionIssue(int oldPos, int newPos)
    {
    	QObject * senderObj = sender();
    
    	if (senderObj != nullptr)
    	{
    		QLineEdit *widget = (QLineEdit*) senderObj;
    
    		if ( (widget != nullptr) && (oldPos == 0) && (newPos == 1) && (widget->hasSelectedText()) )
    		{
    			qDebug() << "resetQLineEditSelectionIssue() : issue found ";
    			widget->deselect();
    		}
    	}
    }
    

    Thanks

    jsulmJ 1 Reply Last reply
    0
    • H Hector_WPG

      Hello,

      I have been working with QT for and Android development.

      I have a problem with QLineEdit widgets. If the textbox is empty, because of the first time or I removed the previous text, when I write then the first character becomes highlighted so if I write another character I overwrite the first character.

      I have disabled several android features like "text-autocomplete", besides in QLineEdit property imhNonPredictiveText = true

      • Android version 9
      • QT 5.12.0 building for android_armv7

      How to reproduce:
      In a QLineEdit, remove all the characters using backspace, once it is empty, press backspace one or more times. Then write a character, it might be highlighted (selected).

      Mitigation:
      This is the way we are mitigating this problem, but we would like to if this is a known problem or a configuration problem, and how to solve it without using something like this:

      
      // QLineEdit bug fix
      connect(ui->qlineeditWidget, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(resetQLineEditSelectionIssue(int,int)));
      
      
      void FrmWifiSettings::resetQLineEditSelectionIssue(int oldPos, int newPos)
      {
      	QObject * senderObj = sender();
      
      	if (senderObj != nullptr)
      	{
      		QLineEdit *widget = (QLineEdit*) senderObj;
      
      		if ( (widget != nullptr) && (oldPos == 0) && (newPos == 1) && (widget->hasSelectedText()) )
      		{
      			qDebug() << "resetQLineEditSelectionIssue() : issue found ";
      			widget->deselect();
      		}
      	}
      }
      

      Thanks

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Hector_WPG You should check Qt bug tracker. If it is not known issue there you can file a bug.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      aha_1980A 1 Reply Last reply
      1
      • jsulmJ jsulm

        @Hector_WPG You should check Qt bug tracker. If it is not known issue there you can file a bug.

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @jsulm That is correct, but I'd first try with the latest Qt 5 version 5.15.2

        Regards

        Qt has to stay free or it will die.

        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