Commit 72ee85c4 authored by Mathieu Westphal's avatar Mathieu Westphal

Review and corrections

parent 3f3d5921
......@@ -58,14 +58,14 @@ protected:
}
}
virtual void onRecordEvent(const int& eventType, const QString& widget, const QString& command,
const QString& arguments)
virtual void onRecordEvent(const QString& widget, const QString& command,
const QString& arguments, const int& eventType)
{
if(this->XMLStream)
{
this->XMLStream->writeStartElement("event");
this->XMLStream->writeAttribute("widget", widget);
if (eventType == pqEventTypes::EVENT)
if (eventType == pqEventTypes::ACTION_EVENT)
{
this->XMLStream->writeAttribute("command", command);
}
......@@ -124,8 +124,8 @@ protected:
return;
}
int getNextEvent(int& eventType, QString& widget, QString& command, QString&
arguments)
int getNextEvent(QString& widget, QString& command, QString&
arguments,int& eventType)
{
if (this->XMLStream->atEnd())
{
......@@ -146,7 +146,7 @@ protected:
{
return DONE;
}
eventType = pqEventTypes::EVENT;
eventType = pqEventTypes::ACTION_EVENT;
widget = this->XMLStream->attributes().value("widget").toString();
command = this->XMLStream->attributes().value("command").toString();
arguments = this->XMLStream->attributes().value("arguments").toString();
......
......@@ -118,7 +118,7 @@ Writing new Translators/Player
************************************************************
A new translator must at least reimplement the translateEvent(QObject object, QEvent event, int eventType, bool& error) method.
For starters, it must check that the object is of correct class
Then it should handle the pqEventTypes::EVENT case, recording meaningfull events with identifiable command and associated arguments
Then it should handle the pqEventTypes::ACTION_EVENT case, recording meaningfull events with identifiable command and associated arguments
And it should also handle the pqEventTypes::CHECK_EVENT case, only for two different QEvent
For QEvent::MouseMove it should return true only if a check event can be recorded
For QEvent::MouseButtonRelease , it should record a check event, associated to the value you want to check and an existing qt property or
......@@ -127,7 +127,7 @@ an identified command
A new player, symmetrically, should at least reimplement the
playEvent(QObject* object, const QString& command, const QString& arguments, int eventType, bool& error) method
First it should handle the pqEventTypes::EVENT, converting provided command and arguments into qt instructions, returning true for event that it can handle.
First it should handle the pqEventTypes::ACTION_EVENT, converting provided command and arguments into qt instructions, returning true for event that it can handle.
Then, if the the translator can record check command, it should hendle the pqEventTypes::CHECK_EVENT, checking the current value of qt object using provided command and arguments, positionning error to false
when a value differ, but returning true for all handled check event, even failed one.
Property to check are handled by pqBasicWidgetEventPlayer
......
......@@ -203,17 +203,19 @@ void pqEventPlayerTester::testAddDefaultWidgetEventPlayers_data()
QTest::newRow("0") << 0 << "pqNativeFileDialogEventPlayer";
QTest::newRow("1") << 1 << "pq3DViewEventPlayer";
QTest::newRow("2") << 2 << "pqAbstractMiscellaneousEventPlayer";
QTest::newRow("3") << 3 << "pqTableViewEventPlayer";
QTest::newRow("3") << 4 << "pqTreeViewEventPlayer";
QTest::newRow("4") << 5 << "pqTabBarEventPlayer";
QTest::newRow("5") << 6 << "pqAbstractStringEventPlayer";
QTest::newRow("6") << 7 << "pqAbstractItemViewEventPlayer";
QTest::newRow("7") << 8 << "pqAbstractIntEventPlayer";
QTest::newRow("8") << 9 << "pqAbstractDoubleEventPlayer";
QTest::newRow("9") << 10 << "pqAbstractBooleanEventPlayer";
QTest::newRow("10") << 11 << "pqAbstractActivateEventPlayer";
QTest::newRow("11") << 12 << "pqBasicWidgetEventPlayer";
QTest::newRow("12") << 13 << "pqCommentEventPlayer";
QTest::newRow("3") << 3 << "pqListViewEventPlayer";
QTest::newRow("4") << 4 << "pqTableViewEventPlayer";
QTest::newRow("5") << 5 << "pqTreeViewEventPlayer";
QTest::newRow("6") << 6 << "pqComboBoxEventPlayer";
QTest::newRow("7") << 7 << "pqTabBarEventPlayer";
QTest::newRow("8") << 8 << "pqAbstractStringEventPlayer";
QTest::newRow("9") << 9 << "pqAbstractItemViewEventPlayer";
QTest::newRow("10") << 10 << "pqAbstractIntEventPlayer";
QTest::newRow("11") << 11 << "pqAbstractDoubleEventPlayer";
QTest::newRow("12") << 12 << "pqAbstractBooleanEventPlayer";
QTest::newRow("13") << 13 << "pqAbstractActivateEventPlayer";
QTest::newRow("14") << 14 << "pqBasicWidgetEventPlayer";
QTest::newRow("15") << 15 << "pqCommentEventPlayer";
}
// ----------------------------------------------------------------------------
......
......@@ -202,20 +202,20 @@ void pqEventTranslatorTester::testAddDefaultWidgetEventTranslators_data()
QTest::newRow("0") << 0 << "pqNativeFileDialogEventTranslator";
QTest::newRow("1") << 1 << "pq3DViewEventTranslator";
QTest::newRow("2") << 2 << "pqTableViewEventTranslator";
QTest::newRow("2") << 3 << "pqTreeViewEventTranslator";
QTest::newRow("3") << 4 << "pqTabBarEventTranslator";
QTest::newRow("4") << 5 << "pqSpinBoxEventTranslator";
QTest::newRow("5") << 6 << "pqMenuEventTranslator";
QTest::newRow("6") << 7 << "pqLineEditEventTranslator";
QTest::newRow("7") << 8 << "pqDoubleSpinBoxEventTranslator";
QTest::newRow("8") << 9 << "pqComboBoxEventTranslator";
QTest::newRow("9") << 10 << "pqAbstractSliderEventTranslator";
QTest::newRow("10") << 11 << "pqAbstractItemViewEventTranslator";
QTest::newRow("11") << 12 << "pqAbstractButtonEventTranslator";
QTest::newRow("12") << 13 << "pqBasicWidgetEventTranslator";
QTest::newRow("2") << 2 << "pqListViewEventTranslator";
QTest::newRow("3") << 3 << "pqTableViewEventTranslator";
QTest::newRow("4") << 4 << "pqTreeViewEventTranslator";
QTest::newRow("5") << 5 << "pqTabBarEventTranslator";
QTest::newRow("6") << 6 << "pqSpinBoxEventTranslator";
QTest::newRow("7") << 7 << "pqMenuEventTranslator";
QTest::newRow("8") << 8 << "pqLineEditEventTranslator";
QTest::newRow("9") << 9 << "pqDoubleSpinBoxEventTranslator";
QTest::newRow("10") << 10 << "pqComboBoxEventTranslator";
QTest::newRow("11") << 11 << "pqAbstractSliderEventTranslator";
QTest::newRow("12") << 12 << "pqAbstractItemViewEventTranslator";
QTest::newRow("13") << 13 << "pqAbstractButtonEventTranslator";
QTest::newRow("14") << 14 << "pqBasicWidgetEventTranslator";
}
// ----------------------------------------------------------------------------
CTK_TEST_MAIN(pqEventTranslatorTest)
#include "moc_pqEventTranslatorTest.cpp"
......@@ -36,9 +36,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// QtTesting includes
#include "pqEventTypes.h"
#include "pqTest.h"
#include "pqTestUtility.h"
#include "pqTest.h"
// ----------------------------------------------------------------------------
class pqSpinBoxEventPlayerTester: public QObject
{
......
......@@ -74,10 +74,10 @@ public:
QString Text;
public slots:
virtual void onRecordEvent(const int& eventType,
const QString& widget,
virtual void onRecordEvent(const QString& widget,
const QString& command,
const QString& arguments)
const QString& arguments,
const int& eventType)
{
if (eventType == pqEventTypes::CHECK_EVENT)
{
......@@ -111,10 +111,10 @@ protected:
return;
}
int getNextEvent(int& /*eventType*/,
QString& /*widget*/,
int getNextEvent(QString& /*widget*/,
QString& /*command*/,
QString& /*arguments*/)
QString& /*arguments*/,
int& /*eventType*/)
{
return 0;
}
......
......@@ -104,7 +104,7 @@ bool pqAbstractItemViewEventPlayerBase::playEvent(
return false;
}
if (eventType == pqEventTypes::EVENT)
if (eventType == pqEventTypes::ACTION_EVENT)
{
if (command == "key")
{
......
......@@ -62,8 +62,8 @@ bool pqAbstractItemViewEventTranslatorBase::translateEvent(
QObject* object, QEvent* event, int eventType, bool& error)
{
// Recover corrected abstract item view
QAbstractItemView* abstractItemView = NULL;
if (!this->findCorrectedAbstractItemView(object, abstractItemView) || !abstractItemView)
QAbstractItemView* abstractItemView = this->findCorrectedAbstractItemView(object);
if (!abstractItemView)
{
return false;
}
......@@ -74,7 +74,7 @@ bool pqAbstractItemViewEventTranslatorBase::translateEvent(
return false;
}
if (eventType == pqEventTypes::EVENT)
if (eventType == pqEventTypes::ACTION_EVENT)
{
switch(event->type())
{
......@@ -176,16 +176,16 @@ bool pqAbstractItemViewEventTranslatorBase::translateEvent(
if (this->ModelItemCheck != NULL)
{
QString indexString = this->getIndexAsString(*this->ModelItemCheck);
emit this->recordEvent(pqEventTypes::CHECK_EVENT, abstractItemView,
"modelItemData", QString("%1,%2").arg(indexString).arg(
emit this->recordEvent(abstractItemView, "modelItemData", QString("%1,%2").arg(indexString).arg(
// Replacing tab by space, as they are not valid in xml
this->ModelItemCheck->data().toString().replace("\t", " ")));
this->ModelItemCheck->data().toString().replace("\t", " ")),
pqEventTypes::CHECK_EVENT);
}
// Abstract Item View nb row check
else
{
emit this->recordEvent(pqEventTypes::CHECK_EVENT, abstractItemView,
"modelRowCount", QString::number(abstractItemView->model()->rowCount()));
emit this->recordEvent(abstractItemView, "modelRowCount",
QString::number(abstractItemView->model()->rowCount()), pqEventTypes::CHECK_EVENT);
}
return true;
}
......@@ -270,11 +270,8 @@ QString pqAbstractItemViewEventTranslatorBase::getIndexAsString(const QModelInde
//-----------------------------------------------------------------------------
void pqAbstractItemViewEventTranslatorBase::onCurrentChanged(const QModelIndex& index)
{
if (this->AbstractItemView)
{
emit this->recordEvent(this->AbstractItemView,
"setCurrent", this->getIndexAsString(index));
}
emit this->recordEvent(this->AbstractItemView,
"setCurrent", this->getIndexAsString(index));
}
//-----------------------------------------------------------------------------
......
......@@ -56,8 +56,7 @@ public:
virtual void connectWidgetToSlots(QAbstractItemView* abstractItemView);
/// find and set the corrected abstract item view
virtual bool findCorrectedAbstractItemView(QObject* object,
QAbstractItemView*& abstractItemView) const = 0;
virtual QAbstractItemView* findCorrectedAbstractItemView(QObject* object) const = 0;
protected slots:
virtual void onClicked(const QModelIndex&);
......
......@@ -7,7 +7,7 @@
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
......@@ -34,10 +34,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QComboBox>
#include <QLineEdit>
#include <QtDebug>
#include <QPlainTextEdit>
#include <QTextDocument>
#include <QTextEdit>
#include <QPlainTextEdit>
#include <QtDebug>
#include "pqObjectNaming.h"
......@@ -48,52 +48,52 @@ pqAbstractStringEventPlayer::pqAbstractStringEventPlayer(QObject* p)
bool pqAbstractStringEventPlayer::playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error)
{
if(Command != "set_string")
return false;
if (Command != "set_string")
return false;
const QString value = Arguments;
if(QComboBox* const object = qobject_cast<QComboBox*>(Object))
if (QComboBox* const comboBox = qobject_cast<QComboBox*>(Object))
{
int index = object->findText(value);
if(index != -1)
int index = comboBox->findText(value);
if (index != -1)
{
object->setCurrentIndex(index);
comboBox->setCurrentIndex(index);
}
else
{
QString possibles;
for(int i=0; i<object->count(); i++)
for (int i = 0; i < comboBox->count(); i++)
{
possibles += QString("\t") + object->itemText(i) + QString("\n");
possibles += QString("\t") + comboBox->itemText(i) + QString("\n");
}
qCritical() << "Unable to find " << value << " in combo box: "
<< pqObjectNaming::GetName(*Object)
<< "\nPossible values are:\n" << possibles;
<< pqObjectNaming::GetName(*Object)
<< "\nPossible values are:\n" << possibles;
Error = true;
}
return true;
}
if(QLineEdit* const object = qobject_cast<QLineEdit*>(Object))
if (QLineEdit* const lineEdit = qobject_cast<QLineEdit*>(Object))
{
object->setText(value);
lineEdit->setText(value);
return true;
}
if (QTextEdit* const object = qobject_cast<QTextEdit*>(Object))
if (QTextEdit* const textEdit = qobject_cast<QTextEdit*>(Object))
{
object->setFocus(Qt::OtherFocusReason);
object->document()->setPlainText(value);
object->clearFocus();
textEdit->setFocus(Qt::OtherFocusReason);
textEdit->document()->setPlainText(value);
textEdit->clearFocus();
return true;
}
if (QPlainTextEdit* const object = qobject_cast<QPlainTextEdit*>(Object))
if (QPlainTextEdit* const plainTextEdit = qobject_cast<QPlainTextEdit*>(Object))
{
object->setFocus(Qt::OtherFocusReason);
object->document()->setPlainText(value);
object->clearFocus();
plainTextEdit->setFocus(Qt::OtherFocusReason);
plainTextEdit->document()->setPlainText(value);
plainTextEdit->clearFocus();
return true;
}
......
......@@ -51,7 +51,7 @@ bool pqBasicWidgetEventPlayer::playEvent(QObject* object,
QWidget* widget = qobject_cast<QWidget*>(object);
if(widget)
{
if (eventType == pqEventTypes::EVENT)
if (eventType == pqEventTypes::ACTION_EVENT)
{
{
if(command == "key")
......@@ -112,13 +112,13 @@ bool pqBasicWidgetEventPlayer::playEvent(QObject* object,
else if (eventType == pqEventTypes::CHECK_EVENT)
{
// Recover QProperty
QVariant propertyValue = object->property(command.toAscii().data());
QVariant propertyValue = object->property(command.toUtf8().data());
// Check it is valid
if (!propertyValue.isValid())
{
QString errorMessage = object->objectName() + " has no valid property named:" + command;
qCritical() << errorMessage.toAscii().data();
qCritical() << errorMessage.toUtf8().data();
error = true;
return true;
}
......@@ -128,7 +128,7 @@ bool pqBasicWidgetEventPlayer::playEvent(QObject* object,
{
QString errorMessage = object->objectName() + " property value is: " + propertyValue.toString()
+ ". Expecting: "+ arguments + ".";
qCritical() << errorMessage.toAscii().data();
qCritical() << errorMessage.toUtf8().data();
error = true;
}
return true;
......
......@@ -35,9 +35,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QDialog>
#include <QEvent>
#include <QKeyEvent>
#include <QMetaProperty>
#include <QScrollBar>
#include <QWidget>
#include <QMetaProperty>
#include "pqEventTypes.h"
......@@ -59,7 +59,7 @@ bool pqBasicWidgetEventTranslator::translateEvent(QObject* object,
if(!widget)
return false;
if (eventType == pqEventTypes::EVENT)
if (eventType == pqEventTypes::ACTION_EVENT)
{
switch(event->type())
{
......@@ -169,7 +169,7 @@ bool pqBasicWidgetEventTranslator::translateEvent(QObject* object,
QString propName = metaProp.name();
// Record check event
emit recordEvent(pqEventTypes::CHECK_EVENT, widget, propName, widget->property(propName.toAscii().data()).toString().replace("\t", " "));
emit recordEvent(widget, propName, widget->property(propName.toUtf8().data()).toString().replace("\t", " "), pqEventTypes::CHECK_EVENT);
return true;
}
}
......
......@@ -58,7 +58,7 @@ bool pqComboBoxEventPlayer::playEvent(
return false;
}
if (eventType == pqEventTypes::EVENT)
if (eventType == pqEventTypes::ACTION_EVENT)
{
if (command == "activated" || command == "editTextChanged")
{
......
......@@ -313,7 +313,7 @@ void pqEventDispatcher::playEvent(int indent)
QString arguments;
int eventType;
int result = this->ActiveSource->getNextEvent(eventType, object, command, arguments);
int result = this->ActiveSource->getNextEvent(object, command, arguments, eventType);
if (result == pqEventSource::DONE)
{
this->PlayBackFinished = true;
......@@ -345,7 +345,7 @@ void pqEventDispatcher::playEvent(int indent)
<< " : "
<< QString().fill(' ', 4*indent).toStdString().c_str()
<< local_counter << ": Test (" << indent << "): "
<< eventString.toAscii().data() << ": "
<< eventString.toUtf8().data() << ": "
<< pretty_name.toStdString().c_str() << ": "
<< command.toStdString().c_str() << " : "
<< arguments.toStdString().c_str() << endl;
......
......@@ -61,14 +61,14 @@ public:
public slots:
// Slot called when recording an event
// Event Type can be pqEventTypes::EVENT or pqEventType::CHECK_EVENT
// Event Type can be pqEventTypes::ACTION_EVENT or pqEventType::CHECK_EVENT
// Widget, Command/Property and Arguments are QString
// THis method has to be redefined by subclasses
virtual void onRecordEvent(
const int& eventType,
const QString& Widget,
const QString& Command,
const QString& Arguments)=0;
const QString& Arguments,
const int& eventType)=0;
signals:
......
......@@ -154,7 +154,7 @@ void pqEventPlayer::playEvent(const QString& objectString,
const QString& arguments,
bool& error)
{
this->playEvent(objectString, command, arguments, pqEventTypes::EVENT, error);
this->playEvent(objectString, command, arguments, pqEventTypes::ACTION_EVENT, error);
}
// ----------------------------------------------------------------------------
......
......@@ -171,9 +171,9 @@ void pqEventRecorder::start()
QObject::connect(
this->ActiveTranslator,
SIGNAL(recordEvent(int, QString,QString,QString)),
SIGNAL(recordEvent(QString,QString,QString, int)),
this->ActiveObserver,
SLOT(onRecordEvent(int, QString,QString,QString)));
SLOT(onRecordEvent(QString,QString,QString, int)));
// Set the device
this->Stream.setDevice(this->File);
......@@ -196,9 +196,9 @@ void pqEventRecorder::stop(int value)
{
QObject::disconnect(
this->ActiveTranslator,
SIGNAL(recordEvent(int, QString,QString,QString)),
SIGNAL(recordEvent(QString,QString,QString, int)),
this->ActiveObserver,
SLOT(onRecordEvent(int, QString,QString,QString)));
SLOT(onRecordEvent(QString,QString,QString, int)));
this->ActiveObserver->setStream(NULL);
this->ActiveTranslator->stop();
......
......@@ -57,10 +57,10 @@ public:
FAILURE if there was a problem,
DONE, if there are no more events. */
virtual int getNextEvent(
int& eventType,
QString& object,
QString& command,
QString& arguments) = 0;
QString& arguments,
int& eventType) = 0;
/** Set the filename for contents.
Returns true for valid file, false for invalid file */
......
......@@ -200,9 +200,9 @@ void pqEventTranslator::addWidgetEventTranslator(pqWidgetEventTranslator* Transl
// Connect record event
QObject::connect(
Translator,
SIGNAL(recordEvent(int, QObject*, const QString&, const QString&)),
SIGNAL(recordEvent(QObject*, const QString&, const QString&, int)),
this,
SLOT(onRecordEvent(int, QObject*, const QString&, const QString&)));
SLOT(onRecordEvent(QObject*, const QString&, const QString&, int)));
// Connect resize specific overlay
QObject::connect(
......@@ -551,7 +551,7 @@ bool pqEventTranslator::eventFilter(QObject* object, QEvent* event)
for(int i = 0; i != this->Implementation->Translators.size(); ++i)
{
bool error = false;
if(this->Implementation->Translators[i]->translateEvent(object, event, pqEventTypes::EVENT, error))
if(this->Implementation->Translators[i]->translateEvent(object, event, pqEventTypes::ACTION_EVENT, error))
{
if(error)
{
......@@ -571,14 +571,14 @@ void pqEventTranslator::onRecordEvent(QObject* Object,
const QString& Command,
const QString& Arguments)
{
this->onRecordEvent(pqEventTypes::EVENT, Object, Command, Arguments);
this->onRecordEvent(Object, Command, Arguments, pqEventTypes::ACTION_EVENT);
}
// ----------------------------------------------------------------------------
void pqEventTranslator::onRecordEvent(int eventType,
QObject* Object,
void pqEventTranslator::onRecordEvent(QObject* Object,
const QString& Command,
const QString& Arguments)
const QString& Arguments,
int eventType)
{
if(this->Implementation->IgnoredObjects.contains(Object))
{
......@@ -590,7 +590,7 @@ void pqEventTranslator::onRecordEvent(int eventType,
}
QString name;
if (eventType == pqEventTypes::EVENT)
if (eventType == pqEventTypes::ACTION_EVENT)
{
// When sender is pqEventObject, the Object name can be NULL.
if (!qobject_cast<pqEventComment*>(this->sender()) || Object)
......@@ -610,7 +610,7 @@ void pqEventTranslator::onRecordEvent(int eventType,
}
}
// Record the event
emit recordEvent(eventType, name, Command, Arguments);
emit recordEvent(name, Command, Arguments, eventType);
}
// ----------------------------------------------------------------------------
......
......@@ -107,7 +107,7 @@ signals:
/// This signal will be emitted every time a translator generates a
/// high-level ParaView event. Observers should connect to this signal
/// to serialize high-level events.
void recordEvent(int eventType, const QString& Object, const QString& Command, const QString& Arguments);
void recordEvent(const QString& Object, const QString& Command, const QString& Arguments, int eventType);
/// this signals when recording starts
void started();
......@@ -117,9 +117,9 @@ signals:
private slots:
// Slot called when recording an event
void onRecordEvent(int eventType, QObject* Object, const QString& Command, const QString& Arguments);
void onRecordEvent(QObject* Object, const QString& Command, const QString& Arguments, int eventType);
// Legacy convenient slot for pqEventTypes::EVENT events
// Legacy convenient slot for pqEventTypes::ACTION_EVENT events
void onRecordEvent(QObject* Object, const QString& Command, const QString& Arguments);
// Slots called when widget request a specific size for the check overlay
......
......@@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace pqEventTypes
{
enum eventType {
EVENT = 0,
ACTION_EVENT = 0,
CHECK_EVENT = 1
};
};
......
......@@ -67,7 +67,7 @@ bool pqLineEditEventTranslator::translateEvent(QObject* object, QEvent* event, i
return false;
}
if (eventType == pqEventTypes::EVENT)
if (eventType == pqEventTypes::ACTION_EVENT)
{
// If this line edit is part of a spinbox, don't translate events
// (the spinbox translator will receive the final value directly)
......@@ -125,13 +125,13 @@ bool pqLineEditEventTranslator::translateEvent(QObject* object, QEvent* event, i
{
if(teObject != NULL)
{
emit this->recordEvent(pqEventTypes::CHECK_EVENT, teObject,
"plainText", teObject->toPlainText().replace("\t", " "));
emit this->recordEvent(teObject, "plainText",
teObject->toPlainText().replace("\t", " "), pqEventTypes::CHECK_EVENT);
}
else /* if (pteObject != NULL)*/
{
emit this->recordEvent(pqEventTypes::CHECK_EVENT, pteObject,
"plainText", pteObject->toPlainText().replace("\t", " "));
emit this->recordEvent(pteObject, "plainText",
pteObject->toPlainText().replace("\t", " "), pqEventTypes::CHECK_EVENT);
}
return true;
}
......
......@@ -55,7 +55,7 @@ void pqListViewEventTranslator::onEnteredCheck(const QModelIndex& item)
// Translate the rect of margins and headers
visualRect.translate(listView->contentsMargins().left(),
listView->contentsMargins().top());
listView->contentsMargins().top());
// Stor item and signal that a specific overlay is ready to be drawn
this->ModelItemCheck = &item;
......@@ -63,26 +63,20 @@ void pqListViewEventTranslator::onEnteredCheck(const QModelIndex& item)
}
//-----------------------------------------------------------------------------
bool pqListViewEventTranslator::findCorrectedAbstractItemView(QObject* object,
QAbstractItemView*& abstractItemView) const
QAbstractItemView* pqListViewEventTranslator::findCorrectedAbstractItemView(QObject* object) const
{
// Ignore QHeaderView event specifically
if (qobject_cast<QHeaderView*>(object))
{
abstractItemView = NULL;
return false;
return NULL;
}
abstractItemView = qobject_cast<QListView*>(object);
QAbstractItemView* abstractItemView = qobject_cast<QListView*>(object);
if (!abstractItemView)
{
// mouse events go to the viewport widget
abstractItemView = qobject_cast<QListView*>(object->parent());
}
if (!abstractItemView)
{
return false;
}
return true;
return abstractItemView;
}
......@@ -46,8 +46,7 @@ public:
~pqListViewEventTranslator();
/// find and set the corrected abstract item view
virtual bool findCorrectedAbstractItemView(QObject* object,
QAbstractItemView*& abstractItemView) const;
virtual QAbstractItemView* findCorrectedAbstractItemView(QObject* object) const;
protected slots:
/// Compute a visual rectangle for the item and signal it
......
......@@ -34,16 +34,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QDebug>
#include <QFile>
#include <QFileDialog>
#include <QPushButton>
#include <QTextStream>
#include <QTimer>
#include <QPushButton>
// QtTesting includes
#include "pqEventComment.h"
#include "pqEventRecorder.h"
#include "pqEventTypes.h"
#include "pqRecordEventsDialog.h"
#include "pqTestUtility.h"
#include "pqEventTypes.h"
#include "ui_pqRecordEventsDialog.h"
......@@ -141,10 +141,10 @@ void pqRecordEventsDialog::done(int value)
}
// ----------------------------------------------------------------------------
void pqRecordEventsDialog::onEventRecorded(int eventType,
const QString& widget,
void pqRecordEventsDialog::onEventRecorded(const QString& widget,
const QString& command,
const QString& argument)
const QString& argument,
int eventType)
{
if (!this->Implementation->Recorder->isRecording())
{
......
......@@ -55,7 +55,7 @@ public:
private slots:
virtual void done(int);
void onEventRecorded(int eventType, const QString&, const QString&, const QString&);
void onEventRecorded(const QString&, const QString&, const QString&, int eventType);
void addComment();
......