Commit 60e88b22 authored by Aurindam Jana's avatar Aurindam Jana
Browse files

Debugger: Minimize flicker when switching between Locals and Inspector



Change-Id: Ib31190aaf426ba9e68d437e258597d30970a1898
Reviewed-by: default avatarChristiaan Janssen <christiaan.janssen@digia.com>
parent 3e25be35
......@@ -41,7 +41,8 @@ namespace Internal {
LocalsAndExpressionsWindow::LocalsAndExpressionsWindow(
QWidget *locals, QWidget *inspector, QWidget *returnWidget,
QWidget *watchers, QWidget *parent)
: QWidget(parent)
: QWidget(parent),
m_showLocals(false)
{
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setMargin(0);
......@@ -62,11 +63,23 @@ LocalsAndExpressionsWindow::LocalsAndExpressionsWindow(
m_splitter->setStretchFactor(0, 3);
m_splitter->setStretchFactor(2, 1);
m_splitter->setStretchFactor(3, 1);
// Timer is to prevent flicker when switching between Inpector and Locals
// when debugger engine changes states.
m_timer.setSingleShot(true);
m_timer.setInterval(500); // TODO: remove the magic number!
connect(&m_timer, SIGNAL(timeout()), SLOT(showLocals()));
}
void LocalsAndExpressionsWindow::setShowLocals(bool showLocals)
{
m_localsAndInspector->setCurrentIndex(showLocals ? 0 : 1);
m_showLocals = showLocals;
m_timer.start();
}
void LocalsAndExpressionsWindow::showLocals()
{
m_localsAndInspector->setCurrentIndex(m_showLocals ? 0 : 1);
}
} // namespace Internal
......
......@@ -31,6 +31,7 @@
#define LOCALSANDEXPRESSIONSWINDOW_H
#include <QWidget>
#include <QTimer>
QT_BEGIN_NAMESPACE
class QSplitter;
......@@ -50,9 +51,14 @@ public:
void setShowLocals(bool showLocals);
private slots:
void showLocals();
private:
QSplitter *m_splitter;
QStackedWidget *m_localsAndInspector;
QTimer m_timer;
bool m_showLocals;
};
} // namespace Internal
......
Markdown is supported
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