LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-28-2014, 12:49 PM   #1
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Rep: Reputation: 43
qt creator 5 lineedit array


Hi All,
hope someone can help me with this. I'm learning QT creator 5. I have a load of line edits to fill in on a form. These are saved to an array of strings which I can save as an XML file. Right now loading and saving is a nightmare because I can't work out how to get creator to set an array of line edits so now I save as

Code:
array[ 0 ] = ui->lineedit_0->text();
...
array[ 50 ] = ui->lineedit_50->text();

and reverse for load.
What I'd like to do is a basic
Code:
for( int j= 0;j < 50; j++ )
{
    array[ j ] = ui->lineedit[ j ]->text();
}
can I do this in QT creator?
Thanks in advance.

Last edited by knobby67; 07-28-2014 at 12:50 PM.
 
Old 07-28-2014, 10:37 PM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
You can do something like the following:
Code:
QList<QLineEdit *> list = findChildren<QLineEdit *>();
foreach(QLineEdit *le, list) {
    // le->text() - output to file
    // or
    // read from file - le->setText()
}
Here's a link to a good Qt forum where you will get quicker responses: http://www.qtcentre.org/forums/4-Newbie

Also, note that the t in Qt is lower case.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DMRAID Multiple RAID10 Array Dependence + TrueCrypt Can't Access Secondary Array The00Dustin Linux - Software 0 06-24-2014 01:44 PM
BASH-Adding array element: Naming issue using array[${#array[*]}]=5 calvarado777 Programming 8 07-26-2013 09:48 PM
[SOLVED] mdadm: only give one device per ARRAY line: /dev/md/:raid and array laughing_man77 Linux - Hardware 4 03-23-2012 04:05 PM
[SOLVED] shell script help: copying directory list into an array and then accessing the array richman1234 Linux - Newbie 6 07-25-2010 11:19 PM
bash: use file as input into array, parse out other variables from array using awk beeblequix Linux - General 2 11-20-2009 10:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration