ljc123456gogo
4th February 2016, 03:45
Hi!
I see the document say:
----------------------------------------------------------------------------------------------------------------------------------------
void QTreeWidget::itemPressed(QTreeWidgetItem * item, int column)
This signal is emitted when the user presses a mouse button inside the widget.
The specified item is the item that was clicked, or 0 if no item was clicked. The column is the item's column that was clicked, or -1 if no item was clicked.
----------------------------------------------------------------------------------------------------------------------------------------
When I connect itemPressed to My slot void EditCurrentItem(QTreeWidgetItem* currentItem, int column):
connect(m_ui.m_TreeWidget,SIGNAL(itemPressed(QTree WidgetItem*, int)),this,SLOT(EditCurrentItem(QTreeWidgetItem*, int)));
if the item that was clicked the sinal will be emitted. But when I cancel click item(click on the blank space Inside the TreeWidget), no itemPressed be emit? I don't knowWhy.
11677
11678
the SLOT void EditCurrentItem(QTreeWidgetItem* currentItem, int column) as below:
void QuesManager::EditCurrentItem(QTreeWidgetItem* currentItem, int column)
{
if(currentItem != 0)
{
m_ui.m_Title->setText(currentItem->text(2));
m_ui.m_Ans->setText(currentItem->text(3));
}
else
{
m_ui.m_Title->setText("");
m_ui.m_Ans->setText("");
}
}
The small project had been upload to the Attachment.(My Qt version is 5.5 and using VS2010)
Thanks help me!
See Attachment:
https://github.com/ljcduo/TempAns1
I see the document say:
----------------------------------------------------------------------------------------------------------------------------------------
void QTreeWidget::itemPressed(QTreeWidgetItem * item, int column)
This signal is emitted when the user presses a mouse button inside the widget.
The specified item is the item that was clicked, or 0 if no item was clicked. The column is the item's column that was clicked, or -1 if no item was clicked.
----------------------------------------------------------------------------------------------------------------------------------------
When I connect itemPressed to My slot void EditCurrentItem(QTreeWidgetItem* currentItem, int column):
connect(m_ui.m_TreeWidget,SIGNAL(itemPressed(QTree WidgetItem*, int)),this,SLOT(EditCurrentItem(QTreeWidgetItem*, int)));
if the item that was clicked the sinal will be emitted. But when I cancel click item(click on the blank space Inside the TreeWidget), no itemPressed be emit? I don't knowWhy.
11677
11678
the SLOT void EditCurrentItem(QTreeWidgetItem* currentItem, int column) as below:
void QuesManager::EditCurrentItem(QTreeWidgetItem* currentItem, int column)
{
if(currentItem != 0)
{
m_ui.m_Title->setText(currentItem->text(2));
m_ui.m_Ans->setText(currentItem->text(3));
}
else
{
m_ui.m_Title->setText("");
m_ui.m_Ans->setText("");
}
}
The small project had been upload to the Attachment.(My Qt version is 5.5 and using VS2010)
Thanks help me!
See Attachment:
https://github.com/ljcduo/TempAns1