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. Hi evryone. How to use Scroll Area in Qt to print a QString array
Forum Updated to NodeBB v4.3 + New Features

Hi evryone. How to use Scroll Area in Qt to print a QString array

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 306 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.
  • D Offline
    D Offline
    dangquan09
    wrote on 29 Jul 2019, 14:51 last edited by
    #1

    Hi everyone,

    I am trying to understand how to use "Scroll Area" in "Containers" of Qt when designing GUIs. In my case, I have a display function which displays the data from a hash table of objects into the scroll area. Each element of the object stored at the specified index of the array is of type QString and will be printed onto the area separated by a comma and would also need to make it so that once the last element of the object (phone) is returned, the next object is printed onto the next line. I have taken a look at the documentation but haven't found anything of use for what I'm looking. I am not looking to create a parent or child since I don't understand that concept. Ideally, I would be looking for something of the sorts of ui->scrollAreaContents-> since it is simple to use. I have posted my code for the function below. Thanks in advance.

    void Database::display(){
    for(int i = 0: i < TABLESIZE; i++)
    {
    table[i]->getName();
    table[i]->getJob();
    table[i]->getVehicle();
    table[i]->getAddress();
    table[i]->getCountry();
    table[I]->getPhone();

    }
    }

    J 1 Reply Last reply 30 Jul 2019, 10:19
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 29 Jul 2019, 19:15 last edited by
      #2

      Hi and welcome to devnet,

      From the looks of it, you should rather take a at the Model View chapter of QT's documentation.

      That will allow you to do what you want in a more automated fashion.

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

      1 Reply Last reply
      3
      • D dangquan09
        29 Jul 2019, 14:51

        Hi everyone,

        I am trying to understand how to use "Scroll Area" in "Containers" of Qt when designing GUIs. In my case, I have a display function which displays the data from a hash table of objects into the scroll area. Each element of the object stored at the specified index of the array is of type QString and will be printed onto the area separated by a comma and would also need to make it so that once the last element of the object (phone) is returned, the next object is printed onto the next line. I have taken a look at the documentation but haven't found anything of use for what I'm looking. I am not looking to create a parent or child since I don't understand that concept. Ideally, I would be looking for something of the sorts of ui->scrollAreaContents-> since it is simple to use. I have posted my code for the function below. Thanks in advance.

        void Database::display(){
        for(int i = 0: i < TABLESIZE; i++)
        {
        table[i]->getName();
        table[i]->getJob();
        table[i]->getVehicle();
        table[i]->getAddress();
        table[i]->getCountry();
        table[I]->getPhone();

        }
        }

        J Offline
        J Offline
        JonB
        wrote on 30 Jul 2019, 10:19 last edited by
        #3

        @dangquan09
        How come this is character-for-character the same question as posed by @jefazo92 last week in https://forum.qt.io/topic/105380/how-to-use-scroll-area-in-qt-to-print-a-qstring-array ? I answered it there. Are you a different person who types in the same as the other user, or did you choose to ignore the answer there?

        1 Reply Last reply
        3

        3/3

        30 Jul 2019, 10:19

        • Login

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