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. Trouble implementing back end functionality to UI
Forum Updated to NodeBB v4.3 + New Features

Trouble implementing back end functionality to UI

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 1.8k Views 3 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.
  • B Offline
    B Offline
    bdandans
    wrote on last edited by
    #1

    I've coded the UI and have it set up as attached at the bottom of the post, and I was wondering how I'd go about implementing my prewritten back end code to the UI. I don't know how storing form information would work and how variables work. Any pointers to where to go next?

    I have basic knowledge of signals and slots but I'm not sure where to go with it.

    ui screenshot

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bdandans
      wrote on last edited by
      #2

      Im thinking that this is the way to go. The next button should have multiple connections that sets the inputs to their respective variables all at once when clicked
      i.e.

      QObject::connect(nextButton, SIGNAL(clicked(bool)), 
                       nameInput, SLOT(nameInput = nameLineEdit));
      QObject::connect(nextButton, SIGNAL(clicked(bool)), 
                       heightInput, SLOT(heightInput = heightBox));
      QObject::connect(nextButton, SIGNAL(clicked(bool)), 
                       widthInput, SLOT(widthInput = widthBox));
      etc
      

      Either way, my knowledge of how to set and instantiate these variables, and then manipulate them in Qt is lacking at the moment.

      Manipulating them would probably require plugging them all into a function which I also don't know how to do with Qt.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        What is the workflow of your application ? Currently it looks like a QWizard.

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

        B 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          What is the workflow of your application ? Currently it looks like a QWizard.

          B Offline
          B Offline
          bdandans
          wrote on last edited by
          #4

          @SGaist
          Thanks for the welcome!
          I actually currently only have this page built as a series of widgets in a QTabWidget. I feel like if I were to progress forward, it'd probably need to be reimplemented into a QWizard right?

          mrjjM 1 Reply Last reply
          0
          • B bdandans

            @SGaist
            Thanks for the welcome!
            I actually currently only have this page built as a series of widgets in a QTabWidget. I feel like if I were to progress forward, it'd probably need to be reimplemented into a QWizard right?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @bdandans
            Hi
            Its unclear to me what you are really asking ?

            To save the values before going to next page,
            you can simply take them via the UI ?
            (pseudo code)
            QString name = ui->nameWidget->text()
            QDateTime date= ui->TimeDateWidget->?
            int Height = ui->heightWidget->Text().toInt();
            ....

            Also if this really is a Wizard Design, then using QWizard as @SGaist
            suggest - might save u time.

            ( QStackedWidget also very good for pages)

            B 1 Reply Last reply
            3
            • mrjjM mrjj

              @bdandans
              Hi
              Its unclear to me what you are really asking ?

              To save the values before going to next page,
              you can simply take them via the UI ?
              (pseudo code)
              QString name = ui->nameWidget->text()
              QDateTime date= ui->TimeDateWidget->?
              int Height = ui->heightWidget->Text().toInt();
              ....

              Also if this really is a Wizard Design, then using QWizard as @SGaist
              suggest - might save u time.

              ( QStackedWidget also very good for pages)

              B Offline
              B Offline
              bdandans
              wrote on last edited by
              #6

              @mrjj said in Trouble implementing back end functionality to UI:

              So for example, when you write

              QString name = nameEdit->text();
              

              Doesn't that set it to whatever's in the box at the time, which is nothing initially?

              How do I make that assignment once the user has finished filling the form?

              jsulmJ 1 Reply Last reply
              0
              • B bdandans

                @mrjj said in Trouble implementing back end functionality to UI:

                So for example, when you write

                QString name = nameEdit->text();
                

                Doesn't that set it to whatever's in the box at the time, which is nothing initially?

                How do I make that assignment once the user has finished filling the form?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by jsulm
                #7

                @bdandans said in Trouble implementing back end functionality to UI:

                Doesn't that set it to whatever's in the box at the time, which is nothing initially?

                Yes, what else should it set? Just do it when it is needed (for example when the user clicks Next button).

                How do I make that assignment once the user has finished filling the form?

                Connect a slot to the Next button and do it there.

                From your first post:

                QObject::connect(nextButton, SIGNAL(clicked(bool)), 
                                 nameInput, SLOT(nameInput = nameLineEdit));
                QObject::connect(nextButton, SIGNAL(clicked(bool)), 
                                 heightInput, SLOT(heightInput = heightBox));
                QObject::connect(nextButton, SIGNAL(clicked(bool)), 
                                 widthInput, SLOT(widthInput = widthBox));
                

                this is invalid code. Please read http://doc.qt.io/qt-5.9/signalsandslots.html
                It should look like this:

                QObject::connect(nextButton, SIGNAL(clicked(bool)), 
                                 this, SLOT(nextClicked()));
                
                void MainWindow::nextClicked()
                {
                    // Read here the values
                }
                

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                3

                • Login

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