phill
22nd February 2012, 10:32
Hi, im relatively new to Qt, and I am using pyqt.
What I want to be able to do is to allow the user to enter data in to a QListWidget by typing. The user will type a sentence, and a list item will be created for each word.
What I have got so far, is a QListWidget set to display vertically, the user clicks on to the first and only QListWidgetItem which has "type here" in it. Clicking and typing opens the persistent editor. I use onKeyRelease to detect if the user has pressed space, and create a new QListWidgetItem. I then set this item as the selected item, so when they continue to type the text is now being entered in to the new QListWidgetItem.
What I want to do, and am having problems figuring out, is the following:
When the user presses delete, if the cursor is at the end of the persistent editor, and no text is selected, then I want to open the persistent editor on the next QListWidgetItem.
Similarly, if the user presses backspace, and the cursor is at the beginning of the persistent editor, and no text is selected, then the previous item is selected, the persistent editor opened, and the cursor moved to the end.
Is this do-able?
Any help, not just in pyqt, very much appreciated!
Phill
What I want to be able to do is to allow the user to enter data in to a QListWidget by typing. The user will type a sentence, and a list item will be created for each word.
What I have got so far, is a QListWidget set to display vertically, the user clicks on to the first and only QListWidgetItem which has "type here" in it. Clicking and typing opens the persistent editor. I use onKeyRelease to detect if the user has pressed space, and create a new QListWidgetItem. I then set this item as the selected item, so when they continue to type the text is now being entered in to the new QListWidgetItem.
What I want to do, and am having problems figuring out, is the following:
When the user presses delete, if the cursor is at the end of the persistent editor, and no text is selected, then I want to open the persistent editor on the next QListWidgetItem.
Similarly, if the user presses backspace, and the cursor is at the beginning of the persistent editor, and no text is selected, then the previous item is selected, the persistent editor opened, and the cursor moved to the end.
Is this do-able?
Any help, not just in pyqt, very much appreciated!
Phill