void BTHistory::move(QAction* historyItem) { //BT_ASSERT(historyItem); BT_ASSERT(m_historyList.count()); m_inHistoryFunction = true; //find the action in the list m_index = m_historyList.indexOf(historyItem); //move to the selected item in the list, it will be the current item emit historyMoved(m_historyList.at(m_index)->property(ActionText).toString()); // signal to "outsiders"; key has been changed sendChangedSignal(); m_inHistoryFunction = false; BT_ASSERT(class_invariant()); }
void BTHistory::add(CSwordKey* newKey) { BT_ASSERT(newKey); // Add new key Action after current index if we were not using the history functions, // if it's not a duplicate and if it's not empty. if (!m_inHistoryFunction && ((m_index < 0) || (newKey->key() != m_historyList.at(m_index)->property(ActionText).toString()) )) { if (!newKey->key().isEmpty()) { auto * const a = new QAction(newKey->key(), this); a->setProperty(ActionText, newKey->key()); m_historyList.insert(++m_index, a); } // \todo history limit? sendChangedSignal(); } BT_ASSERT(class_invariant()); }
void BTHistory::add(CSwordKey* newKey) { qDebug("BTHistory::add"); Q_ASSERT(newKey); // Add new key Action after current index if we were not using the history functions, // if it's not a duplicate and if it's not empty. if (!m_inHistoryFunction && ((m_index < 0) || (newKey->key() != m_historyList.at(m_index)->text()) )) { if (!newKey->key().isEmpty()) { m_historyList.insert(++m_index, new QAction(newKey->key(), this)); } // TODO: history limit? sendChangedSignal(); } Q_ASSERT(class_invariant()); }
void BTHistory::move(QAction* historyItem) { qDebug("BTHistory::move"); //Q_ASSERT(historyItem); Q_ASSERT(m_historyList.count()); m_inHistoryFunction = true; //find the action in the list m_index = m_historyList.indexOf(historyItem); //move to the selected item in the list, it will be the current item QString newKey = m_historyList.at(m_index)->text(); emit historyMoved(newKey); // signal to "outsiders"; key has been changed sendChangedSignal(); m_inHistoryFunction = false; Q_ASSERT(class_invariant()); }