Commit 87b15b45 authored by Daniel Teske's avatar Daniel Teske
Browse files

QtVersions Settings: Allow the user to sort the qt versions

Rewrite the whole code to use a TreeModel. So that we can
use a QSortFilterProxyModel on top of that.

Change-Id: Idba5095dac897e9fcdaca0f2dcc7c77508dabcc1
Task-number: QTCREATORBUG-6200
Reviewed-by: default avatarTobias Hunger <>
Reviewed-by: default avatarLeena Miettinen <>
parent 18cca66a
This diff is collapsed.
...@@ -39,12 +39,16 @@ ...@@ -39,12 +39,16 @@
#include <QWidget> #include <QWidget>
class QTreeWidgetItem; class QSortFilterProxyModel;
class QTextBrowser; class QTextBrowser;
class QUrl; class QUrl;
namespace ProjectExplorer { class ToolChain; } namespace ProjectExplorer { class ToolChain; }
namespace Utils {
class TreeModel;
class TreeItem;
namespace QtSupport { namespace QtSupport {
...@@ -52,6 +56,8 @@ class BaseQtVersion; ...@@ -52,6 +56,8 @@ class BaseQtVersion;
class QtConfigWidget; class QtConfigWidget;
namespace Internal { namespace Internal {
class QtVersionItem;
namespace Ui { namespace Ui {
class QtVersionManager; class QtVersionManager;
class QtVersionInfo; class QtVersionInfo;
...@@ -73,11 +79,9 @@ private: ...@@ -73,11 +79,9 @@ private:
void userChangedCurrentVersion(); void userChangedCurrentVersion();
void updateWidgets(); void updateWidgets();
void updateDebuggingHelperUi(); void updateDebuggingHelperUi();
int indexForTreeItem(const QTreeWidgetItem *item) const;
QTreeWidgetItem *treeItemForIndex(int index) const;
BaseQtVersion *currentVersion() const; BaseQtVersion *currentVersion() const;
int currentIndex() const; QtVersionItem *currentItem() const;
void showDebuggingBuildLog(const QTreeWidgetItem *currentItem); void showDebuggingBuildLog(const QtVersionItem *item);
const QString m_specifyNameString; const QString m_specifyNameString;
...@@ -85,7 +89,6 @@ private: ...@@ -85,7 +89,6 @@ private:
Internal::Ui::QtVersionInfo *m_versionUi; Internal::Ui::QtVersionInfo *m_versionUi;
Internal::Ui::DebuggingHelper *m_debuggingHelperUi; Internal::Ui::DebuggingHelper *m_debuggingHelperUi;
QTextBrowser *m_infoBrowser; QTextBrowser *m_infoBrowser;
QList<BaseQtVersion *> m_versions;
int m_defaultVersion; int m_defaultVersion;
QIcon m_invalidVersionIcon; QIcon m_invalidVersionIcon;
QIcon m_warningVersionIcon; QIcon m_warningVersionIcon;
...@@ -95,7 +98,7 @@ private: ...@@ -95,7 +98,7 @@ private:
private slots: private slots:
void updateQtVersions(const QList<int> &, const QList<int> &, const QList<int> &); void updateQtVersions(const QList<int> &, const QList<int> &, const QList<int> &);
void qtVersionChanged(); void qtVersionChanged();
void versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old); void versionChanged(const QModelIndex &current, const QModelIndex &previous);
void addQtDir(); void addQtDir();
void removeQtDir(); void removeQtDir();
void editPath(); void editPath();
...@@ -127,10 +130,12 @@ private: ...@@ -127,10 +130,12 @@ private:
QByteArray defaultToolChainId(const BaseQtVersion *version); QByteArray defaultToolChainId(const BaseQtVersion *version);
bool isNameUnique(const BaseQtVersion *version); bool isNameUnique(const BaseQtVersion *version);
void updateVersionItem(BaseQtVersion *version); void updateVersionItem(QtVersionItem *item);
QTreeWidgetItem *m_autoItem; Utils::TreeModel *m_model;
QTreeWidgetItem *m_manualItem; QSortFilterProxyModel *m_filterModel;
Utils::TreeItem *m_autoItem;
Utils::TreeItem *m_manualItem;
}; };
class QtOptionsPage : public Core::IOptionsPage class QtOptionsPage : public Core::IOptionsPage
...@@ -14,23 +14,10 @@ ...@@ -14,23 +14,10 @@
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QTreeWidget" name="qtdirList"> <widget class="QTreeView" name="qtdirList">
<property name="uniformRowHeights"> <property name="uniformRowHeights">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="columnCount">
<property name="text">
<property name="text">
<string>qmake Location</string>
</widget> </widget>
</item> </item>
<item> <item>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment