popup dialog in qml



  • Hi,

    I am new to qml and i need a popup dialog with browse button using qml code. I need a dialog as popup with browse button option and after click browse button file browsing functionality should happen,

    Give me solution to create a popup dialog.

    thanks in advance.


  • Moderators

    @DivyaMuthyala
    your search seems to be broken -> QML Popup



  • Hi ,

    Yes, but I required one lineedit and one button, and when we click the button with text browse and when we click that button file browsing should happen.

    Please share me code for this requirement.

    Thanks in advance



  • Hi,

    Please give me solution for above post.

    Thanks in advance.


  • Moderators

    @DivyaMuthyala
    sorry i wont post the whole code here, but give some hints how to start, since those are actually pretty easy QML basics to achieve what you want.

    1. create the QML Popup type
    2. place a line edit/text element and a button/Rectangle
    3. on the button click open a file dialog
    4. set the selected path to the line edit (see file dialogs accepted signal)

    the docs should quickly show how to use the elements and help you get what you want



  • Hi raven-worx,

    Thanks for the reply, I am very new to qml.

    So I required that part of code, please share me code.
    thanks in advance.


  • Moderators

    @DivyaMuthyala said in popup dialog in qml:

    Thanks for the reply, I am very new to qml.

    i don't want to be rude, but this is a perfect example to start learning QML



  • Hi raven-worx,

    I have made my code, but here my doubt is it is coming like window with maximize minimize and close buttons, here i should not require those, how to avoid those?



  • Hi!

    To use popups in your QML app, you can also have a look at V-Play Engine for Qt-based mobile apps and games.

    It is possible to trigger native device dialogs on Android and iOS, for example with NativeDialog::confirm. For QML-based dialogs you can use the InputDialog features, or create a custom Dialog component, which comes with a ready-made styling that matches iOS dialogs.

    Here's a short usage example:

    import VPlayApps 1.0
    import QtQuick 2.5
    
    App {
    
      // Buttons to trigger dialogs
      Column {
    
        AppButton {
          text: "Show Custom Dialog"
          onClicked: customDialog.open()
        }
    
        AppButton {
          text: "Show Native Dialog"
          onClicked: NativeDialog.confirm("Native Dialog", "Description", function(accepted) {
             if(accepted) {
               /* do something */
             }
          })
    
        }
      }
    
      // Custom Dialog with Text
      Dialog {
        id: customDialog
        title: "Custom Dialog"
        negativeAction: false // hide "Cancel" button of dialog
    
        onAccepted: {
          /* do something */
          customDialog.close()
        }
    
        AppText {
          anchors.centerIn: parent
          text: "This is a custom Dialog"
        }
      }
    
    }
    

    Cheers,
    GT



  • Hi,

    Thanks for the reply.

    Now I have created my own popup in qml as PopUp.qml, now i want to give this as input in dialog in other qml file.
    Can you please help me.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.