Minor fixes for JS global variable viewer.
This commit is contained in:
parent
dc2d3c26aa
commit
1dde9e7e75
|
@ -742,7 +742,7 @@ void QScriptDialog_t::closeWindow(void)
|
|||
deleteLater();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void QScriptDialog_t::loadPropertyTree(QJSValue& object, QTreeWidgetItem* parentItem)
|
||||
void QScriptDialog_t::loadPropertyTree(QJSValue& object, JsPropertyItem* parentItem)
|
||||
{
|
||||
QJSValueIterator it(object);
|
||||
|
||||
|
@ -755,7 +755,7 @@ void QScriptDialog_t::loadPropertyTree(QJSValue& object, QTreeWidgetItem* parent
|
|||
|
||||
if (!isPrototype)
|
||||
{
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
JsPropertyItem* item = new JsPropertyItem();
|
||||
QString value;
|
||||
const char *type = "unknown";
|
||||
|
||||
|
@ -833,6 +833,7 @@ void QScriptDialog_t::loadPropertyTree(QJSValue& object, QTreeWidgetItem* parent
|
|||
item->setText(0, it.name());
|
||||
item->setText(1, type);
|
||||
item->setText(2, value);
|
||||
item->jsValue = child;
|
||||
|
||||
if (parentItem == nullptr)
|
||||
{
|
||||
|
@ -1055,6 +1056,7 @@ void QScriptDialog_t::startScript(void)
|
|||
|
||||
QJSValue globals = scriptInstance->getEngine()->globalObject();
|
||||
|
||||
propTree->clear();
|
||||
loadPropertyTree(globals);
|
||||
|
||||
FCEU_WRAPPER_UNLOCK();
|
||||
|
|
|
@ -139,6 +139,22 @@ public slots:
|
|||
void frameFinishedUpdate();
|
||||
};
|
||||
|
||||
class JsPropertyItem : public QTreeWidgetItem
|
||||
{
|
||||
public:
|
||||
JsPropertyItem()
|
||||
: QTreeWidgetItem()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~JsPropertyItem() override
|
||||
{
|
||||
}
|
||||
|
||||
QJSValue jsValue;
|
||||
QMap<QString, JsPropertyItem*> childMap;
|
||||
};
|
||||
|
||||
class QScriptDialog_t : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -153,7 +169,7 @@ public:
|
|||
protected:
|
||||
void closeEvent(QCloseEvent *bar);
|
||||
void openJSKillMessageBox(void);
|
||||
void loadPropertyTree(QJSValue& val, QTreeWidgetItem* parentItem = nullptr);
|
||||
void loadPropertyTree(QJSValue& val, JsPropertyItem* parentItem = nullptr);
|
||||
|
||||
QTimer *periodicTimer;
|
||||
QLineEdit *scriptPath;
|
||||
|
|
Loading…
Reference in New Issue