Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › How to add a button to Dialog title bar?

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #20065

    Eric

    I’d like to add a button to the Dialog title bar, similar to using

    rightBarItem : NavigationBarItem {}

    inside a Page {}. When not using Felgo, it seems one can add

    header : Item {}

    to get the same effect, however when using Felgo, Dialog {} doesn’t recognize the ‘header’ property. I can’t find any alternatives other than maybe somehow getting anchors to put it where I want no matter the screen resolution. I would definitely prefer something a little more elegant.

    Thank you,
    Eric

     

    #20068

    Alex
    Felgo Team

    Hi Eric,

    following interface design guidelines, it is not supposed to have a button in the dialog title, thus we will also not add this option directly to the component. However, as you mentioned, you can use anchoring to move a custom component to the header, like this:

    import Felgo 3.0
    import QtQuick 2.9
    
    App {
      onInitTheme: {
        dialog.open()
      }
    
      Page {
        Dialog {
          id: dialog
          title: "Test"
      
          AppButton {
            text: "Button"
            flat: true
            anchors.right: parent.right
            anchors.top: parent.top
            anchors.topMargin: -dp(48)
          }
      
          AppText {
            width: parent.width
            text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
            padding: dp(15)
          }
        }
      }
    }
    

    Cheers,
    Alex

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.