Commit a3a2216e authored by David Partyka's avatar David Partyka
Browse files

ENH: Revert changes temporarily while they are moved to Qt\Components.

parent 76324520
......@@ -35,8 +35,6 @@ ENDIF(QT_TESTING_WITH_PYTHON)
INCLUDE_DIRECTORIES(
${QtTesting_BINARY_DIR}
${QtTesting_SOURCE_DIR}
${pqComponents_SOURCE_DIR}
${pqComponents_BINARY_DIR}
)
# Reduce the number of dirs that get included on moc command line
......
......@@ -31,11 +31,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================*/
#include "pqTreeViewEventPlayer.h"
#include "pqEventDispatcher.h"
#include "pqPluginTreeWidget.h"
#include <QTreeWidget>
#include <QDebug>
#include <QVariant>
//-----------------------------------------------------------------------------
pqTreeViewEventPlayer::pqTreeViewEventPlayer(QObject* parentObject)
......@@ -69,34 +67,6 @@ QModelIndex pqTreeViewEventPlayerGetIndex(const QString& str_index,
return index;
}
//-----------------------------------------------------------------------------
QModelIndex pqTreeViewEventPlayerGetIndexByColumnValue(const int column,
const QString& columnValue, QTreeView* treeView, bool &error)
{
QModelIndex index;
int rows = treeView->model()->rowCount();
for (int i=0; i < rows; ++i)
{
index = treeView->model()->index(i, column, treeView->rootIndex());
if(index.isValid())
{
QString value = index.data().toString();
if(index.data().toString() == columnValue)
{
break;
}
}
else
{
error=true;
qCritical() << "ERROR: Tree view must have changed. "
<< "Indices recorded in the test are no longer valid. Cannot playback.";
break;
}
}
return index;
}
//-----------------------------------------------------------------------------0000000
bool pqTreeViewEventPlayer::playEvent(
QObject* object, const QString& command,
......@@ -179,28 +149,13 @@ bool pqTreeViewEventPlayer::playEvent(
}
else if (command == "setCurrent")
{
// For plugin widgets compare the argument to column 0.
if(dynamic_cast<pqPluginTreeWidget *>(treeView) != NULL)
{
QString columnValue = arguments;
QModelIndex index = ::pqTreeViewEventPlayerGetIndexByColumnValue(
0, columnValue, treeView, error);
if (error)
{
return true;
}
treeView->setCurrentIndex(index);
}
else
QString str_index = arguments;
QModelIndex index = ::pqTreeViewEventPlayerGetIndex(str_index, treeView, error);
if (error)
{
QString str_index = arguments;
QModelIndex index = ::pqTreeViewEventPlayerGetIndex(str_index, treeView, error);
if (error)
{
return true;
}
treeView->setCurrentIndex(index);
return true;
}
treeView->setCurrentIndex(index);
return true;
}
return false;
......
......@@ -30,10 +30,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================*/
#include "pqTreeViewEventTranslator.h"
#include "pqPluginTreeWidget.h"
#include <QTreeView>
#include <QTreeWidget>
#include <QEvent>
//-----------------------------------------------------------------------------
......@@ -138,22 +136,12 @@ QString pqTreeViewEventTranslator::getIndexAsString(const QModelIndex& index)
//-----------------------------------------------------------------------------
void pqTreeViewEventTranslator::onCurrentChanged(const QModelIndex& index)
{
QTreeWidget* treeWidget = qobject_cast<QTreeWidget *>(this->TreeView);
QTreeView* treeWidget = this->TreeView;
if (treeWidget)
{
if(dynamic_cast<pqPluginTreeWidget *>(treeWidget) != NULL)
{
QTreeWidgetItem * currentItem = treeWidget->currentItem();
if(currentItem)
{
emit this->recordEvent(treeWidget, "setCurrent", currentItem->text(0));
}
}
else
{
// record the check state change if the item is user-checkable.
emit this->recordEvent(treeWidget,
"setCurrent", this->getIndexAsString(index));
}
// record the check state change if the item is user-checkable.
emit this->recordEvent(treeWidget,
"setCurrent", this->getIndexAsString(index));
}
}
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