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. How to make input field with list under it contain suggestions?
Forum Updated to NodeBB v4.3 + New Features

How to make input field with list under it contain suggestions?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 711 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    as you can see from this photo I'm trying to make a input field with suggestions under it in a list
    0_1534024347900_anigif_enhanced-19782-1399666227-9.gif
    can anyone know how to do it

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

      Hi and welcome
      You can use QCompleter
      http://doc.qt.io/qt-5/qtwidgets-tools-completer-example.html
      here it uses files but list can be anything.

      http://doc.qt.io/qt-5/qtwidgets-tools-customcompleter-example.html

      http://doc.qt.io/qt-5/qcompleter.html

      ? 1 Reply Last reply
      2
      • mrjjM mrjj

        Hi and welcome
        You can use QCompleter
        http://doc.qt.io/qt-5/qtwidgets-tools-completer-example.html
        here it uses files but list can be anything.

        http://doc.qt.io/qt-5/qtwidgets-tools-customcompleter-example.html

        http://doc.qt.io/qt-5/qcompleter.html

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @mrjj is there a way to use QCompleter in form design

        mrjjM 1 Reply Last reply
        0
        • ? A Former User

          @mrjj is there a way to use QCompleter in form design

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @davidlabib
          nope as its not visual.
          But you can assign it to Edit you have placed on form. (UI)
          so almost yes.
          All it takes is

          (after setupUI())
          
          QStringList wordList;
          wordList << "alpha" << "omega" << "omicron" << "zeta";
          QCompleter *completer = new QCompleter(wordList, this);
          completer->setCaseSensitivity(Qt::CaseInsensitive);
          ui->lineEdit->setCompleter(completer);
          
          ? 1 Reply Last reply
          1
          • mrjjM mrjj

            @davidlabib
            nope as its not visual.
            But you can assign it to Edit you have placed on form. (UI)
            so almost yes.
            All it takes is

            (after setupUI())
            
            QStringList wordList;
            wordList << "alpha" << "omega" << "omicron" << "zeta";
            QCompleter *completer = new QCompleter(wordList, this);
            completer->setCaseSensitivity(Qt::CaseInsensitive);
            ui->lineEdit->setCompleter(completer);
            
            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            @mrjj thanks a lot

            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