diff --git a/apps/opencs/view/world/scripterrortable.cpp b/apps/opencs/view/world/scripterrortable.cpp
index 3e80c5bd47..415e6c9dca 100644
--- a/apps/opencs/view/world/scripterrortable.cpp
+++ b/apps/opencs/view/world/scripterrortable.cpp
@@ -76,8 +76,13 @@ CSVWorld::ScriptErrorTable::ScriptErrorTable (const CSMDoc::Document& document,
     QStringList headers;
     headers << "Severity" << "Line" << "Description";
     setHorizontalHeaderLabels (headers);
+#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
+    horizontalHeader()->setSectionResizeMode (0, QHeaderView::ResizeToContents);
+    horizontalHeader()->setSectionResizeMode (1, QHeaderView::ResizeToContents);
+#else
     horizontalHeader()->setResizeMode (0, QHeaderView::ResizeToContents);
     horizontalHeader()->setResizeMode (1, QHeaderView::ResizeToContents);
+#endif
     horizontalHeader()->setStretchLastSection (true);
     verticalHeader()->hide();
     setColumnHidden (3, true);