Wrap LogsWindow contents

This commit is contained in:
Srivats P 2019-02-25 21:45:39 +05:30
parent 2b8940ac49
commit 4a1b41670c

View File

@ -58,6 +58,9 @@ LogsWindow::LogsWindow(LogsModel *model, QWidget *parent)
connect(model, SIGNAL(rowsInserted(const QModelIndex&, int, int)), connect(model, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
SLOT(when_rowsInserted(const QModelIndex&, int, int))); SLOT(when_rowsInserted(const QModelIndex&, int, int)));
connect(logs->horizontalHeader(), SIGNAL(sectionResized(int, int, int)),
logs, SLOT(resizeRowsToContents()));
#if defined(QT_NO_DEBUG) || QT_VERSION < 0x050700 #if defined(QT_NO_DEBUG) || QT_VERSION < 0x050700
logsModelTest_ = nullptr; logsModelTest_ = nullptr;
#else #else
@ -75,6 +78,7 @@ LogsWindow::~LogsWindow()
void LogsWindow::when_visibilityChanged(bool visible) void LogsWindow::when_visibilityChanged(bool visible)
{ {
if (visible) { if (visible) {
logs->resizeRowsToContents();
state_ = kInfo; state_ = kInfo;
notify(); notify();
} }
@ -86,8 +90,11 @@ void LogsWindow::when_visibilityChanged(bool visible)
void LogsWindow::when_rowsInserted(const QModelIndex &parent, void LogsWindow::when_rowsInserted(const QModelIndex &parent,
int first, int last) int first, int last)
{ {
if (isVisible_)
if (isVisible_) {
logs->resizeRowsToContents();
return; return;
}
if (state_ == kError) if (state_ == kError)
return; return;