void TagColorEditor::newTagsClicked() { QStringList items; items << "Random"; items << "Library"; bool ok; QString str; str = QInputDialog::getItem(0, "Colors", "Colors", items, 0, false, // text is not editable &ok); if (!ok) return; if (str == "Library") newColorSet(1); else newColorSet(QTime::currentTime().msec()); emit tagColorChanged(); }
void TagColorEditor::newTagsClicked() { QStringList items; items << "Random"; items << "Library"; // bool ok; // QString str; // str = QInputDialog::getItem(0, // "Colors", // "Colors", // items, // 0, // false, // text is not editable // &ok); // // if (!ok) // return; QString text(items.value(0)); QInputDialog dialog(this, 0); dialog.move(QCursor::pos()); dialog.setWindowTitle("Colors"); dialog.setLabelText("Colors"); dialog.setComboBoxItems(items); dialog.setTextValue(text); dialog.setComboBoxEditable(false); dialog.setInputMethodHints(Qt::ImhNone); int ret = dialog.exec(); if (!ret) return; QString str = dialog.textValue(); if (str == "Library") newColorSet(1); else newColorSet(QTime::currentTime().msec()); emit tagColorChanged(); }