Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to put TextField/LineEdit or something like that in a MessageDialog?
Forum Updated to NodeBB v4.3 + New Features

How to put TextField/LineEdit or something like that in a MessageDialog?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 1.1k 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.
  • K Offline
    K Offline
    krokstr
    wrote on last edited by
    #1

    Hello everyone, I'm trying to make some kind of MessageDialog (it could be something else if it this one doesn't work) with text input filed and 3 buttons beneath that field. I've only managed to display the dialog box with some buttons but not the input field. How should I do it?

    Here is one of my attempts:

        MessageDialog {
            id:the_dialog
            text: "Changing file name!"
            informativeText: "Do you want to save your changes?"
            TextEdit{
                id:helloDialog
                width: 240
                text: "123456"
                font.family: "Helvetica"
                font.pointSize: 20
                color: "blue"
                focus: true
            }
            
            buttons: MessageDialog.Ok | MessageDialog.Cancel
        }
    

    I want something like this:

    alt text

    ODБOïO 1 Reply Last reply
    0
    • K krokstr

      Hello everyone, I'm trying to make some kind of MessageDialog (it could be something else if it this one doesn't work) with text input filed and 3 buttons beneath that field. I've only managed to display the dialog box with some buttons but not the input field. How should I do it?

      Here is one of my attempts:

          MessageDialog {
              id:the_dialog
              text: "Changing file name!"
              informativeText: "Do you want to save your changes?"
              TextEdit{
                  id:helloDialog
                  width: 240
                  text: "123456"
                  font.family: "Helvetica"
                  font.pointSize: 20
                  color: "blue"
                  focus: true
              }
              
              buttons: MessageDialog.Ok | MessageDialog.Cancel
          }
      

      I want something like this:

      alt text

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @krokstr hi,
      I think your TextEdit is here, but is has no visual borders thats why you can't see it.
      You can use TextField also lke this :

          MessageDialog{
              id:d
                 contentItem:RowLayout{
                      TextField{
                          placeholderText: ".."
                      }
                      Button{
                          text:"ok"
                      }
                 }
          }
      

      see also Popup : https://doc.qt.io/qt-5/qml-qtquick-controls2-popup.html
      and Dialog : https://doc.qt.io/qt-5/qml-qtquick-controls2-dialog.html

      1 Reply Last reply
      1
      • K Offline
        K Offline
        krokstr
        wrote on last edited by
        #3

        Thanks for the help! Popup type did a perfect job for my purpose.

        ODБOïO 1 Reply Last reply
        0
        • K krokstr

          Thanks for the help! Popup type did a perfect job for my purpose.

          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #4

          @krokstr Nice!
          You can mark this topic Solved with the topic tools

          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