From ef2f8f67729f0ec19744e2c3a042405a11c743c1 Mon Sep 17 00:00:00 2001 From: Adam Zambrzycki Date: Wed, 13 Feb 2019 08:37:05 +0100 Subject: [PATCH] Fix graph header resizing (#1189) * Fix graph header resizing * Remove 'this' * Fix formatting * Add comment --- src/widgets/DisassemblerGraphView.cpp | 8 +++++++- src/widgets/GraphWidget.cpp | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/widgets/DisassemblerGraphView.cpp b/src/widgets/DisassemblerGraphView.cpp index 892509a4..0d4da857 100644 --- a/src/widgets/DisassemblerGraphView.cpp +++ b/src/widgets/DisassemblerGraphView.cpp @@ -118,10 +118,16 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent) connect(mMenu, SIGNAL(copy()), this, SLOT(copySelection())); - header = new QTextEdit(viewport()); + header = new QTextEdit(); header->setFixedHeight(30); header->setReadOnly(true); header->setLineWrapMode(QTextEdit::NoWrap); + + // Add header as widget to layout so it stretches to the layout width + layout()->setContentsMargins(0, 0, 0, 0); + layout()->setAlignment(Qt::AlignTop); + layout()->addWidget(header); + highlighter = new SyntaxHighlighter(header->document()); } diff --git a/src/widgets/GraphWidget.cpp b/src/widgets/GraphWidget.cpp index 6963ca4b..4a8f8e5c 100644 --- a/src/widgets/GraphWidget.cpp +++ b/src/widgets/GraphWidget.cpp @@ -26,7 +26,6 @@ GraphWidget::GraphWidget(MainWindow *main, OverviewWidget *overview, QAction *ac toggleOverview(visibility); if (visibility) { Core()->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Graph); - this->graphView->header->setFixedWidth(width()); } }); @@ -40,7 +39,6 @@ GraphWidget::GraphWidget(MainWindow *main, OverviewWidget *overview, QAction *ac if (type == CutterCore::MemoryWidgetType::Graph && !emptyGraph) { this->raise(); this->graphView->setFocus(); - this->graphView->header->setFixedWidth(width()); } }); }