Commit ff307373 authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

UI fixes to qml inspector

parent cf5bd6de
......@@ -28,15 +28,13 @@
**************************************************************************/
#include "objectpropertiesview.h"
#include <QtCore/qdebug.h>
#include <QtCore/QDebug>
#include <QtGui/qtreewidget.h>
#include <QtGui/qlayout.h>
#include <QtGui/qheaderview.h>
#include <QtGui/QTreeWidget>
#include <QtGui/QLayout>
#include <QtGui/QHeaderView>
QT_BEGIN_NAMESPACE
class PropertiesViewItem : public QObject, public QTreeWidgetItem
{
Q_OBJECT
......@@ -78,6 +76,7 @@ ObjectPropertiesView::ObjectPropertiesView(QDeclarativeEngineDebug *client, QWid
m_tree->setFrameStyle(QFrame::NoFrame);
m_tree->setAlternatingRowColors(true);
m_tree->setExpandsOnDoubleClick(false);
m_tree->setRootIsDecorated(false);
m_tree->setHeaderLabels(QStringList()
<< tr("Name") << tr("Value") << tr("Type"));
QObject::connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem *, int)),
......@@ -255,6 +254,4 @@ void ObjectPropertiesView::itemActivated(QTreeWidgetItem *i)
emit activated(m_object, item->property);
}
QT_END_NAMESPACE
#include "objectpropertiesview.moc"
......@@ -38,6 +38,9 @@ QT_BEGIN_NAMESPACE
class QTreeWidget;
class QTreeWidgetItem;
class QDeclarativeDebugConnection;
QT_END_NAMESPACE
class PropertiesViewItem;
class ObjectPropertiesView : public QWidget
......@@ -76,6 +79,6 @@ private:
};
QT_END_NAMESPACE
#endif
......@@ -153,7 +153,7 @@ QVariant WatchTableModel::data(const QModelIndex &idx, int role) const
return QVariant(m_entities.at(idx.row()).title);
} else if (idx.column() == C_VALUE) {
if (role == Qt::DisplayRole) {
if (role == Qt::DisplayRole || role == Qt::EditRole) {
return QVariant(m_entities.at(idx.row()).value);
} else if(role == Qt::BackgroundRole) {
......@@ -164,6 +164,22 @@ QVariant WatchTableModel::data(const QModelIndex &idx, int role) const
return QVariant();
}
bool WatchTableModel::setData ( const QModelIndex & index, const QVariant & value, int role)
{
if (role == Qt::EditRole) {
return true;
}
return true;
}
Qt::ItemFlags WatchTableModel::flags ( const QModelIndex & index ) const
{
if (index.column() == C_VALUE)
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
}
void WatchTableModel::watchStateChanged()
{
QDeclarativeDebugWatch *watch = qobject_cast<QDeclarativeDebugWatch*>(sender());
......@@ -200,9 +216,8 @@ void WatchTableModel::togglePropertyWatch(const QDeclarativeDebugObjectReference
delete watch;
watch = 0;
} else {
QString desc = (object.name().isEmpty() ? QLatin1String("<unnamed object>") : object.name())
+ QLatin1String(".") + property.name()
+ object.className();
QString desc = (object.name().isEmpty() ? QLatin1String("<") + object.className() + QLatin1String(">") : object.name())
+ QLatin1String(".") + property.name();
addWatch(watch, desc);
emit watchCreated(watch);
......@@ -278,6 +293,13 @@ WatchTableView::WatchTableView(WatchTableModel *model, QWidget *parent)
{
setFrameStyle(QFrame::NoFrame);
setAlternatingRowColors(true);
setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectItems);
setShowGrid(false);
setVerticalHeader(0);
setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed);
setFrameStyle(QFrame::NoFrame);
connect(model, SIGNAL(watchCreated(QDeclarativeDebugWatch*)), SLOT(watchCreated(QDeclarativeDebugWatch*)));
connect(this, SIGNAL(activated(QModelIndex)), SLOT(indexActivated(QModelIndex)));
......@@ -292,8 +314,9 @@ void WatchTableView::indexActivated(const QModelIndex &index)
void WatchTableView::watchCreated(QDeclarativeDebugWatch *watch)
{
int column = m_model->rowForWatch(watch);
resizeColumnToContents(column);
int row = m_model->rowForWatch(watch);
resizeRowToContents(row);
resizeColumnToContents(C_NAME);
}
void WatchTableView::mousePressEvent(QMouseEvent *me)
......
......@@ -60,10 +60,12 @@ public:
void removeWatchAt(int row);
void removeAllWatches();
Qt::ItemFlags flags ( const QModelIndex & index ) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
signals:
void watchCreated(QDeclarativeDebugWatch *watch);
......
......@@ -409,7 +409,9 @@ void QmlInspector::setSimpleDockWidgetArrangement()
}
mainWindow->tabifyDockWidget(m_frameRateDock, m_propertyWatcherDock);
mainWindow->tabifyDockWidget(m_frameRateDock, m_inspectorOutputDock);
mainWindow->tabifyDockWidget(m_propertyWatcherDock, m_inspectorOutputDock);
m_inspectorOutputDock->setVisible(false);
mainWindow->setTrackingEnabled(true);
}
......
......@@ -60,6 +60,7 @@
#include <QtGui/QHBoxLayout>
#include <QtGui/QToolButton>
#include <QtGui/QMessageBox>
#include <QtCore/QDebug>
......@@ -162,9 +163,16 @@ void QmlInspectorPlugin::activateDebuggerForProject(ProjectExplorer::Project *pr
void QmlInspectorPlugin::pollInspector()
{
++m_connectionAttempts;
if (m_inspector->connectToViewer() || m_connectionAttempts == MaxConnectionAttempts) {
if (m_inspector->connectToViewer()) {
m_connectionTimer->stop();
m_connectionAttempts = 0;
} else if (m_connectionAttempts == MaxConnectionAttempts) {
m_connectionTimer->stop();
m_connectionAttempts = 0;
QMessageBox::critical(0,
tr("Failed to connect to debugger"),
tr("Could not connect to debugger server. Please check your settings from Projects pane.") );
}
}
......
Supports Markdown
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