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. QML Dialog dont fit content
Forum Updated to NodeBB v4.3 + New Features

QML Dialog dont fit content

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 3.4k 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.
  • L Offline
    L Offline
    Lays147
    wrote on 22 Oct 2016, 01:12 last edited by
    #1

    Hi, I'm trying to do a settings dialog for my app, I'm using extern item that I wrote it, kind following OO orientation on my QML code. But even adding width and height on the extern files, when I load the dialog, it loads small. From the documentation, it says that the QML Dialog should resize to fit the content, but that don't happen. Any tip on how to solve it? Thanks
    Follow the code of the dialog:

    import QtQuick 2.7
    import QtQuick.Dialogs 1.2
    import QtQuick.Controls 1.4
    import QtQuick.Window 2.2
    import QtQuick.Layouts 1.3
    
    Dialog {
      id: printerSettingsDialog
      visible: false
      title: qsTr("General Settings")
      standardButtons: StandardButton.Save | StandardButton.Cancel
    
      TabView {
      id: tabs
      anchors.fill: parent
    
      Tab {
      id: bedSettings
      title: qsTr("Bed:")
      BedSettings {
      id: bedTab
      }
      }
      Tab {
      id: extruderSettings
      title: qsTr("HotEnd:")
      ExtruderSettings {
      id: extruderTab
      }
      }
      } //End TabView
    
      onAccepted: {/*TODO: Save on Settings profile*/}
      onRejected: {/*TODO: Discard changes*/}
    }
    
    

    Lays Rodrigues
    Newby on Qt - Learning always!
    Using QT 5.7
    ArchLinux

    1 Reply Last reply
    1
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 22 Oct 2016, 05:59 last edited by
      #2

      @Lays147 The docs says:

      ... and Dialog will attempt to size itself to fit the content and the buttons.

      So it tries to do so but I guess it might fail too.
      Also you have not specified width and height for its child TabView. Try specifying one so that Dialog may be resized to that size.
      Making TabView child of contentItem will solve out the problem but removes the buttons too. You can create those in your code.

      157

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Lays147
        wrote on 22 Oct 2016, 11:50 last edited by
        #3

        @p3c0 I already tried to set width and height in all ways that I could imagine, and don't work. :(

        Lays Rodrigues
        Newby on Qt - Learning always!
        Using QT 5.7
        ArchLinux

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Lays147
          wrote on 22 Oct 2016, 11:57 last edited by
          #4

          Also, contentItem dont solve the problem, already tried that. I already tried everything that I know, but the dialog continues to trigger in a small size.
          Im thinking in abandon that and do a dialog by myself using rectangle and see what happens.

          Lays Rodrigues
          Newby on Qt - Learning always!
          Using QT 5.7
          ArchLinux

          1 Reply Last reply
          0
          • P Offline
            P Offline
            p3c0
            Moderators
            wrote on 22 Oct 2016, 11:59 last edited by
            #5

            @Lays147 Make TabView child of Dialog's contentItem. Set its implicitWidth and implicitHeight. Try this:

            Dialog {
                id: printerSettingsDialog
                visible: true
                title: qsTr("General Settings")
                standardButtons: StandardButton.Save | StandardButton.Cancel
            
                contentItem: TabView {
                    id: tabs
                    implicitWidth: 800
                    implicitHeight: 400
            
                    Tab {
                        id: bedSettings
                        title: qsTr("Bed:")
            
                    }
                    Tab {
                        id: extruderSettings
                        title: qsTr("HotEnd:")
            
                    }
                } //End TabView
            }
            

            Then add your own buttons.

            157

            1 Reply Last reply
            0

            1/5

            22 Oct 2016, 01:12

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved