[Qt-interest] QTreeWidget and double-click

Murphy, Sean M. sean.murphy at gd-ais.com
Thu Apr 2 14:36:09 CEST 2009


You've already found the signal:

  QTreeWidget::itemDoubleClicked(QTreeWidgetItem* item, int column)

Which tells you which item was double clicked on, and which column of
that item was clicked on.  For a QTreeWidgetItem there is:

  QString QTreeWidgetItem::text(int column) const

Which returns the text, then there is the QClipboard class:

  void QClipboard::setText(const QString& text, Mode mode=Clipboard)

Seems like that should do it...
Sean

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of NARCISO, Rui
Sent: Thursday, April 02, 2009 7:58 AM
To: Qt Interest (E-mail)
Subject: [Qt-interest] QTreeWidget and double-click

Hi all

I have a QTreeWidget with standart QTreeWidgetItems.
I would like that when a user double-clicks on a given item/column, that
instead of selecting the entire line onthe column gets selected and the
text within be copied so it can be pasted somewhere else (a typical
copy-paste action).

How to go about implementing this?

I already managed to connect the signal itemDoubleClicked of each item
to a specifica funtion, the part I don't know how to do it is to select
only the column and copy the data to the clipboard...

Rui


__________________________________________________ 

Rui NARCISO 
Data for Handling Qualities 
Aerodynamics Department - EDGADYT  -  M01 N368 
AIRBUS France 

Phone:  +33 (0)5 61 18 10 77 
Fax: +33 (0)5 61 93 99 80 
<Mailto:rui.narciso at airbus.com> 



The information in this e-mail is confidential. The contents may not be
disclosed or used by anyone other then the addressee. Access to this
e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately
and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness
of this e-mail as it has been sent over public networks. If you have any
concerns over the content of this message or its Accuracy or Integrity,
please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated
virus scanning software but you should take whatever measures you deem
to be appropriate to ensure that this message and any attachments are
virus free.


_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list