Move delete buttons to the same line & set model to nullptr before adding lines

Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
Yihe Li 2025-04-15 20:22:21 +08:00
parent de66fe4eda
commit 521302a962
No known key found for this signature in database
2 changed files with 17 additions and 14 deletions

View File

@ -204,6 +204,7 @@ void OtherLogsPage::on_btnReload_clicked()
if (content.back() == '\n')
content = content.remove(content.size() - 1, 1);
ui->text->clear();
ui->text->setModel(nullptr);
m_model->clear();
for (auto& line : content.split('\n')) {
MessageLevel::Enum level = MessageLevel::Unknown;
@ -221,6 +222,8 @@ void OtherLogsPage::on_btnReload_clicked()
m_model->append(level, line);
}
ui->text->setModel(m_proxy);
ui->text->scrollToBottom();
}
}

View File

@ -91,15 +91,25 @@
</item>
<item row="0" column="0" colspan="5">
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0" colspan="5">
<item row="0" column="0" colspan="5">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="selectLogBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnDelete">
<property name="toolTip">
<string>Delete the selected log</string>
</property>
<property name="text">
<string>&amp;Delete This</string>
<string>&amp;Delete Selected</string>
</property>
</widget>
</item>
@ -115,7 +125,7 @@
</item>
</layout>
</item>
<item row="3" column="0" colspan="5">
<item row="1" column="0" colspan="5">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="wrapCheckbox">
@ -166,7 +176,7 @@
<string>Upload the log to the paste service configured in preferences</string>
</property>
<property name="text">
<string>Upload</string>
<string>&amp;Upload</string>
</property>
</widget>
</item>
@ -182,16 +192,6 @@
</item>
</layout>
</item>
<item row="0" column="0" colspan="5">
<widget class="QComboBox" name="selectLogBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>