_contents << item;
endInsertRows();
}
+
+QString ComboBoxModel::valueOnPosition(int index)
+{
+ return _contents[index];
+}
void setSelectedItem(QString item);
void setSelectedIndex(int index);
+public Q_SLOTS:
+ QString valueOnPosition(int index);
+
private:
void setContents(QList<QString> contents);
void addItem(QString item);
QGraphicsObject *rootObject = view->rootObject();
+ view->setFocus();
+
connect(rootObject,SIGNAL(selectedRow(int)),
this,SLOT(itemClicked(int)));
setExactSearch(false);
}
}
- wordListWidget->setFocus();
+ WordListWidget* myWidget = qobject_cast<WordListWidget *>(wordListWidget);
+ myWidget->setFocusOnElement();
+// wordListWidget->setFocus();
}
bool MainWindow::checkExactSearch(
signal valueSelected(string selected);
- /* Keys.onPressed: {
- console.log("tu ----");
- if (event.key == Qt.Key_Escape)
- rectangle1.expanded=false;
- else if (event.key == Qt.Key_Space)
+ Keys.onPressed: {
+ if (event.key == Qt.Key_Space)
rectangle1.expanded=true;
- else if (event.key == Qt.Key_Return){
- rectangle1.expanded=false;
- console.log("tu enter "+list1.content);
- }
}
- */
Text {
id: text1
visible: false
property string selected: rectangle1.startValue
+ Keys.onPressed: {
+
+ if ((event.key == Qt.Key_Return || event.key == Qt.Key_Enter) && currentIndex >= 0){
+ selectedValue(currentIndex, model.valueOnPosition(currentIndex))
+ }
+ if (event.key == Qt.Key_Escape){
+ rectangle1.show(!rectangle1.expanded)
+ event.accepted = true
+ }
+ }
+
function selectedValue(nr, value) {
currentIndex = nr
selected = value
highlightResizeSpeed: 1000
Keys.onPressed: {
+ if ((currentIndex < 0 || currentIndex >= count) && (event.key == Qt.Key_Up || event.key == Qt.Key_Down)){
+ currentIndex = 0
+ }
+
if ((event.key == Qt.Key_Return || event.key == Qt.Key_Enter) && currentIndex >= 0){
itemActivated(currentIndex)
}
Rectangle {
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
color : myPalette.window;
+ function setFocus() {
+ historyList.setFocus()
+ }
signal selectedRow(int nr)
anchors.bottom: parent.bottom
anchors.top: parent.top
highlightResizeSpeed: 1000
+
+ Keys.onPressed: {
+ if ((currentIndex < 0 || currentIndex >= count) && (event.key == Qt.Key_Up || event.key == Qt.Key_Down)){
+ currentIndex = 0
+ }
+
+ if ((event.key == Qt.Key_Return || event.key == Qt.Key_Enter) && currentIndex >= 0){
+ selectedRow(currentIndex)
+ }
+ }
+
delegate: Component{
id: historyListDelegate
Item {
property bool empty: false
Keys.onPressed: {
+ if ((currentIndex < 0 || currentIndex >= count) && (event.key == Qt.Key_Up || event.key == Qt.Key_Down)){
+ currentIndex = 0
+ }
if (event.key == Qt.Key_Space && currentIndex >= 0){
rectangle1.changeWordStateByIndex();
} else if ((event.key == Qt.Key_Return || event.key == Qt.Key_Enter) && currentIndex >= 0){