Commit e99074c8 authored by Dave Partyka's avatar Dave Partyka
Browse files

ENH: Multiple fixes from head including enabling the Cosmo Reader and fixing...

ENH: Multiple fixes from head including enabling the Cosmo Reader and fixing the Reader Slection tests to select the Reader by name.
parent cb8a202d
......@@ -38,6 +38,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QMouseEvent>
#include <QKeyEvent>
#include <QtDebug>
#include <QList>
#include <QListWidget>
#include "pqEventDispatcher.h"
......@@ -62,6 +64,26 @@ static QModelIndex OldGetIndex(QAbstractItemView& View, const QString& Name)
return index;
}
static QModelIndex GetIndexByItemName(QAbstractItemView& View, const QString& Name)
{
QListWidget* const listWidget = qobject_cast<QListWidget*>(&View);
QModelIndex index;
if(!listWidget)
{
return index;
}
QList<QListWidgetItem *> findResult = listWidget->findItems(Name,Qt::MatchExactly);
if(findResult.count() > 0)
{
// in theory more than one item could match? Only return the index for
// the first instance.
index = View.model()->index(listWidget->row(findResult.first()), 0, index);
}
return index;
}
static QModelIndex GetIndex(QAbstractItemView* View, const QString& Name)
{
QStringList idxs = Name.split('/', QString::SkipEmptyParts);
......@@ -98,6 +120,15 @@ bool pqAbstractItemViewEventPlayer::playEvent(QObject* Object, const QString& Co
if(!index.isValid())
return false;
object->setCurrentIndex(index);
return true;
}
else if(Command == "currentChangedbyItemName")
{
const QModelIndex index = GetIndexByItemName(*object, Arguments);
if(!index.isValid())
return false;
object->setCurrentIndex(index);
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment