Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61940

QLineEdit::maxLength support for Android

XMLWordPrintable

    • Android

      I'm deploying a Qt application under Android. When a QLineEdit length is limited (using setMaxLength), the Android virutal keyboard lets me enter more characters than allowed and later the QlineEdit content is truncated when virtual keyboard is closed.

      Would eb much better to have this limit be handled in real time not to let user enter more characters than expected

       

      #include <QApplication>
      #include <QMainWindow>
      #include <QVBoxLayout>
      #include <QLineEdit>
      
      int main( int argc, char* argv[] )
      {
          // See https://stackoverflow.com/q/45030312/3336423
      
          QApplication app( argc, argv ); 
      
          QMainWindow wnd;
      
          QWidget widget( &wnd );
          wnd.setCentralWidget( &widget );
      
          widget.setLayout( new QVBoxLayout(&widget) );
      
          QLineEdit edit( &wnd );
          edit.setMaxLength( 10 );
      
          widget.layout()->addWidget( &edit );
      
          wnd.show();
      
          return app.exec();
      }
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            lukasz.kosiorowski lukasz.kosiorowski
            jpo38 Jean Porcherot
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes