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

    Felgo User

    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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support