itemDoubleClicked and itemClicked
Hi,
I created a QListWidget with items.
I would to catch an event when an item is clicked and an other event when double clicked.
I did:
Quote:
connect(contextList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(setNewTabContent(QListWidgetItem*)));
connect(contextList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(setTabContent(QListWidgetItem*)));
The problem is that when I double click an item, I receive both setNewTabContent and setTabContent.
Do you have a solution for me ?
Thank you for your help !
Re: itemDoubleClicked and itemClicked
I think you should use another signal, because a double click is two... clicks!
So, you'll probably get:
Click()
Click()
DoubleClick();
most likely. So try another signal that is just as good as a click.
Re: itemDoubleClicked and itemClicked
I solve this problem using QTimer, but I think must be more elegate solution.
Re: itemDoubleClicked and itemClicked
Quote:
Originally Posted by
spirit
I solve this problem using QTimer, but I think must be more elegate solution.
I tried but without success :( Do you have an example ?
Thank you.
Re: itemDoubleClicked and itemClicked
Hi,
You can try using some other signal like void currentItemChanged ( QListWidgetItem * item ) or void currentRowChanged ( int currentRow )]
Re: itemDoubleClicked and itemClicked
if you inherit QTableView/QTreeView then I can post example, but if you don't then try another signals.
Re: itemDoubleClicked and itemClicked
How about using modifiers to distinguish between two different actions, instead of single or double clicks? For example plain click vs. control + click.
Re: itemDoubleClicked and itemClicked
Quote:
Originally Posted by
jpn
How about using modifiers to distinguish between two different actions, instead of single or double clicks? For example plain click vs. control + click.
Hi,
Yes, I would like to do something like this:
click=open in current page
ctrl+click=open in a new page
but, I don't know how to done.
Do you know how to do ?
Thank you
Re: itemDoubleClicked and itemClicked