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 take information from form layout fields?
Forum Updated to NodeBB v4.3 + New Features

How to take information from form layout fields?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 202 Views
  • 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
    BasselOmari
    wrote on last edited by
    #1

    I have a form layout with labels and text edits made with the following script:

    QStringList keys;
            QList<int> status;
            for (int i = 0; i < 100; i++) {
                keys << QString("key %1").arg(i);
                status << i % 4;
            }
    
            QWidget *wdg = new QWidget;
            QScrollArea *scroll = new QScrollArea;
    
            QWidget *content_widget = new QWidget;
    
            QFormLayout *formLayout = new QFormLayout(content_widget);
    
            for (int x = 0; x < keys.size(); x++) {
    
                QTextEdit *field = new QTextEdit;
                field->setFixedHeight(28);
                field->setFixedWidth(100);
                formLayout->addRow(keys.at(x), field);
            }
    
            scroll->setWidget(content_widget);
            wdg->setLayout(new QVBoxLayout);
            wdg->layout()->addWidget(scroll);
            wdg->show();
    

    After having the user fill out the information, I want to be able to extract that information from each field (each QTextEdit). How would I go about doing that?

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @BasselOmari said in How to take information from form layout fields?:

      How would I go about doing that?

      Save all created textedits in a container and read them out later on.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      4

      • Login

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