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. Default textSelection into QLineEdit (Qt 4.8)
Forum Updated to NodeBB v4.3 + New Features

Default textSelection into QLineEdit (Qt 4.8)

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 730 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.
  • X Offline
    X Offline
    xaviermartin
    wrote on last edited by
    #1

    Hello,

    I have built a wigdet that contains several QLineEdit, we can navigate from QLineEdit to the other by tab touch. Text of the next QLineEdit is set by the text of into the previous QLineEdit. But the text is sytematically selected, and the function deselect() or cursorWordForward(false) are without effect.
    Some code :

    // Slot call after the signal editFinished() is emited by the previousLineEdit
    @
    void qcustomWdg::fillLineEdit()
    {
    QString strPreviousText = lpLineEditPrevious->text();
    lpLineEditNext->setText(strPreviousText);
    // lpLineEditNext ->cursorWordBackward(true);
    // lpLineEditNext ->cursorWordForward(false);
    lpLineEditNext ->deselect();
    }
    @
    Executing this code places the StrPrevious intot the NextLineEdit but the text is selected. How can I do to have no selection ?

    Thank you for your help.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stevenceuppens
      wrote on last edited by
      #2

      you can connect the

      @void selectionChanged()@

      signal of the QLineEdit to a custom slot,

      and than call deselect() from your slot.

      Steven CEUPPENS
      Developer / Architect
      Mobile: +32 479 65 93 10

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xaviermartin
        wrote on last edited by
        #3

        Thank, ok this solution works but I don't understand why the code

        @
        lpLineEditNext->deselect()
        @

        doesn't work

        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