Results 1 to 7 of 7

Thread: array list!

  1. #1
    Join Date
    Jun 2009
    Posts
    44
    Qt products
    Qt4
    Platforms
    Windows

    Default array list!

    good morning!

    I have to do a list of char datas.

    The code that I'm using is:

    Qt Code:
    1. archivo::archivo(QWidget *parent)
    2. : QWidget(parent)
    3. {
    4.  
    5. QListView *list = new QListView;
    6. list<<"maider"<<"peter"<<"maider";
    7.  
    8. list->show();
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 


    why can't i see the list? In qt4 to do an array they use QVector fuction. Which function can I use in QT3?my version is: Version: 3.4.1
    Last edited by wysota; 27th July 2009 at 14:53. Reason: missing [code] tags

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: array list!

    yes i want to learn about this thing QListView
    "Behind every great fortune lies a crime" - Balzac

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: array list!

    Quote Originally Posted by maider View Post
    QListView
    I think you need QListWidget, an populate it through a QStringList. See QListWidget::addItems().

  4. #4
    Join Date
    Jun 2009
    Posts
    44
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: array list!

    why not with QListView?

    I can't do with strigs i have to do with arrays

  5. #5
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: array list!

    the problem is in
    list<<"maider"<<"peter"<<"maider";
    u have to add QString or any other in QListView as in docs
    Qt Code:
    1. newItem->setText("maider");
    2. listWidget->insertItem(row, newItem);
    To copy to clipboard, switch view to plain text mode 
    "Behind every great fortune lies a crime" - Balzac

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: array list!

    Guys, this issue is related to Qt3, not Qt4... There is no QListWidget in Qt3.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: array list!

    Quote Originally Posted by wysota View Post
    Guys, this issue is related to Qt3, not Qt4...
    Qt3, someone is still working with Qt3, my brain substitutes 4.3 (and with "Version: 3.4.1" that can happen). Ok, then:

    QListView has no << operator, you have to set up the column count and add QListViewItems. Something like that:
    Qt Code:
    1. QListView *table;
    2. table->addColumn( "Names" );
    3. new QListViewItem( table, "maider" ); // in your case loop your array...
    4. new QListViewItem( table, "Peter" );
    5. new QListViewItem( table, "maider" );
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QFtp hidden files/folder's list
    By jay in forum Qt Programming
    Replies: 1
    Last Post: 26th December 2008, 12:12
  2. Replies: 2
    Last Post: 19th September 2008, 05:21
  3. Single slot for multiple list boxes
    By Sheetal in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2008, 06:53
  4. Replies: 1
    Last Post: 22nd October 2007, 02:04
  5. QComboBox drop list button events
    By maird in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2007, 19:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.