Results 1 to 4 of 4

Thread: to show Checkboxes in listview

  1. #1
    Join Date
    May 2011
    Location
    Mumbai, India
    Posts
    22
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default to show Checkboxes in listview

    hii,
    this is my code....

    Qt Code:
    1. QStringList fileTypes;
    2. fileTypes << "_*.dll" ;
    3. QDir dir("E:/qtpro/ext");
    4. dir.setNameFilters(fileTypes);
    5. QFileInfoList list = dir.entryInfoList();
    6.  
    7. //ui->textEdit->append("Bytes Filename");
    8. for (int i = 0; i < list.size(); ++i)
    9. {
    10. QFileInfo fileInfo = list.at(i);
    11.  
    12. //QString s= fileInfo.size();
    13. QString s1 = fileInfo.fileName();
    14. //s.append(s1);
    15. ui->textEdit->append(s1);*/
    To copy to clipboard, switch view to plain text mode 
    this displays the dll files in the directory in the textedit..

    now i want to display all these dlls as checkboxes in the listview...
    can any1 help me how to do this...

    i had also wrote this code for adding checkboxes in listview...bt got error...

    Qt Code:
    1. Q3ListView view(0);
    2. view.setResizeMode( Q3ListView::LastColumn );
    3. view.addColumn( "Filename" );
    4. view.show();
    5. QStringList files = dir.entryList();
    6. for( QStringList::Iterator it = files.begin(); it != files.end(); ++it)
    7. {
    8. (void)new Q3CheckListItem ( &view, *it, Q3CheckListItem::CheckBox );
    9. }
    To copy to clipboard, switch view to plain text mode 

    i got this error...:
    :: error: collect2: ld returned 1 exit status


    plz help..
    Last edited by high_flyer; 20th May 2011 at 14:09. Reason: code tags

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: to show Checkboxes in listview

    You are using Qt3Support classes.
    You need to add it to your pro file:
    QT += qt3support
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    Ketan Shah (20th May 2011)

  4. #3
    Join Date
    May 2011
    Location
    Mumbai, India
    Posts
    22
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: to show Checkboxes in listview

    and is my code is correct..???
    i had made changes in my .pro file...it worked...thanx..
    it opened d application when i run it, but gave me segmentation fault...


    Added after 4 minutes:


    and is my code is correct..???
    i had made changes in my .pro file...it worked...thanx..
    it opened d application when i run it, but gave me segmentation fault...
    Last edited by Ketan Shah; 20th May 2011 at 14:45.

  5. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: to show Checkboxes in listview

    ut gave me segmentation fault...
    run it in a debugger and see which line segfaults.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 3
    Last Post: 9th December 2010, 21:10
  2. Replies: 3
    Last Post: 12th July 2010, 13:12
  3. QTreeView and CheckBoxes
    By FreeG in forum Qt Programming
    Replies: 2
    Last Post: 9th December 2009, 09:36
  4. listview
    By addu in forum Qt Programming
    Replies: 2
    Last Post: 11th May 2009, 12:05
  5. checkboxes
    By abrou in forum Newbie
    Replies: 2
    Last Post: 1st February 2008, 18:52

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
  •  
Qt is a trademark of The Qt Company.