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. [Solved] Question regarding making a custom Pop Up window
Forum Updated to NodeBB v4.3 + New Features

[Solved] Question regarding making a custom Pop Up window

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.7k 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.
  • M Offline
    M Offline
    mozeni
    wrote on last edited by
    #1

    Hello,

    As the title points out, I'm trying to make a pop up window such that originally the mousearea is a small square rectangle object and when it is clicked upon, the rectangle object will resize to fit a list of 'settings'.
    This is what I have so far:
    @//HomeScreen.qml
    import QtQuick 2.0

    Rectangle {
    id: settingsButton
    height: parent.height0.05; width: parent.height0.05
    x: parent.height0.01; y: bar.height1.2
    radius: 10
    gradient: Gradient {
    GradientStop {position: 0.5; color: "black"}
    GradientStop {position: 1.0; color: "gray" }
    }
    Image {
    id: svg
    x: bgImage.width0.0001; y: bgImage.height0.001
    width: bar.height1.7; height: bar.height1.7
    source: "../../layout/buttons/settings.svg"
    }
    MouseArea {
    anchors.fill: parent
    onClicked: {
    settingsButton.width = bar.width0.2
    settingsButton.height = bar.width
    0.2
    }
    }
    }@

    I have also created a seperate QML file for the menu list:

    @//SettingsMenu.qml
    import QtQuick 2.0

    Column {
    anchors.centerIn: parent
    spacing: 2
    Rectangle {
    Text {
    text: "Reset";font.pointSize:10; anchors.centerIn: parent;
    MouseArea {anchors.fill: parent; onClicked: console.log("Resetting")}
    }
    }
    Rectangle {
    Text { text: "Hi";font.pointSize:10; anchors.centerIn: parent }
    }
    }
    @

    The problem I'm having is how to make the MouseArea within my Rectangle in HomeScreen.qml create the QML file SettingsMenu.qml and resize the Rectangle to fit the contents of SettingsMenu.qml

    1 Reply Last reply
    0
    • shavS Offline
      shavS Offline
      shav
      wrote on last edited by
      #2

      [quote author="mozeni" date="1394910894"]
      The problem I'm having is how to make the MouseArea within my Rectangle in HomeScreen.qml create the QML file SettingsMenu.qml and resize the Rectangle to fit the contents of SettingsMenu.qml
      [/quote]

      Hi,

      As I understand you want to load SettingsMenu.qml in HomeScreen.qml and resize it, right? If so, you can use "Loader":http://qt-project.org/doc/qt-5/qml-qtquick-loader.html to do this.

      In you case MouseArea in HomeScreen.qml can looks like:
      @
      import QtQuick 2.0

      Rectangle {
      id: settingsButton
      height: parent.height0.05; width: parent.height0.05
      x: parent.height0.01; y: bar.height1.2
      radius: 10
      gradient: Gradient {
      GradientStop {position: 0.5; color: "black"}
      GradientStop {position: 1.0; color: "gray" }
      }
      Image {
      id: svg
      x: bgImage.width0.0001; y: bgImage.height0.001
      width: bar.height1.7; height: bar.height1.7
      source: "../../layout/buttons/settings.svg"
      }
      MouseArea {
      anchors.fill: parent
      onClicked: {
      settingsButton.width = bar.width0.2
      settingsButton.height = bar.width
      0.2
      loadSettings.setSource("SettingsMenu.qml");
      }
      }

          Loader {
                  id: loadSettings
                  anchors.fill: parent
          }
      }
      

      @

      The loader create and load SettingsMenu.qml as part of HomeScreen.qml.

      Mac OS and iOS Developer

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mozeni
        wrote on last edited by
        #3

        Not exactly but, I have figured it out xD

        Thanks for trying to help out :)

        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