forked from qt-creator/qt-creator
Showing wrong path separator in the project mode.
Review-By: Alessandro
This commit is contained in:
@@ -189,7 +189,7 @@ void ProjectWindow::updateTreeWidgetStatupProjectChanged(ProjectExplorer::Projec
|
|||||||
int count = m_treeWidget->topLevelItemCount();
|
int count = m_treeWidget->topLevelItemCount();
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
|
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
|
||||||
if (Project *project = findProject(item->text(2))) {
|
if (Project *project = findProject(item->data(2, Qt::UserRole).toString())) {
|
||||||
bool checked = (startupProject == project);
|
bool checked = (startupProject == project);
|
||||||
if (item->checkState(1) != (checked ? Qt::Checked : Qt::Unchecked))
|
if (item->checkState(1) != (checked ? Qt::Checked : Qt::Unchecked))
|
||||||
item->setCheckState(1, checked ? Qt::Checked : Qt::Unchecked);
|
item->setCheckState(1, checked ? Qt::Checked : Qt::Unchecked);
|
||||||
@@ -207,7 +207,8 @@ void ProjectWindow::updateTreeWidgetProjectAdded(ProjectExplorer::Project *proje
|
|||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
item->setText(0, projectAdded->name());
|
item->setText(0, projectAdded->name());
|
||||||
item->setIcon(0, Core::FileIconProvider::instance()->icon(fileInfo));
|
item->setIcon(0, Core::FileIconProvider::instance()->icon(fileInfo));
|
||||||
item->setText(2, fileInfo.filePath());
|
item->setData(2, Qt::UserRole, fileInfo.filePath());
|
||||||
|
item->setText(2, QDir::toNativeSeparators(fileInfo.filePath()));
|
||||||
|
|
||||||
if (projectAdded->isApplication()) {
|
if (projectAdded->isApplication()) {
|
||||||
bool checked = (m_session->startupProject() == projectAdded);
|
bool checked = (m_session->startupProject() == projectAdded);
|
||||||
@@ -221,7 +222,7 @@ void ProjectWindow::updateTreeWidgetAboutToRemoveProject(ProjectExplorer::Projec
|
|||||||
int count = m_treeWidget->topLevelItemCount();
|
int count = m_treeWidget->topLevelItemCount();
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
|
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
|
||||||
if (item->text(2) == QFileInfo(projectRemoved->file()->fileName()).filePath()) {
|
if (item->data(2, Qt::UserRole).toString() == QFileInfo(projectRemoved->file()->fileName()).filePath()) {
|
||||||
if (m_treeWidget->currentItem() == item) {
|
if (m_treeWidget->currentItem() == item) {
|
||||||
m_treeWidget->setCurrentItem(0);
|
m_treeWidget->setCurrentItem(0);
|
||||||
}
|
}
|
||||||
@@ -234,7 +235,7 @@ void ProjectWindow::updateTreeWidgetProjectRemoved(ProjectExplorer::Project *pro
|
|||||||
int count = m_treeWidget->topLevelItemCount();
|
int count = m_treeWidget->topLevelItemCount();
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
|
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
|
||||||
if (item->text(2) == QFileInfo(projectRemoved->file()->fileName()).filePath()) {
|
if (item->data(2, Qt::UserRole).toString() == QFileInfo(projectRemoved->file()->fileName()).filePath()) {
|
||||||
QTreeWidgetItem *it = m_treeWidget->takeTopLevelItem(i);
|
QTreeWidgetItem *it = m_treeWidget->takeTopLevelItem(i);
|
||||||
delete it;
|
delete it;
|
||||||
break;
|
break;
|
||||||
@@ -255,7 +256,7 @@ Project *ProjectWindow::findProject(const QString &path) const
|
|||||||
void ProjectWindow::handleCurrentItemChanged(QTreeWidgetItem *current)
|
void ProjectWindow::handleCurrentItemChanged(QTreeWidgetItem *current)
|
||||||
{
|
{
|
||||||
if (current) {
|
if (current) {
|
||||||
QString path = current->text(2);
|
QString path = current->data(2, Qt::UserRole).toString();
|
||||||
if (Project *project = findProject(path)) {
|
if (Project *project = findProject(path)) {
|
||||||
m_projectExplorer->setCurrentFile(project, path);
|
m_projectExplorer->setCurrentFile(project, path);
|
||||||
showProperties(project, QModelIndex());
|
showProperties(project, QModelIndex());
|
||||||
@@ -273,7 +274,7 @@ void ProjectWindow::handleItem(QTreeWidgetItem *item, int column)
|
|||||||
if (!item || column != 1) // startup project
|
if (!item || column != 1) // startup project
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QString path = item->text(2);
|
const QString path = item->data(2, Qt::UserRole).toString();
|
||||||
Project *project = findProject(path);
|
Project *project = findProject(path);
|
||||||
if (project && project->isApplication()) {
|
if (project && project->isApplication()) {
|
||||||
if (!(item->checkState(1) == Qt::Checked)) { // is now unchecked
|
if (!(item->checkState(1) == Qt::Checked)) { // is now unchecked
|
||||||
|
Reference in New Issue
Block a user