* \author Richard Heck
* \author Et Alia
*
- * Some of the material in this file previously appeared in
+ * Some of the material in this file previously appeared in
* GuiCitationDialog.cpp.
*
* Full author contact details are available in file CREDITS.
bool const have_avl = !avail.isEmpty();
bool const have_sel = !sel.isEmpty();
- if (selectedFocused()) {
+ if (selectedFocused()) {
if (have_sel)
return sel.front();
if (have_avl)
return avail.front();
- }
+ }
else { // available has focus
if (have_avl)
return avail.front();
void GuiSelectionManager::updateAddPB()
{
int const arows = availableModel->rowCount();
- QModelIndexList const availSels =
+ QModelIndexList const availSels =
availableLV->selectionModel()->selectedIndexes();
addPB->setEnabled(arows > 0 &&
!availSels.isEmpty() &&
deletePB->setEnabled(false);
return;
}
- QModelIndexList const selSels =
+ QModelIndexList const selSels =
selectedLV->selectionModel()->selectedIndexes();
int const sel_nr = selSels.empty() ? -1 : selSels.first().row();
deletePB->setEnabled(sel_nr >= 0);
upPB->setEnabled(false);
return;
}
- QModelIndexList const selSels =
+ QModelIndexList const selSels =
selectedLV->selectionModel()->selectedIndexes();
int const sel_nr = selSels.empty() ? -1 : selSels.first().row();
upPB->setEnabled(sel_nr > 0);
downPB->setEnabled(false);
return;
}
- QModelIndexList const selSels =
+ QModelIndexList const selSels =
selectedLV->selectionModel()->selectedIndexes();
int const sel_nr = selSels.empty() ? -1 : selSels.first().row();
downPB->setEnabled(sel_nr >= 0 && sel_nr < srows - 1);
if (selectedModel->rowCount() == 0)
return false;
QVariant const & str = availableModel->data(idx, Qt::DisplayRole);
- QModelIndexList qmil =
+ QModelIndexList qmil =
selectedModel->match(selectedModel->index(0, main_sel_col_),
Qt::DisplayRole, str, 1,
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchWrap));
void GuiSelectionManager::availableChanged(QItemSelection const & qis, QItemSelection const &)
{
QModelIndexList il = qis.indexes();
- if (il.empty())
+ if (il.empty())
return;
availableChanged(il.front(), QModelIndex());
}
void GuiSelectionManager::selectedChanged(QItemSelection const & qis, QItemSelection const &)
{
QModelIndexList il = qis.indexes();
- if (il.empty())
+ if (il.empty())
return;
selectedChanged(il.front(), QModelIndex());
}
}
-bool GuiSelectionManager::insertRowToSelected(int i,
+bool GuiSelectionManager::insertRowToSelected(int i,
QMap<int, QVariant> const & itemData)
{
if (i <= -1)
}
-bool GuiSelectionManager::eventFilter(QObject * obj, QEvent * event)
+bool GuiSelectionManager::eventFilter(QObject * obj, QEvent * event)
{
QEvent::Type etype = event->type();
if (obj == availableLV) {
// This is designed to work both with the main enter key
// and the one on the numeric keypad.
if (keyPressed == Qt::Key_Enter || keyPressed == Qt::Key_Return) {
- if (addPB->isEnabled()) {
- if (!keyModifiers) {
- addPB_clicked();
- } else if (keyModifiers == Qt::ControlModifier ||
- keyModifiers == Qt::KeypadModifier ||
- keyModifiers == (Qt::ControlModifier | Qt::KeypadModifier)) {
+ if (!keyModifiers ||
+ keyModifiers == Qt::ControlModifier ||
+ keyModifiers == Qt::KeypadModifier ||
+ keyModifiers == (Qt::ControlModifier
+ | Qt::KeypadModifier)) {
+ if (addPB->isEnabled()) {
addPB_clicked();
- okHook(); //signal
}
+ if (keyModifiers)
+ okHook(); //signal
}
event->accept();
return true;