Fix graph header resizing (#1189)

* Fix graph header resizing

* Remove 'this'

* Fix formatting

* Add comment
This commit is contained in:
Adam Zambrzycki 2019-02-13 08:37:05 +01:00 committed by Itay Cohen
parent 697eb66aba
commit ef2f8f6772
2 changed files with 7 additions and 3 deletions

View File

@ -118,10 +118,16 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent)
connect(mMenu, SIGNAL(copy()), this, SLOT(copySelection())); connect(mMenu, SIGNAL(copy()), this, SLOT(copySelection()));
header = new QTextEdit(viewport()); header = new QTextEdit();
header->setFixedHeight(30); header->setFixedHeight(30);
header->setReadOnly(true); header->setReadOnly(true);
header->setLineWrapMode(QTextEdit::NoWrap); 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()); highlighter = new SyntaxHighlighter(header->document());
} }

View File

@ -26,7 +26,6 @@ GraphWidget::GraphWidget(MainWindow *main, OverviewWidget *overview, QAction *ac
toggleOverview(visibility); toggleOverview(visibility);
if (visibility) { if (visibility) {
Core()->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Graph); 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) { if (type == CutterCore::MemoryWidgetType::Graph && !emptyGraph) {
this->raise(); this->raise();
this->graphView->setFocus(); this->graphView->setFocus();
this->graphView->header->setFixedWidth(width());
} }
}); });
} }