summaryrefslogtreecommitdiffstats
path: root/tools/linguist
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-26 21:20:37 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-26 21:20:37 (GMT)
commit6c50eb3cbd4857e830daa0cc043d834bdfa4bd06 (patch)
tree6ad27052f2880db5cb524cdd5e97a202ad913602 /tools/linguist
parent2b6af778f3b5bd32e95332f95b9eda7c26e63635 (diff)
downloadQt-6c50eb3cbd4857e830daa0cc043d834bdfa4bd06.zip
Qt-6c50eb3cbd4857e830daa0cc043d834bdfa4bd06.tar.gz
Qt-6c50eb3cbd4857e830daa0cc043d834bdfa4bd06.tar.bz2
fix crash on closing all files under certain circumstances
after all, it is no good idea to announce the removal of all columns just to let the view headers adjust themselves - it also makes the views emit currentItemChanged() which has some undesirable side effects. so don't do it an fix the header manually.
Diffstat (limited to 'tools/linguist')
-rw-r--r--tools/linguist/linguist/mainwindow.cpp14
-rw-r--r--tools/linguist/linguist/mainwindow.h1
-rw-r--r--tools/linguist/linguist/messagemodel.cpp7
3 files changed, 11 insertions, 11 deletions
diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp
index f56c966..383f5aa 100644
--- a/tools/linguist/linguist/mainwindow.cpp
+++ b/tools/linguist/linguist/mainwindow.cpp
@@ -305,8 +305,6 @@ MainWindow::MainWindow()
m_contextView->setModel(m_sortedContextsModel);
m_contextView->header()->setMovable(false);
m_contextView->setColumnHidden(0, true);
- m_contextView->header()->setResizeMode(1, QHeaderView::Stretch);
- m_contextView->header()->setResizeMode(2, QHeaderView::ResizeToContents);
m_contextView->header()->setStretchLastSection(false);
m_contextDock->setWidget(m_contextView);
@@ -335,8 +333,6 @@ MainWindow::MainWindow()
m_messageView->setModel(m_sortedMessagesModel);
m_messageView->header()->setMovable(false);
m_messageView->setColumnHidden(0, true);
- m_messageView->setColumnHidden(2, true);
- // last visible column auto-stretches
m_messagesDock->setWidget(m_messageView);
@@ -443,6 +439,7 @@ MainWindow::MainWindow()
statusBar()->addPermanentWidget(m_modifiedLabel);
modelCountChanged();
+ initViewHeaders();
resetSorting();
connect(m_dataModel, SIGNAL(modifiedChanged(bool)),
@@ -509,6 +506,14 @@ MainWindow::~MainWindow()
delete m_printer;
}
+void MainWindow::initViewHeaders()
+{
+ m_contextView->header()->setResizeMode(1, QHeaderView::Stretch);
+ m_contextView->header()->setResizeMode(2, QHeaderView::ResizeToContents);
+ m_messageView->setColumnHidden(2, true);
+ // last visible column auto-stretches
+}
+
void MainWindow::modelCountChanged()
{
int mc = m_dataModel->modelCount();
@@ -740,6 +745,7 @@ bool MainWindow::closeAll()
m_messageView->setUpdatesEnabled(false);
m_dataModel->closeAll();
modelCountChanged();
+ initViewHeaders();
recentFiles().closeGroup();
return true;
}
diff --git a/tools/linguist/linguist/mainwindow.h b/tools/linguist/linguist/mainwindow.h
index 8b46893..dc711d8 100644
--- a/tools/linguist/linguist/mainwindow.h
+++ b/tools/linguist/linguist/mainwindow.h
@@ -179,6 +179,7 @@ private:
bool prev(bool checkUnfinished);
void updateStatistics();
+ void initViewHeaders();
void modelCountChanged();
void setupMenuBar();
void setupToolBars();
diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp
index 024fd91..49cd382 100644
--- a/tools/linguist/linguist/messagemodel.cpp
+++ b/tools/linguist/linguist/messagemodel.cpp
@@ -786,16 +786,9 @@ void MultiDataModel::closeAll()
m_numFinished = 0;
m_numEditable = 0;
m_numMessages = 0;
- int delCol = m_dataModels.count();
- m_msgModel->beginRemoveColumns(QModelIndex(), 1, delCol);
- for (int i = m_multiContextList.size(); --i >= 0;) {
- m_msgModel->beginRemoveColumns(m_msgModel->createIndex(i, 0, 0), 1, delCol);
- m_msgModel->endRemoveColumns();
- }
qDeleteAll(m_dataModels);
m_dataModels.clear();
m_multiContextList.clear();
- m_msgModel->endRemoveColumns();
m_msgModel->reset();
emit allModelsDeleted();
onModifiedChanged();