debugger: hide "watchers" part of Locals&Watchers if there aren't watchers

This commit is contained in:
hjk
2010-03-22 13:41:10 +01:00
parent 3ecfc2f343
commit 41d400eb24
4 changed files with 17 additions and 2 deletions

View File

@@ -459,6 +459,8 @@ void DebuggerManager::init()
watchersView->setModel(d->m_watchHandler->model(WatchersWatch)); watchersView->setModel(d->m_watchHandler->model(WatchersWatch));
connect(theDebuggerAction(AssignValue), SIGNAL(triggered()), connect(theDebuggerAction(AssignValue), SIGNAL(triggered()),
this, SLOT(assignValueInDebugger()), Qt::QueuedConnection); this, SLOT(assignValueInDebugger()), Qt::QueuedConnection);
connect(theDebuggerAction(RemoveWatchExpression), SIGNAL(triggered()),
this, SLOT(updateWatchersWindow()), Qt::QueuedConnection);
// Log // Log
connect(this, SIGNAL(emitShowInput(int, QString)), connect(this, SIGNAL(emitShowInput(int, QString)),
@@ -1802,6 +1804,8 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled); theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled);
theDebuggerAction(ExecuteCommand)->setEnabled(d->m_state != DebuggerNotReady); theDebuggerAction(ExecuteCommand)->setEnabled(d->m_state != DebuggerNotReady);
updateWatchersWindow();
d->m_plugin->handleStateChanged(d->m_state); d->m_plugin->handleStateChanged(d->m_state);
const bool notbusy = state == InferiorStopped const bool notbusy = state == InferiorStopped
|| state == DebuggerNotReady || state == DebuggerNotReady
@@ -1925,6 +1929,12 @@ void DebuggerManager::fontSettingsChanged(const TextEditor::FontSettings &settin
changeFontSize(d->m_threadsWindow, size); changeFontSize(d->m_threadsWindow, size);
} }
void DebuggerManager::updateWatchersWindow()
{
d->m_watchersWindow->setVisible(
d->m_watchHandler->model(WatchersWatch)->rowCount(QModelIndex()) > 0);
}
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// //
// AbstractDebuggerEngine // AbstractDebuggerEngine

View File

@@ -259,6 +259,7 @@ public slots: // FIXME
void showDebuggerOutput(const QString &msg) void showDebuggerOutput(const QString &msg)
{ showDebuggerOutput(LogDebug, msg); } { showDebuggerOutput(LogDebug, msg); }
void ensureLogVisible(); void ensureLogVisible();
void updateWatchersWindow();
//private slots: // FIXME //private slots: // FIXME
void showDebuggerOutput(int channel, const QString &msg); void showDebuggerOutput(int channel, const QString &msg);

View File

@@ -1201,6 +1201,7 @@ void WatchHandler::endCycle()
m_locals->endCycle(); m_locals->endCycle();
m_watchers->endCycle(); m_watchers->endCycle();
m_tooltips->endCycle(); m_tooltips->endCycle();
m_manager->updateWatchersWindow();
} }
void WatchHandler::cleanup() void WatchHandler::cleanup()

View File

@@ -174,12 +174,15 @@ private:
explicit WatchModel(WatchHandler *handler, WatchType type); explicit WatchModel(WatchHandler *handler, WatchType type);
virtual ~WatchModel(); virtual ~WatchModel();
public:
int rowCount(const QModelIndex &idx) const;
int columnCount(const QModelIndex &idx) const;
private:
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role); bool setData(const QModelIndex &index, const QVariant &value, int role);
QModelIndex index(int, int, const QModelIndex &idx) const; QModelIndex index(int, int, const QModelIndex &idx) const;
QModelIndex parent(const QModelIndex &idx) const; QModelIndex parent(const QModelIndex &idx) const;
int rowCount(const QModelIndex &idx) const;
int columnCount(const QModelIndex &idx) const;
bool hasChildren(const QModelIndex &idx) const; bool hasChildren(const QModelIndex &idx) const;
Qt::ItemFlags flags(const QModelIndex &idx) const; Qt::ItemFlags flags(const QModelIndex &idx) const;
QVariant headerData(int section, Qt::Orientation orientation, QVariant headerData(int section, Qt::Orientation orientation,