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. Custom Input: QLineEdit
QtWS25 Last Chance

Custom Input: QLineEdit

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

    Looking inside Qt Creator IDE -> Tools -> Options -> Build & Run -> General Tab:
    There is a "Default build directory" input field.

    When I click inside this field, it shows me a "AB" icon on the right side.
    And if I click in this icon, I got a list window with some options...

    I would like to know how can I implement this QLineEdit component with this "right icon" feature.

    0_1566330109976_input_x.jpg
    Could you help me?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Might be QLineEdit::addAction.

      Otherwise, you can take a look at Qt Creator's sources for that field.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      F 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Might be QLineEdit::addAction.

        Otherwise, you can take a look at Qt Creator's sources for that field.

        F Offline
        F Offline
        fem_dev
        wrote on last edited by
        #3

        @sgaist that's right! Thank you!

        QLineEdit *myLineEdit = new QLineEdit(this);
        QAction *myAction = myLineEdit->addAction(QIcon("test.png"), QLineEdit::TrailingPosition);
        connect(myAction, &QAction::triggered, this, &MyClass::onActionTriggered);
        
        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