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. QLineEdit add QAction
QtWS25 Last Chance

QLineEdit add QAction

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 1.1k 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.
  • O Offline
    O Offline
    OtisLin
    wrote on last edited by VRonin
    #1
    m_PasswordLineEdit = new KeyboardLineEdit();
    m_ShowPwsAction = new QAction;
    m_ShowPwsAction->setCheckable(true);
    m_ShowPwsAction->setChecked(false);
    m_PasswordLineEdit->addAction(m_ShowPwsAction, QLineEdit::TrailingPosition);
    

    I want add a button in the end of lineedit.
    And I use add action. It's work.
    But i clicked the button lineedit also got the focusIn.
    It's possible action toggled but lineedit don't get the focusIn?

    Qt Version 5.9.5

    1 Reply Last reply
    0
    • artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #2

      Hi.
      QLineEdit is derived from QWidget. Every QWidget has set of methods regarding the focus, you can manipulate it throughout the whole UI.
      I think looking into FocusPolicy might be of use but I am not certain.

      For more information please re-read.

      Kind Regards,
      Artur

      1 Reply Last reply
      1
      • O Offline
        O Offline
        OtisLin
        wrote on last edited by
        #3

        擷取.PNG
        I want press in red area still got focus on click, and click on blue area only got toggled (addAction) signal.

        I try set ClickFocus for lineEdit for focus policy, but it's also will get the focusIn. I think is not work.

        thanks for your reply.

        JonBJ 1 Reply Last reply
        0
        • O OtisLin

          擷取.PNG
          I want press in red area still got focus on click, and click on blue area only got toggled (addAction) signal.

          I try set ClickFocus for lineEdit for focus policy, but it's also will get the focusIn. I think is not work.

          thanks for your reply.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @OtisLin
          Then if focus policy won't do it you will have to catch the button/action click and restore focus to the line edit?

          1 Reply Last reply
          0
          • qwasder85Q Offline
            qwasder85Q Offline
            qwasder85
            wrote on last edited by qwasder85
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • O Offline
              O Offline
              OtisLin
              wrote on last edited by
              #6

              I think want to handle separately by QLineedit and QAction pressevent is impossible.
              now I try to new QPushbutton and add to a new layout.
              setlayout to QLineedit, it's look like fine. but need more test.
              thanks for your reply.

              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