Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Advice about the application I will be making? (I'm a beginner)
Forum Updated to NodeBB v4.3 + New Features

Advice about the application I will be making? (I'm a beginner)

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
77 Posts 6 Posters 23.1k Views 2 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
    mrjj
    Lifetime Qt Champion
    wrote on 20 Apr 2019, 14:52 last edited by
    #2

    Hi
    well, first you should consider what data that makes up a question/quiz item.
    Im just assuming here as i don't know what the quiz is about.
    Let say we have a Question that can have a title and 2 or more answers and
    maybe also a category.
    The first step would be to define a structure to hold this information
    like
    struct Question {
    QString Title;
    QStringList Answers;
    QString Category;
    }

    That we would keep in a list
    QList<Question> AllQuestions.

    so we can take them from there to show on screen.

    To help more, can you please tell a bit about how it should work ?
    shall it select random questions from all categories or keep track of which one
    already been used etc.

    • Write a list of how it should work.
      Not so much how you wil code it, just the requirements for the app.
      I assume you also need to load questions from file ?

    Im not sure you really need 60 pages as we could also just show one or more
    questions at a time and when we press Next, simply load new ones. (from the list)

    1 Reply Last reply
    3
    • D Offline
      D Offline
      dvlpr.bernard
      wrote on 20 Apr 2019, 15:40 last edited by
      #3
      This post is deleted!
      1 Reply Last reply
      1
      • D Offline
        D Offline
        dvlpr.bernard
        wrote on 20 Apr 2019, 15:56 last edited by
        #4

        I have no idea how I'm going to handle an enormous amount of data. Each Topic has 3 difficulty level with 5 questions each. To sum it up, the total of questions are 75.

        Can I use Stack Widget in QT Widget Application for this app or is there any other way of doing this? Please let me know :)

        Thanks in advance.

        M 1 Reply Last reply 20 Apr 2019, 16:06
        1
        • D dvlpr.bernard
          20 Apr 2019, 15:56

          I have no idea how I'm going to handle an enormous amount of data. Each Topic has 3 difficulty level with 5 questions each. To sum it up, the total of questions are 75.

          Can I use Stack Widget in QT Widget Application for this app or is there any other way of doing this? Please let me know :)

          Thanks in advance.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 20 Apr 2019, 16:06 last edited by mrjj
          #5

          @dvlpr.bernard
          Hi
          QStackWidget will fit pretty fine for the pages with Topic/Level/num questions.
          Notice that Widgets can be styled (much like css for web)
          and you can build the ap first using the normal look and after apply a stylesheet to get the exact look.
          https://doc.qt.io/qt-5/stylesheet-reference.html

          The wrong / Correct answer could be a QDialog subclass that pops over the Stacked.

          If you come from web/html side, are you used to databases ?
          This would fit nicely to store the categories and questions in sqllite db.
          Qt has great support for it. However, this requires you to know SQL somewhat.

          Btw: do you want to make this a phone app ?

          D 1 Reply Last reply 20 Apr 2019, 16:21
          4
          • M mrjj
            20 Apr 2019, 16:06

            @dvlpr.bernard
            Hi
            QStackWidget will fit pretty fine for the pages with Topic/Level/num questions.
            Notice that Widgets can be styled (much like css for web)
            and you can build the ap first using the normal look and after apply a stylesheet to get the exact look.
            https://doc.qt.io/qt-5/stylesheet-reference.html

            The wrong / Correct answer could be a QDialog subclass that pops over the Stacked.

            If you come from web/html side, are you used to databases ?
            This would fit nicely to store the categories and questions in sqllite db.
            Qt has great support for it. However, this requires you to know SQL somewhat.

            Btw: do you want to make this a phone app ?

            D Offline
            D Offline
            dvlpr.bernard
            wrote on 20 Apr 2019, 16:21 last edited by
            #6

            @mrjj
            Uhmmm. Yes, I did recognize that stylesheet it's kinda like css or maybe it is a true css.
            I'll take note of that QDialog.

            No, I had not used a database before and sqlite sounds interesting to me. Is it the key to manage my data? I'll take note of that.

            Yes, it is for a phone. Thank you again for your response :)

            M 1 Reply Last reply 20 Apr 2019, 16:31
            0
            • D dvlpr.bernard
              20 Apr 2019, 16:21

              @mrjj
              Uhmmm. Yes, I did recognize that stylesheet it's kinda like css or maybe it is a true css.
              I'll take note of that QDialog.

              No, I had not used a database before and sqlite sounds interesting to me. Is it the key to manage my data? I'll take note of that.

              Yes, it is for a phone. Thank you again for your response :)

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 20 Apr 2019, 16:31 last edited by
              #7

              @dvlpr.bernard
              ah. well while QWidgets are also fine for phone apps, there is also QML
              https://doc.qt.io/qt-5/qtqml-index.html
              Which was designed for the mobile generation.
              It allows much freedom in look and fell and are fully touch enabled and optimized for mobile usage.
              It is however, very different from c++.

              I suggest you try it out and see if that would not be a better fit.
              https://qmlbook.github.io/

              some c++ might be needed to create the data backend.

              But much of the logic will be javascript.

              D 1 Reply Last reply 20 Apr 2019, 16:41
              3
              • M mrjj
                20 Apr 2019, 16:31

                @dvlpr.bernard
                ah. well while QWidgets are also fine for phone apps, there is also QML
                https://doc.qt.io/qt-5/qtqml-index.html
                Which was designed for the mobile generation.
                It allows much freedom in look and fell and are fully touch enabled and optimized for mobile usage.
                It is however, very different from c++.

                I suggest you try it out and see if that would not be a better fit.
                https://qmlbook.github.io/

                some c++ might be needed to create the data backend.

                But much of the logic will be javascript.

                D Offline
                D Offline
                dvlpr.bernard
                wrote on 20 Apr 2019, 16:41 last edited by
                #8

                @mrjj
                I see. Is there a touch-enabled for QT Widget Application? Or the user wouldn't be able to feel that it is made for mobile and not for desktop?

                I actually have no time to learn many things because of the deadline. Less than a month it will be presented in our school so what do you think is the best cave to go in to?

                M 1 Reply Last reply 20 Apr 2019, 17:08
                0
                • D dvlpr.bernard
                  20 Apr 2019, 16:41

                  @mrjj
                  I see. Is there a touch-enabled for QT Widget Application? Or the user wouldn't be able to feel that it is made for mobile and not for desktop?

                  I actually have no time to learn many things because of the deadline. Less than a month it will be presented in our school so what do you think is the best cave to go in to?

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 20 Apr 2019, 17:08 last edited by
                  #9

                  @dvlpr.bernard
                  hi
                  Well QWidgets does support touch to some degree. Like clicking/pressing,
                  but not so much slide/swipe and the other normal mobile gestures.
                  Also scrollbars and the like are default too small to use. (but its fixable)

                  Well if you know javascript besides c++ then QML is pretty smooth.
                  If you have not worked with javascript and c++ is more your thing, i would
                  go with QWidgets.

                  That said. If you know web development, have you considered a browser-based solution?

                  What is your main programming language ?

                  1 Reply Last reply
                  4
                  • D Offline
                    D Offline
                    dvlpr.bernard
                    wrote on 20 Apr 2019, 19:22 last edited by
                    #10

                    I will consider looking at QML. QWidget was my first choice for now.

                    My main programming language is C++. I have not done any javascript before. And I probably don't wanna go with browser-based solution because the required language for our project is c++.

                    M 1 Reply Last reply 20 Apr 2019, 21:42
                    0
                    • D dvlpr.bernard
                      20 Apr 2019, 19:22

                      I will consider looking at QML. QWidget was my first choice for now.

                      My main programming language is C++. I have not done any javascript before. And I probably don't wanna go with browser-based solution because the required language for our project is c++.

                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 20 Apr 2019, 21:42 last edited by
                      #11

                      @dvlpr.bernard
                      Ok, c++ it is.
                      The Stacked widget should work fine.
                      However, regarding the sqllite database. Im not sure its worth digging into
                      SQL for mere 75 questions.
                      You could just as easy store it in a text file or for a bit more structure use JSON which
                      Qt has direct support for.

                      D 4 Replies Last reply 21 Apr 2019, 01:16
                      4
                      • M mrjj
                        20 Apr 2019, 21:42

                        @dvlpr.bernard
                        Ok, c++ it is.
                        The Stacked widget should work fine.
                        However, regarding the sqllite database. Im not sure its worth digging into
                        SQL for mere 75 questions.
                        You could just as easy store it in a text file or for a bit more structure use JSON which
                        Qt has direct support for.

                        D Offline
                        D Offline
                        dvlpr.bernard
                        wrote on 21 Apr 2019, 01:16 last edited by
                        #12

                        @mrjj
                        Sorry but, can you Elaborate? I don't need SQLite because JSON could do the work for me?
                        Thank you :)

                        1 Reply Last reply
                        0
                        • M mrjj
                          20 Apr 2019, 21:42

                          @dvlpr.bernard
                          Ok, c++ it is.
                          The Stacked widget should work fine.
                          However, regarding the sqllite database. Im not sure its worth digging into
                          SQL for mere 75 questions.
                          You could just as easy store it in a text file or for a bit more structure use JSON which
                          Qt has direct support for.

                          D Offline
                          D Offline
                          dvlpr.bernard
                          wrote on 21 Apr 2019, 01:41 last edited by
                          #13

                          @mrjj
                          Hi. I will try to learn QML. What do you think is the best fit for my app the QT Quick Application - Stack or QT Quick Application - Swipe?
                          And what are the best resources to learn it out there?

                          Thank you again in advance :)

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            dvlpr.bernard
                            wrote on 21 Apr 2019, 03:13 last edited by
                            #14

                            QML seems pretty gorgeous with the user interface. But how am I'm going to work with the back-end kinda stuff??

                            1 Reply Last reply
                            0
                            • M mrjj
                              20 Apr 2019, 21:42

                              @dvlpr.bernard
                              Ok, c++ it is.
                              The Stacked widget should work fine.
                              However, regarding the sqllite database. Im not sure its worth digging into
                              SQL for mere 75 questions.
                              You could just as easy store it in a text file or for a bit more structure use JSON which
                              Qt has direct support for.

                              D Offline
                              D Offline
                              dvlpr.bernard
                              wrote on 21 Apr 2019, 03:17 last edited by
                              #15

                              @mrjj
                              If Javascript is the language for QML then that would be bad because the required languange for the app is c++.

                              K 1 Reply Last reply 21 Apr 2019, 03:26
                              0
                              • D dvlpr.bernard
                                21 Apr 2019, 03:17

                                @mrjj
                                If Javascript is the language for QML then that would be bad because the required languange for the app is c++.

                                K Offline
                                K Offline
                                KillerSmath
                                wrote on 21 Apr 2019, 03:26 last edited by
                                #16

                                @dvlpr.bernard
                                You could write the backend on c++ and expose an object from C++ to QML.
                                https://doc.qt.io/qt-5/qtqml-cppintegration-contextproperties.html
                                https://doc.qt.io/qt-5/qtqml-cppintegration-exposecppattributes.html.

                                @Computer Science Student - Brazil
                                Web Developer and Researcher
                                “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

                                1 Reply Last reply
                                5
                                • M mrjj
                                  20 Apr 2019, 21:42

                                  @dvlpr.bernard
                                  Ok, c++ it is.
                                  The Stacked widget should work fine.
                                  However, regarding the sqllite database. Im not sure its worth digging into
                                  SQL for mere 75 questions.
                                  You could just as easy store it in a text file or for a bit more structure use JSON which
                                  Qt has direct support for.

                                  D Offline
                                  D Offline
                                  dvlpr.bernard
                                  wrote on 21 Apr 2019, 14:20 last edited by
                                  #17

                                  @mrjj Good day sir!

                                  I was just wondering how am I going to present the data? Should I store all the interface in one Stack Widget or do I need another window or another Stack Widget? :)

                                  And also I consider looking at SQLite. Where would I store the questions kinda thing or the output to compare to the user input? Thank you again in advance :)
                                  0_1555859866247_0c9e3a4f-a3af-45bd-8af3-b4e50e870d9c-image.png

                                  K 1 Reply Last reply 21 Apr 2019, 22:29
                                  0
                                  • D Offline
                                    D Offline
                                    dvlpr.bernard
                                    wrote on 21 Apr 2019, 14:43 last edited by
                                    #18

                                    Or it should look like these?
                                    What are the things I need to consider :)

                                    0_1555861384574_636d3370-b62b-4ed1-9b49-cdc8e65c107e-image.png

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on 21 Apr 2019, 21:47 last edited by
                                      #19

                                      Hi
                                      Last table looks ok. I assume then all question is a topic and the answer is some
                                      text. No mutiple choice or anything like that ?

                                      Since we will have few questions (75) its ok to include the difficult_level
                                      as text. If we were to have thousands of questions, it would be better to have a table for the texts ( Beginner, Average etc) and reference it from Question table.
                                      However, we just directly included it here for simplicity.

                                      Next step could be to try use table in Qt
                                      https://doc.qt.io/qt-5/qtsql-index.html
                                      https://katecpp.wordpress.com/2015/08/28/sqlite-with-qt/

                                      Things to consider:
                                      Define the operations you need, like
                                      select questions from a diff_level
                                      keeping track of already used questions (if needed ?)

                                      D 1 Reply Last reply 22 Apr 2019, 15:34
                                      6
                                      • D dvlpr.bernard
                                        21 Apr 2019, 14:20

                                        @mrjj Good day sir!

                                        I was just wondering how am I going to present the data? Should I store all the interface in one Stack Widget or do I need another window or another Stack Widget? :)

                                        And also I consider looking at SQLite. Where would I store the questions kinda thing or the output to compare to the user input? Thank you again in advance :)
                                        0_1555859866247_0c9e3a4f-a3af-45bd-8af3-b4e50e870d9c-image.png

                                        K Offline
                                        K Offline
                                        KillerSmath
                                        wrote on 21 Apr 2019, 22:29 last edited by
                                        #20

                                        I was just wondering how am I going to present the data? Should I store all the interface in one Stack Widget or do I need another window or another Stack Widget? :)

                                        I suppose you pretent to use QML. So you can store the data in a model and display components on window depending of your data.

                                        Swipe View
                                        Stack View

                                        Below is a idea of how you could to implement it with Swipe View (No Interative Mode)

                                        // Qt 5.11
                                        import QtQuick 2.11
                                        import QtQuick.Window 2.11
                                        import QtQuick.Controls 2.2
                                        import QtQuick.Layouts 1.11
                                        
                                        Window {
                                            visible: true
                                            width: 640
                                            height: 480
                                            title: qsTr("Hello World")
                                        
                                            ListModel{
                                                id: databaseModel
                                                ListElement{
                                                    topic: "While Loop"
                                                    dificulty: 3
                                                    question_num: 3
                                                    question_text: "While Loop 3,3"
                                                }
                                        
                                                ListElement{
                                                    topic: "While Loop"
                                                    dificulty: 3
                                                    question_num: 4
                                                    question_text: "While Loop 3,4"
                                                }
                                            }
                                        
                                            SwipeView {
                                                id: view
                                                anchors.fill: parent
                                                anchors.bottomMargin: 20
                                                interactive: false
                                                currentIndex: pageIndicator.currentIndex
                                                Repeater {
                                                    model: databaseModel
                                                    Loader {
                                                        active: SwipeView.isCurrentItem || SwipeView.isNextItem || SwipeView.isPreviousItem
                                                        sourceComponent: Page{
                                                            Rectangle{
                                                                width: view.width / 2
                                                                height: view.height / 2
                                                                color: "white"
                                                                anchors.centerIn: parent
                                        
                                                                Text{
                                                                    anchors.centerIn: parent
                                                                    text: "Question: " + model.question_text
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        
                                            PageIndicator {
                                                id: pageIndicator
                                                count: databaseModel.count
                                                interactive: true
                                                currentIndex: 0
                                                anchors.bottom: parent.bottom
                                                anchors.horizontalCenter: parent.horizontalCenter
                                        
                                            }
                                        
                                        }
                                        

                                        Note: the listModel (Data) and Game Logic can be implemented from c++.

                                        And also I consider looking at SQLite. Where would I store the questions kinda thing or the output to compare to the user input? Thank you again in advance :)

                                        Firstly, it may be implement of several ways...
                                        You can insert a Json text with correct_answer index and answers.
                                        Or create an array of text and correct_answer field (i'm not sure how it could be implemented).

                                        Json Example:

                                        {
                                           "correct_answer": 0,
                                           "answers": [
                                              "Answer 1",
                                              "Answer 2",
                                              "Answer 3"
                                           ]
                                        }
                                        

                                        Also, the difficulty_level don't need to be a string field. You can storage an intenger number 1-3 and interpret it in your app. 1 -> Beginner, 2 -> Intermediate.

                                        I recommend you to read these materials to understand the Relational Database Concepts:
                                        Telvents - RDBMS Concepts
                                        TutorialsPoint - RDBMS Concepts

                                        @Computer Science Student - Brazil
                                        Web Developer and Researcher
                                        “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

                                        D 1 Reply Last reply 22 Apr 2019, 15:53
                                        2
                                        • M mrjj
                                          21 Apr 2019, 21:47

                                          Hi
                                          Last table looks ok. I assume then all question is a topic and the answer is some
                                          text. No mutiple choice or anything like that ?

                                          Since we will have few questions (75) its ok to include the difficult_level
                                          as text. If we were to have thousands of questions, it would be better to have a table for the texts ( Beginner, Average etc) and reference it from Question table.
                                          However, we just directly included it here for simplicity.

                                          Next step could be to try use table in Qt
                                          https://doc.qt.io/qt-5/qtsql-index.html
                                          https://katecpp.wordpress.com/2015/08/28/sqlite-with-qt/

                                          Things to consider:
                                          Define the operations you need, like
                                          select questions from a diff_level
                                          keeping track of already used questions (if needed ?)

                                          D Offline
                                          D Offline
                                          dvlpr.bernard
                                          wrote on 22 Apr 2019, 15:34 last edited by
                                          #21

                                          @mrjj
                                          Good day!
                                          Yes, there is no multiple choice included. The user is required to type the output of the set of code that will be displayed.

                                          As of now, this is how I visualize the logic or the structure of the app (Please let me know if there are some weaknesses or if this will not gonna work or if there is a better way of doing it):

                                          1. The user will need to choose and click the button(topic name) which has the code that will declare the variable or an object(I don't know what should I use) and will store a data in it.
                                            Example: When the user click the If Statement then int Topic = 1 or string Topic = "IF";

                                          2. When the user click the Beginner button then int Dif_Lvl = 1 or string Dif_Lvl= "Beginner";

                                          3. When the user input the number and click Next button then int Number_Of_Questions = user_input;
                                            Print_Question(Topic, Dif_Lvl, Number_Of_Questions);
                                            The Print_Question function contains the query and a loop to display the next pages depending on the user topic/dif_lvl.

                                          Do I need objects and classes (not that familiar with that) or mostly I would use functions?

                                          0_1555948631684_414b12ee-58f3-411b-b62a-67e630a2173d-image.png

                                          Thanks :)

                                          1 Reply Last reply
                                          0

                                          11/77

                                          20 Apr 2019, 21:42

                                          topic:navigator.unread, 66
                                          • Login

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