Permalink
Browse files

adding title to projectdock

  • Loading branch information...
stefanbeller committed Sep 13, 2011
1 parent a1722e8 commit 3695ba9dc204c7ea9ba884b6e4dc5d719d5fffff
Showing with 23 additions and 4 deletions.
  1. +20 −3 src/tiled/projectdock.cpp
  2. +3 −1 src/tiled/projectdock.h
View
@@ -28,6 +28,7 @@
#include <QAbstractItemModel>
#include <QAction>
+#include <QEvent>
#include <QFileSystemModel>
#include <QMenu>
#include <QToolBar>
@@ -86,6 +87,12 @@ ProjectDock::ProjectDock(ProjectTreeModel *m, QWidget *parent)
connect (mTreeView, SIGNAL(doubleClicked(QModelIndex)),
SLOT(doubleClick(QModelIndex)));
+ retranslateUi();
+}
+
+ProjectDock::~ProjectDock()
+{
+ delete mTreeView;
}
void ProjectDock::doubleClick(const QModelIndex &index)
@@ -97,9 +104,19 @@ void ProjectDock::doubleClick(const QModelIndex &index)
emit openFile(pti->fullPath());
}
-ProjectDock::~ProjectDock()
+void ProjectDock::retranslateUi()
{
- delete mTreeView;
+ setWindowTitle(tr("Projects"));
}
-
+void ProjectDock::changeEvent(QEvent *e)
+{
+ QDockWidget::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ retranslateUi();
+ break;
+ default:
+ break;
+ }
+}
View
@@ -40,15 +40,17 @@ class ProjectDock : public QDockWidget
public:
ProjectDock(ProjectTreeModel *m, QWidget *parent = 0);
~ProjectDock();
+protected:
+ void changeEvent(QEvent *e);
signals:
void openFile(QString file);
private slots:
void doubleClick(const QModelIndex &index);
-
private:
+ void retranslateUi();
QTreeView *mTreeView;
ProjectTreeModel *mProjectTreeModel;

0 comments on commit 3695ba9

Please sign in to comment.