Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Qt4 - select row in QTreeView [Solved]

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
2 posts • Page 1 of 1
Author
Message
pops45042
Apprentice
Apprentice
User avatar
Posts: 278
Joined: Wed Jan 07, 2004 3:27 am
Location: Cincinnati, Ohio

Qt4 - select row in QTreeView [Solved]

  • Quote

Post by pops45042 » Fri Dec 22, 2006 4:46 pm

How in the world to I select an entire row given a QTreeView item. Its already got a data model associated with it. I can select the first item in the first column by doing:

Code: Select all

   QItemSelectionModel *selection = new QItemSelectionModel( qTV->model() );
   QModelIndex index = qTV->model()->index(0,0, QModelIndex() );
   selection->select(index, QItemSelectionModel::Select);
   qTV->setSelectionModel( selection);
I couldn't find a "row" selection and I don't know how many columns the view will contain.

any ideas,
Paul
Last edited by pops45042 on Fri Dec 22, 2006 5:43 pm, edited 1 time in total.
"That which does not kill me only postpones the inevitable"

Laugh at my old system!
AMD Opteron 165@ 2750Mhz, 2gig 400mhz Cas2 Crucial Ballistix, Abit NF8 Ultra MB, WD 80gig (system), WD 120gig (storage), Geforce 8800GTS 320MB, Mushkin 550W PS
Top
pops45042
Apprentice
Apprentice
User avatar
Posts: 278
Joined: Wed Jan 07, 2004 3:27 am
Location: Cincinnati, Ohio

  • Quote

Post by pops45042 » Fri Dec 22, 2006 5:43 pm

ok, I got it.

Code: Select all

QItemSelectionModel *selection = new QItemSelectionModel( qTV->model() );
QModelIndex index;
for (int col=0; col< qTV->model()->columnCount(); col++)
{
   index = qTV->model()->index(0,col, QModelIndex() );
   selection->select(index, QItemSelectionModel::Select);
}
qTV->setSelectionModel( selection);
Not exactly as simple as I had hoped.
Paul
"That which does not kill me only postpones the inevitable"

Laugh at my old system!
AMD Opteron 165@ 2750Mhz, 2gig 400mhz Cas2 Crucial Ballistix, Abit NF8 Ultra MB, WD 80gig (system), WD 120gig (storage), Geforce 8800GTS 320MB, Mushkin 550W PS
Top
Post Reply

2 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic