Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to add a simple directory
Forum Updated to NodeBB v4.3 + New Features

How to add a simple directory

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 620 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.
  • R Offline
    R Offline
    RobM
    wrote on 16 Jul 2019, 16:51 last edited by
    #1

    In the basic virtualKeyboard example there is a directory called content. How would I add a directory like that to my own basic Qt project?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 16 Jul 2019, 17:52 last edited by
      #2

      Hi,

      What would be in that directory ?
      How would you be using it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply 16 Jul 2019, 18:48
      0
      • S SGaist
        16 Jul 2019, 17:52

        Hi,

        What would be in that directory ?
        How would you be using it ?

        R Offline
        R Offline
        RobM
        wrote on 16 Jul 2019, 18:48 last edited by RobM
        #3

        @SGaist In a similar manner to how its used in the keyboard example. I will be importing it into a qml script s/t I can access the qml scripts and their methods. Essentially, I have figured out how I want my keyboard to work:

        Window
        {
            id: window
            visible: true
            width: 640
            height: 480
            title: qsTr("Hello World")
        
            TextInput
            {
                id:inputItem
                anchors.centerIn: parent
                height: 55
                width: 120
                text: "Enter text here"
        
                onActiveFocusChanged: if(activeFocus) inputPanelContainer.textDisplay = inputItem.text
        
                onDisplayTextChanged: {
                    inputPanelContainer.textDisplay = text
                }
            }
        
            Item
            {
                id:inputPanelContainer
                z: 99
                x: 0
                y: window.height
                width: window.width
                height: childrenRect.height
                property string textDisplay:""
        
                Rectangle
                {
                    anchors.top: parent.top
                    width: parent.width
                    height: startText.height
                    color: "lightgrey"
                }
        
                Text
                {
                    id:startText
                    text:inputPanelContainer.textDisplay
                    anchors{
                        top:parent.top
                        horizontalCenter: parent.horizontalCenter
                    }
                }
        
                InputPanel
                {
                    id: inputPanel
                    z: 99
                    x: 0
                    anchors.top: startText.bottom
                    width: inputPanelContainer.width
                }
        
                states: State
                {
                    name: "visible"
                    when: inputPanel.active
        
                    PropertyChanges
                    {
                        target: inputPanelContainer
                        y: window.height - (inputPanelContainer.height + startText.height)
                    }
                }
                transitions: Transition
                {
                    from: ""
                    to: "visible"
                    reversible: true
        
                    ParallelAnimation
                    {
        
                        NumberAnimation
                        {
                            properties: "y"
                            duration: 250
                            easing.type: Easing.InOutQuad
                        }
                    }
                }
            }
        }
        
        

        now I am trying to figure out a way to break this code up s/t I can call the keyboard anywhere within my program with a simple call to TextInput.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 16 Jul 2019, 19:29 last edited by
          #4

          It's just a folder to store files. Take a look at the .qrc file. You'll see them listed there.

          You can use a folder with a more suitable name for your project.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          R 2 Replies Last reply 16 Jul 2019, 20:12
          0
          • S SGaist
            16 Jul 2019, 19:29

            It's just a folder to store files. Take a look at the .qrc file. You'll see them listed there.

            You can use a folder with a more suitable name for your project.

            R Offline
            R Offline
            RobM
            wrote on 16 Jul 2019, 20:12 last edited by RobM
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • S SGaist
              16 Jul 2019, 19:29

              It's just a folder to store files. Take a look at the .qrc file. You'll see them listed there.

              You can use a folder with a more suitable name for your project.

              R Offline
              R Offline
              RobM
              wrote on 16 Jul 2019, 20:33 last edited by RobM
              #6

              @SGaist Here is my .qrc:

              <RCC>
                  <qresource prefix="/">
              	<file>content/TextField.qml</file>
                      <file>main.qml</file>
                  </qresource>
              </RCC>
              

              I created a folder inside of my project called Testing and named it content. I added the file TextField.qml inside that directory then I added this line to the .qrc:

              <file>content/TextField.qml</file>
              

              however; when I try to open the TextField.qml file inside of the IDE throws up a popup window that says:

              Could not open "/home/rob/Testing/content/TextField.qml" for reading. Either the file does not exist or you do not have the permissions to open it.
              

              what am I doing wrong here. I don't want a simple file I want a folder. I tried adding:

              OTHER_FILES += \
                  content/TextArea.qml \
              

              to my .pro and then compiling and it throws an issue:

              :-1: error: No rule to make target '../Testing/content/TextField.qml', needed by 'qrc_qml.cpp'.  Stop.
              
              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 16 Jul 2019, 20:47 last edited by
                #7

                Do you mean you have something like:

                yourproject.pro
                somename.qrc
                Testing/content/TextArea.qml
                

                ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                R 1 Reply Last reply 17 Jul 2019, 15:14
                0
                • S SGaist
                  16 Jul 2019, 20:47

                  Do you mean you have something like:

                  yourproject.pro
                  somename.qrc
                  Testing/content/TextArea.qml
                  

                  ?

                  R Offline
                  R Offline
                  RobM
                  wrote on 17 Jul 2019, 15:14 last edited by
                  #8

                  @SGaist It was a permissions problem, sorry to bother you.

                  1 Reply Last reply
                  0

                  1/8

                  16 Jul 2019, 16:51

                  • Login

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