Results 1 to 4 of 4

Thread: How can i select a row at startup

  1. #1
    Join Date
    Jan 2011
    Location
    Gordion
    Posts
    52
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How can i select a row at startup

    i want to select a treeview row at startup

    Qt Code:
    1. QModelIndex index= new QModelIndex(1,0,void ????, model);
    2. ui->treeView->setRootIndex(index);
    To copy to clipboard, switch view to plain text mode 

    i dont know how can i do it... i just want to select a row at startup... please help!!!

    Edit:

    I cant understand model/view arch. logic... i read local help files, looked at samples too...

    I can get index of the selected items, but i cant store them (in textfile or registry) Gone a be crazy...

    Also i tried to give row and coloumn numbers manually, but i cant do it. if i can select it manually on start up, my problem will be solved... Please help...


    Added after 36 minutes:


    Yep...

    Forget treeview... i solved this with using tableview... right widget for right work...thanks all..
    Last edited by kosasker; 1st February 2011 at 11:28.

  2. #2
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How can i select a row at startup

    hi,
    Qt Code:
    1. I cant understand model/view arch. logic
    To copy to clipboard, switch view to plain text mode 
    http://doc.qt.nokia.com/latest/model...ogramming.html
    pls go through this link. this is essential for qt programming.
    hope it helps
    Bala

  3. #3
    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: How can i select a row at startup

    You can't create model indexes by yourself. Only the model can create an index.

    Qt Code:
    1. QModelIndex index = model->index(1, 0); // row = 1, column = 0, top-level item (invalid parent)
    2. ui->treeView->setModel(model);
    3. ui->treeView->selectionModel()->select(index);
    To copy to clipboard, switch view to plain text mode 
    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.


  4. The following user says thank you to wysota for this useful post:

    kosasker (1st February 2011)

  5. #4
    Join Date
    Jan 2011
    Location
    Gordion
    Posts
    52
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How can i select a row at startup

    @wysota:Thank you bro

    @balaQt: i always looking first my local help. thank you too..

Similar Threads

  1. QWebView Crashes APP on Startup
    By harleyskater in forum Qt Programming
    Replies: 7
    Last Post: 6th October 2010, 14:51
  2. Qt app in linux startup
    By qtlinuxnewbie in forum Newbie
    Replies: 8
    Last Post: 2nd March 2010, 18:37
  3. Switching between console and GUI on startup
    By EricF in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 19:03
  4. How to get empty mainwidget at startup
    By Morea in forum Qt Tools
    Replies: 1
    Last Post: 10th March 2006, 22:32
  5. QToolBar go away! On startup anyway.
    By bitChanger in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2006, 18:22

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.