Commit 373a29d5 authored by hjk's avatar hjk

Debugger: Simplify LocalsAndExpressionsWindow implementation

No need to keep some members

Change-Id: I24640654a4e1c9b529ee3847b48ee875b1083a12
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 30cb3be5
......@@ -43,28 +43,28 @@ LocalsAndExpressionsWindow::LocalsAndExpressionsWindow(QWidget *locals,
layout->setMargin(0);
layout->setSpacing(0);
m_splitter = new Core::MiniSplitter(Qt::Vertical);
layout->addWidget(m_splitter);
auto splitter = new Core::MiniSplitter(Qt::Vertical);
layout->addWidget(splitter);
m_localsAndInspector = new QStackedWidget();
m_localsAndInspector->addWidget(locals);
m_localsAndInspector->addWidget(inspector);
m_localsAndInspector->setCurrentWidget(inspector);
auto localsAndInspector = new QStackedWidget;
localsAndInspector->addWidget(locals);
localsAndInspector->addWidget(inspector);
localsAndInspector->setCurrentWidget(inspector);
m_splitter->addWidget(m_localsAndInspector);
m_splitter->addWidget(returnWidget);
m_splitter->addWidget(watchers);
splitter->addWidget(localsAndInspector);
splitter->addWidget(returnWidget);
splitter->addWidget(watchers);
m_splitter->setStretchFactor(0, 3);
m_splitter->setStretchFactor(2, 1);
m_splitter->setStretchFactor(3, 1);
splitter->setStretchFactor(0, 3);
splitter->setStretchFactor(2, 1);
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, &QTimer::timeout, [this] {
m_localsAndInspector->setCurrentIndex(m_showLocals ? LocalsIndex : InspectorIndex);
connect(&m_timer, &QTimer::timeout, [this, localsAndInspector] {
localsAndInspector->setCurrentIndex(m_showLocals ? LocalsIndex : InspectorIndex);
});
}
......
......@@ -28,18 +28,11 @@
#include <QWidget>
#include <QTimer>
QT_BEGIN_NAMESPACE
class QSplitter;
class QStackedWidget;
QT_END_NAMESPACE
namespace Debugger {
namespace Internal {
class LocalsAndExpressionsWindow : public QWidget
{
Q_OBJECT
public:
LocalsAndExpressionsWindow(QWidget *locals, QWidget *inspector,
QWidget *returnWidget, QWidget *watchers);
......@@ -47,8 +40,6 @@ public:
void setShowLocals(bool showLocals);
private:
QSplitter *m_splitter;
QStackedWidget *m_localsAndInspector;
QTimer m_timer;
bool m_showLocals;
};
......
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