Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
ff307373
Commit
ff307373
authored
Mar 18, 2010
by
Lasse Holmstedt
Browse files
UI fixes to qml inspector
parent
cf5bd6de
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmlinspector/components/objectpropertiesview.cpp
View file @
ff307373
...
...
@@ -28,15 +28,13 @@
**************************************************************************/
#include "objectpropertiesview.h"
#include <QtCore/
qd
ebug
.h
>
#include <QtCore/
QD
ebug>
#include <QtGui/
qt
ree
w
idget
.h
>
#include <QtGui/
ql
ayout
.h
>
#include <QtGui/
qh
eader
v
iew
.h
>
#include <QtGui/
QT
ree
W
idget>
#include <QtGui/
QL
ayout>
#include <QtGui/
QH
eader
V
iew>
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"
src/plugins/qmlinspector/components/objectpropertiesview.h
View file @
ff307373
...
...
@@ -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
src/plugins/qmlinspector/components/watchtable.cpp
View file @
ff307373
...
...
@@ -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
)
...
...
src/plugins/qmlinspector/components/watchtable.h
View file @
ff307373
...
...
@@ -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
);
...
...
src/plugins/qmlinspector/qmlinspector.cpp
View file @
ff307373
...
...
@@ -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
);
}
...
...
src/plugins/qmlinspector/qmlinspectorplugin.cpp
View file @
ff307373
...
...
@@ -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."
)
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment