[Qt-creator] single click to open files

Will Stokes wstokes at gmail.com
Wed Oct 7 16:12:33 CEST 2009


I dug through the source code and it appears changing the project tree
to open a file by single instead of double clicking is pretty easy.
Line 157 of projecttreewidget.cpp connects the view's activated signal
to the openItem slot. Instead of using activated used clicked (or
double clicked depending on a user preference), aka:

connect(m_view, SIGNAL(clicked(const QModelIndex&)),
             this, SLOT(openItem(const QModelIndex&)));

instead of:

connect(m_view, SIGNAL(activated(const QModelIndex&)),
             this, SLOT(openItem(const QModelIndex&)));

I haven't tested this change myself since I don't have Qt4.6 on my
system at this time.

-Will



More information about the Qt-creator-old mailing list