Dear All
We have a QTableWidget and delegates for columns. Problem we have is no matter how many rows we have in the last column when we hit the tab key the cursers goes to the (0,0) of the table, Is there any way to omit that?
Printable View
Dear All
We have a QTableWidget and delegates for columns. Problem we have is no matter how many rows we have in the last column when we hit the tab key the cursers goes to the (0,0) of the table, Is there any way to omit that?
Please provide a minimal compilable example reproducing the problem, I can't reproduce it myself.
you could try this in designer,
create a qtablewidget ad some columns and rows, the last column and bottom row, it you press tab it will go to (0,0) What I want is the the curser will not move there?
Well, that is the default behavior, if the table is at the end and you press tab it jumps to the first cell. If you really want to change that, reimp keyPressEvent(), check if tab was pressed and the last cell is the current cell, if so do nothing, else call QTableView::keyPressEvent(event).
I have this for the widget
Code:
{ if(ke->key() == Qt::Key_Tab) { tableCekSenet->setTabKeyNavigation(false); return true; } }
But I wasnt able to get the message for tab2
I have just figure out someting,
Please try, create a qtablewidget with 3 row and 3 columns. When you come to 3rd row and 3 column if you double click into the cell and press tab after that you will go the 1st row and 1st column the curser will go like editing the cell, I had to avoid that? How could I do it?
how can do it?
Were you able to what I am doing?
Please check the attach, please see the 1.jpg after that when I press tab, 2.jpg occurs. What I want is in the 1.jpg when I press tab I want the curser to go on the 0,0 cell but not editing mode like picture 3 mode.
You may try providing your own item delegate that will not emit the default closeEditor() signal but will instead emit it with QAbstractItemDelegate::NoHint. See the docs for details.
dear wysota
I really dont understand what you have said
Open Assistant and type in "closeEditor" in the index tab.
Dear All
What i did is blow
Code:
while(...) editor->addItem(...); connect(editor, SIGNAL(editingFinished()), this, SLOT(commitAndCloseEditor())); return editor; } void CekSenetDelegate::commitAndCloseEditor() { emit commitData(editor); }
I never get the message zzzz
I don;t see where you set
at first. then QComboBox has not such signal editingFinished, but QLineEdit has.Code:
... editor->setEditable(true); ...
so, you should write like this:
Code:
editor->setEditable(true); while(...) editor->addItem(...); connect(editor->lineEdit(), SIGNAL(editingFinished()), this, SLOT(commitAndCloseEditor())); return editor; }