Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qlineedit
    Log in to post

    • SOLVED Add TreeWidget item from another dialog
      General and Desktop • qmainwindow qdialog qlineedit qtreewidget • • HenrikSt.  

      3
      0
      Votes
      3
      Posts
      293
      Views

      Thanks, mrjj! That's it! Merry christmas
    • SOLVED QLineEdit: clear mask when not editing
      General and Desktop • qlineedit mask • • Justin Iurman  

      5
      0
      Votes
      5
      Posts
      527
      Views

      @mrjj Thanks for the welcoming :-) Indeed, the QStyledItemDelegate works fine, but only when I use a QTableWidget. So a first solution was to create a QTableWidget with 1 row and 1 column, and insert my delegate inside. The problem with this technique is that it's hard to perfectly mimic a QLineEdit (behavior, style, etc). For instance, with a QTableWidget, there is no simple click on items to enter in edit mode (this is a double click, at least), as far as I know. It's still possible to redefine the behavior, I guess, but it's not worth it. I don't like the whole thing. That's why I came up with another idea. This time, I keep my QLineEdit as is, and I add/remove the input mask when having/losing focus. Thanks to that, I'm now able to see the "true" text (without mask format) when I'm not editing it (QLineEdit does not have the focus), while I can see the text (with mask format) when I'm editing it (has focus). I know it's not totally elegant, but I don't think there is an elegant solution at all for this "problem". For those interested, a quick example on how to achieve this: (1) install an event filter (installEventFilter()) on the QLineEdit (2) filter on focus in/out (2.1) focus in: add the mask (setInputMask()) (2.1) focus out: remove the mask and set the text to the value before the mask was removed (because removing the mask erases the text inside the QLineEdit)
    • SOLVED Signal and slot wrong value being sent
      General and Desktop • qtcreator signal & slot button qlineedit • • Lasith  

      5
      0
      Votes
      5
      Posts
      1304
      Views

      Hi Yes calling the function directly is actually a better solution in this case. Its worth mentioning that the so called slots are 100% normal c++ member functions and can be called without any Qt involvement/use of. void MainWindow::on_pushButton_clicked() { int value=ui->lineEdit->text().toInt(); // get value Dialog dialog1; dialog1.sendIntData(value); dialog1.exec(); }
    • SOLVED Multiple LineEdits focus issues
      General and Desktop • qlineedit focus focus issue customplugin ip editor • • Sh1gs  

      7
      0
      Votes
      7
      Posts
      2123
      Views

      Thanks for posting your solution. Happy coding.
    • UNSOLVED How to make lineEdit acceptable only integers?
      General and Desktop • qtdesigner qlineedit input • • testerius  

      7
      0
      Votes
      7
      Posts
      7435
      Views

      Hi, for an integer input between 0 and 100 set the mask to "009". Thats all.
    • UNSOLVED Connect slider and line edit??
      General and Desktop • connect qlineedit qslider shared value • • QT-static-prgm  

      11
      0
      Votes
      11
      Posts
      4778
      Views

      But why use QLineEdit if you are only manipulating numbers ? That makes the code uselessly complicated.
    • SOLVED QLineEdit using a QRegExpValidator doesn't take effect.
      General and Desktop • qlineedit qregexp qregexpvalidato • • Cysis145  

      5
      0
      Votes
      5
      Posts
      1320
      Views

      QRegularExpression rx("[A-Za-z0-9]*"); QRegularExpressionalidator *v = new QRegularExpressionValidator(rx, this); ui->LE_ObjectName->setValidator(v);
    • How to check if email entered exists or not in QLineEdit ?
      General and Desktop • qlineedit qt5.7.0 • • Ahti  

      8
      0
      Votes
      8
      Posts
      2026
      Views

      There are a number of sites providing this service, most of them commercially. http://verify-email.org/ has a free API limited to 5 checks an hour. https://emailhunter.co/ limits to 150 a month
    • UNSOLVED How to get characters which user is typing in QLineEdit ?
      General and Desktop • qlineedit qt5.7 • • Ahti  

      7
      0
      Votes
      7
      Posts
      3523
      Views

      So if you use as mentioned earlier in same post , you can use the below code to restrict special characters. QRegularExpression regex("^[a-zA-Z0-9_]*$"); QValidator *validator = new QRegularExpressionValidator(regex, this); m_lineEdit->setValidator(validator); If you want to change the colour with respect to characters entered you can go for the below code. Then dont use validator connect(m_lineEdit,SIGNAL(textChanged(QString)),this,SLOT(getLineEditValue(QString)),Qt::UniqueConnection); use connection statement to get values when you type in QLineEdit. And Below Slot can be used to observe the changes done while typing in QLineEdit, with respect to characters, when u enter special characters Color changes to Red, and Color changes to Green when entering the digits or letters. void LineEditProgram::getLineEditValue(QString stringValue) { qDebug () << "value changed" << stringValue; QString temp = m_lineEdit->text(); QRegExp regexp("^[0-9A-Za-z_]*$"); if (!regexp.exactMatch(temp)) { qDebug () << "colour changed to red" << stringValue; m_lineEdit->setStyleSheet("border: 5px solid red"); m_label->setText(stringValue); } else { qDebug () << "colour changed to green" << stringValue; m_lineEdit->setStyleSheet("border: 5px solid green"); m_label->setText(stringValue); } }
    • UNSOLVED Values of dynamically created QLineEdit
      General and Desktop • qlineedit qlayout • • Tirolel  

      4
      0
      Votes
      4
      Posts
      1309
      Views

      @Tirolel If you want t do it that way you shouldn't you cast the widget to find out what type it is before you actually use it? if(qobject_cast<QLineEdit*>(pLine->widget()) != 0) ... Test for which type it is then use the correct type cast to use the actual member functions...
    • UNSOLVED Qt does not read the keyboard correctly
      QtonPi • qt5.6 qlineedit • • Munke  

      2
      0
      Votes
      2
      Posts
      821
      Views

      Hi and welcome to devnet, Looks like the keyboard layout of your Pi doesn't match the keyboard layout of your desktop computer. Which are both ?
    • SOLVED TextChanged variable unreachable ?
      General and Desktop • qstring qlineedit qlinedit variable • • cxam  

      3
      0
      Votes
      3
      Posts
      875
      Views

      @mrjj Thanks Mrjj :) it went perfect, you're awesome haha ;)
    • SOLVED QLineEdit
      General and Desktop • qlineedit focus issue • • gabor53  

      9
      0
      Votes
      9
      Posts
      3018
      Views

      Thank you it worked.
    • UNSOLVED StyleSheet to change QLineEdit background while being edited
      General and Desktop • stylesheet qlineedit • • shavera  

      4
      0
      Votes
      4
      Posts
      2343
      Views

      @shavera Did you tried to call QWidget::Update() after modifing your whileEditing property ?
    • SOLVED How to prohibit user from changing the cursor position in QLineEdit in touch based user interface
      Mobile and Embedded • qlineedit • • Sidii  

      3
      0
      Votes
      3
      Posts
      876
      Views

      Dear @SGaist, Thanks for the reply. Actually i do not want user to change the cursor position. I got one work around. I have connected the cursor position changed signal to one slot which automatically sets the cursor position to the end. The slot first calculate the text length and then moves the cursor to the last position. So in this case even if user tries to change the cursor location, cursor automatically comes at the end and whatever the user types is appended to the end. Regards Sid
    • Display 1 as 01, 2 as 02, 3 as 03, 4 as 04, 5 as 05, upto 9 as 09 in QLine Edit
      Mobile and Embedded • qlineedit • • Sidii  

      3
      0
      Votes
      3
      Posts
      728
      Views

      Hi, Since those are only numbers, why not use QSpinBox ?
    • UNSOLVED QLineEdit completion box direction
      General and Desktop • qlineedit completion box • • Kaluss  

      15
      0
      Votes
      15
      Posts
      2789
      Views

      How small are we talking about ? Note that if you mix that keyboard with Qt's input framework, you're probably going to have another problem when the keyboard's line edit gets the focus.
    • Can't enter apple symbol () in QLineEdit and QTextEdit on OSX
      General and Desktop • qtextedit osx qlineedit apple symbol • • peniwize  

      2
      0
      Votes
      2
      Posts
      921
      Views

      Dear @peniwize, I am not aware of direct entry of special symbols in QLineEdit in MAC but in WINDOWS OS we can do with the help of ALT key and the symbol code. Basically go to Character Map and select the special symbol then you will be able to see the corresponding Key code to that special character. Just hold ALT symbol and enter the code from num pad by enabling NUM LOCK. Then release the ALT key. That special symbol will automatically appear in the QLineEdit in Windows. May be something similar you can try in MAC OS too. Good luck!!
    • SOLVED setting QLineEdit text bold
      General and Desktop • qlineedit bold • • vinothrajendran4  

      8
      0
      Votes
      8
      Posts
      3091
      Views

      @vinothrajendran4 that said, i did find some code on the new that uses a trick. please see this sample https://www.dropbox.com/s/m6slequi83tbqg2/linedit.zip?dl=0
    • UNSOLVED Selective keyPressEvent, filter for dedicated sender QLineEdit
      General and Desktop • qlineedit qkeyevent qkeypressevent • • Ralf  

      2
      0
      Votes
      2
      Posts
      964
      Views

      You need to accept the event so the parent knows that the event has been handled. Otherwise the event will go all children until someone accepts it or if none do, it will be ignored. so keyEv->accept() should do the trick.
    • [Solved]Hiding default value of QLineEdit
      General and Desktop • qlineedit hide • • Yatshan  

      2
      0
      Votes
      2
      Posts
      1129
      Views

      From the documentation for placeholderText : QString: "This property holds the line edit's placeholder text. Setting this property makes the line edit display a grayed-out placeholder text as long as the line edit is empty." So, setting the text means the place holder text isn't shown any more. You can check whether the value is empty before you use it. If it is empty you use your default value.
    • Search up/down using QsciScintilla
      General and Desktop • windows qlineedit search qsciscintilla • • Yatshan  

      2
      0
      Votes
      2
      Posts
      1030
      Views

      Hi @Yatshan, and welcome to the Qt Dev Net! Sorry I don't have any experience with Scintilla, so I don't know how to solve your problem. Have you tried asking the person who created QsciScintilla?
    • Weird behaviour of QLineEdit
      Mobile and Embedded • qlineedit keypressevent mousepressevent • • Sidii  

      1
      0
      Votes
      1
      Posts
      385
      Views

      No one has replied

    • qt why qlineedit hidden after resize?
      General and Desktop • qlistwidget qlineedit • • deynekoaa  

      2
      0
      Votes
      2
      Posts
      1185
      Views

      Hi, Just a wild guess but you might be resizing it to 0
    • Set password character QLineEdit
      Mobile and Embedded • linux qlineedit password • • kumararajas  

      3
      0
      Votes
      3
      Posts
      1750
      Views

      @SGaist Thanks for your quick answer. And sorry for the delayed reply. Overriding QLineEdit was in my mind. Wanted to know if there are any straight forward way to get it done. But now am sure about that! Thank you!
    • [SOLVED] QLineEdit, setNum(), How to show more than 6 decimal places of a number?
      General and Desktop • qlineedit • • newe12  

      5
      0
      Votes
      5
      Posts
      6365
      Views

      Solved! It is working now! I had set: lineedit->setMaxLength(10); before. This has been limiting: ...,'g', 10)); After I have removed it, it works! @Chris-Kawa thanks for the other post, but 'g', 10 works fine now! Thanks anyway!
    • [SOLVED] QLineEdit does not receive character input on Android
      Mobile and Embedded • android qlineedit keyboard • • SteveMBay  

      29
      0
      Votes
      29
      Posts
      9333
      Views

      @SteveMBay Just for clarification, did you fix the wrong behaviours or do you need more help about this issue?
    • QT 4.1 QlineEdit Rounded Corners & QVBoxLayout set margin for only top ?
      Mobile and Embedded • qlineedit qvboxlayout qt 4.1 • • cranberries_  

      4
      0
      Votes
      4
      Posts
      1118
      Views

      AFAIK, stylesheets where introduced in Qt 4.2 so how can they use stylesheets if they use 4.1 ?
    • QValidator, more than one in a one QLineEdit
      General and Desktop • qlineedit qvalidator • • mrdebug  

      7
      0
      Votes
      7
      Posts
      1700
      Views

      @mrdebug If you are using only uppercase letters in QRegExp you should be fine. E.g. "[IO]{1,1}" shall match only an uppercase 'I' or an uppercase 'O'.
    • QRegExp with QLineEdit
      Mobile and Embedded • qlineedit qregularexpress • • Endar  

      4
      0
      Votes
      4
      Posts
      1101
      Views

      @Endar I hope this will help you QRegExpValidator* validator = new QRegExpValidator(QRegExp("[A-a-Z-z][A-a-Z-z]\\d{0,2}\\d[A-a-Z-z][A-a-Z-z]")); ui->lineEdit->setValidator(validator);
    • No cursor or text visible in QLineEdit, on top QGraphicsView
      General and Desktop • qgraphicsview qgraphicsscene qmainwindow qlineedit • • FinitelyFailed  

      3
      0
      Votes
      3
      Posts
      1351
      Views

      For the moment I have made the GraphicsView 1 pixel shorter than the screen layout (i.e. 1920x1079) which makes everything work perfectly. I'm using an QGLWidget as the viewport for the GraphicsView. When I try to use the new QOpenGLWidget instead the (normal) widgets that are added on top of the graphics view are rendered correctly, however anything drawn using OpenGL flickers as soon as any part of the widget normal needs to be redrawn. E.g. when adding a QLineEdit and the cursor blinks or when text is inputted into the widget the parts drawn with OpenGL (in the graphicsview) flickers. Which makes it (QOpenGLWidget as a viewport) impossible to use in our case.
    • Convert std::string to QLineEdit
      General and Desktop • qlineedit convert stdstring • • gshannon154  

      4
      0
      Votes
      4
      Posts
      2039
      Views

      You can create the QLineEdits dynamically
    • QLineEdit doesn't stretch to occupy full space in the layout
      General and Desktop • mac qlineedit qgridlayout sizepolicy stretch qtformac • • bharath144  

      2
      0
      Votes
      2
      Posts
      1372
      Views

      Hi, this is old now but in case someone else finds this: I managed to solve this problem by using setSizeConstraint(QtWidgets.QLayout.SetNoConstraint) for a layout holding the QLineEdit widget. Actually it wasn't the layout holding the widget, but the layout holding that layout, so you may need to experiment to find out where you need to make this update (or just use SetNoConstraint for all your layouts) I hope this helps someone!