Sun, 19 Feb 2012 15:26:55 +0100
Fixed a compatibility issue with Qt 4.8.
(transplanted from 1699d46026cdd3d4ccc7e45e758fe3d7cf295b26)
--- a/DataViews/CodeMetricsDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/DataViews/CodeMetricsDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -64,15 +64,17 @@ self.resultList.header().resizeSections(QHeaderView.ResizeToContents) self.resultList.header().setStretchLastSection(True) - def __createResultItem(self, parent, strings): + def __createResultItem(self, parent, values): """ Private slot to create a new item in the result list. @param parent parent of the new item (QTreeWidget or QTreeWidgetItem) - @param strings strings to be displayed (list of strings) + @param values values to be displayed (list) @return the generated item """ - itm = QTreeWidgetItem(parent, strings) + itm = QTreeWidgetItem(parent) + for col in range(len(values)): + itm.setData(col, Qt.DisplayRole, values[col]) for col in range(1, 7): itm.setTextAlignment(col, Qt.Alignment(Qt.AlignRight)) return itm @@ -209,7 +211,7 @@ v = [] for key in ('start', 'end', 'lines', 'nloc', 'comments', 'empty'): if counters.get(key, 0): - v.append("{0:>7}".format(loc.toString(counters[key]))) + v.append(counters[key]) else: v.append('') return v
--- a/Plugins/CheckerPlugins/Pep8/Pep8StatisticsDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/CheckerPlugins/Pep8/Pep8StatisticsDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -73,8 +73,10 @@ @param code of a PEP 8 message (string) @param message PEP 8 message to be shown (string) """ - itm = QTreeWidgetItem(self.statisticsList, - ["{0:6}".format(count), code, message]) + itm = QTreeWidgetItem(self.statisticsList) + itm.setData(0, Qt.DisplayRole, count) + itm.setData(1, Qt.DisplayRole, code) + itm.setData(2, Qt.DisplayRole, message) if code.startswith("W"): itm.setIcon(1, UI.PixmapCache.getIcon("warning.png")) elif code.startswith("E"):
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -90,12 +90,14 @@ self.__lastFileItem.setExpanded(True) self.__lastFileItem.setData(0, self.filenameRole, file) - itm = QTreeWidgetItem(self.__lastFileItem, - ["{0:6}".format(line), error, sourcecode]) + itm = QTreeWidgetItem(self.__lastFileItem) if isWarning: itm.setIcon(0, UI.PixmapCache.getIcon("warning.png")) else: itm.setIcon(0, UI.PixmapCache.getIcon("syntaxError.png")) + itm.setData(0, Qt.DisplayRole, line) + itm.setData(1, Qt.DisplayRole, error) + itm.setData(2, Qt.DisplayRole, sourcecode) itm.setData(0, self.filenameRole, file) itm.setData(0, self.lineRole, int(line)) itm.setData(0, self.indexRole, index)
--- a/Plugins/CheckerPlugins/Tabnanny/TabnannyDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/CheckerPlugins/Tabnanny/TabnannyDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -68,7 +68,10 @@ @param line linenumber of faulty source (integer or string) @param sourcecode faulty line of code (string) """ - itm = QTreeWidgetItem(self.resultList, [file, str(line), sourcecode]) + itm = QTreeWidgetItem(self.resultList) + itm.setData(0, Qt.DisplayRole, file) + itm.setData(1, Qt.DisplayRole, line) + itm.setData(2, Qt.DisplayRole, sourcecode) itm.setTextAlignment(1, Qt.AlignRight) def prepare(self, fileList, project):
--- a/Plugins/VcsPlugins/vcsMercurial/BookmarksExtension/HgBookmarksListDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/BookmarksExtension/HgBookmarksListDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -200,11 +200,11 @@ @param status of the bookmark (string) @param name name of the bookmark (string) """ - itm = QTreeWidgetItem(self.bookmarksList, [ - "{0:>7}".format(revision), - changeset, - status, - name]) + itm = QTreeWidgetItem(self.bookmarksList) + itm.setData(0, Qt.DisplayRole, int(revision)) + itm.setData(1, Qt.DisplayRole, changeset) + itm.setData(2, Qt.DisplayRole, status) + itm.setData(3, Qt.DisplayRole, name) itm.setTextAlignment(0, Qt.AlignRight) itm.setTextAlignment(1, Qt.AlignRight) itm.setTextAlignment(2, Qt.AlignHCenter)
--- a/Plugins/VcsPlugins/vcsMercurial/HgTagBranchListDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgTagBranchListDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -210,11 +210,11 @@ @param status of the tag/branch (string) @param name name of the tag/branch (string) """ - itm = QTreeWidgetItem(self.tagList, [ - "{0:>7}".format(revision), - changeset, - status, - name]) + itm = QTreeWidgetItem(self.tagList) + itm.setData(0, Qt.DisplayRole, int(revision)) + itm.setData(1, Qt.DisplayRole, changeset) + itm.setData(2, Qt.DisplayRole, status) + itm.setData(3, Qt.DisplayRole, name) itm.setTextAlignment(0, Qt.AlignRight) itm.setTextAlignment(1, Qt.AlignRight) itm.setTextAlignment(2, Qt.AlignHCenter)
--- a/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -285,19 +285,16 @@ ]) else: if index == -1: - indexStr = "" - else: - indexStr = "{0:>7}".format(index) + index = "" try: statusStr = self.__statusDict[status] except KeyError: statusStr = self.trUtf8("unknown") - itm = QTreeWidgetItem(self.patchesList, [ - indexStr, - name, - statusStr, - summary - ]) + itm = QTreeWidgetItem(self.patchesList) + itm.setData(0, Qt.DisplayRole, index) + itm.setData(1, Qt.DisplayRole, name) + itm.setData(2, Qt.DisplayRole, statusStr) + itm.setData(3, Qt.DisplayRole, summary) if status == "A": # applied for column in range(itm.columnCount()):
--- a/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -142,16 +142,18 @@ rev = "" self.__lastRev = 0 else: - rev = "{0:7d}".format(revision.number) + rev = revision.number self.__lastRev = revision.number if date == "": dt = "" else: dt = formatTime(date) - itm = QTreeWidgetItem(self.logTree, - [rev, author, dt, " ".join(message.splitlines())] - ) + itm = QTreeWidgetItem(self.logTree) + itm.setData(0, Qt.DisplayRole, rev) + itm.setData(1, Qt.DisplayRole, author) + itm.setData(2, Qt.DisplayRole, dt) + itm.setData(3, Qt.DisplayRole, " ".join(message.splitlines())) changes = [] for changedPath in changedPaths:
--- a/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -106,19 +106,20 @@ if revision == "": rev = "" else: - rev = "{0:7d}".format(revision.number) + rev = revision.number if date == "": dt = "" else: dt = formatTime(date) - if size == 0: - sz = "" - else: - sz = "{0:7d}".format(size) if author is None: author = "" - itm = QTreeWidgetItem(parent, [path, rev, author, sz, dt]) + itm = QTreeWidgetItem(parent) + itm.setData(0, Qt.DisplayRole, path) + itm.setData(1, Qt.DisplayRole, rev) + itm.setData(2, Qt.DisplayRole, author) + itm.setData(3, Qt.DisplayRole, size) + itm.setData(4, Qt.DisplayRole, dt) if nodekind == pysvn.node_kind.dir: itm.setIcon(0, self.__dirIcon)
--- a/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -207,21 +207,20 @@ @param path path of the file or directory (string) """ statusText = self.trUtf8(svnStatusMap[status]) - itm = QTreeWidgetItem(self.statusList, [ - "", - changelist, - statusText, - self.trUtf8(svnStatusMap[propStatus]), - self.yesno[locked], - self.yesno[history], - self.yesno[switched], - self.lockinfo[lockinfo], - self.yesno[uptodate], - "{0:7}".format(str(revision)), - "{0:7}".format(str(change)), - author, - path, - ]) + itm = QTreeWidgetItem(self.statusList) + itm.setData(0, Qt.DisplayRole, "") + itm.setData(1, Qt.DisplayRole, changelist) + itm.setData(2, Qt.DisplayRole, statusText) + itm.setData(3, Qt.DisplayRole, self.trUtf8(svnStatusMap[propStatus])) + itm.setData(4, Qt.DisplayRole, self.yesno[locked]) + itm.setData(5, Qt.DisplayRole, self.yesno[history]) + itm.setData(6, Qt.DisplayRole, self.yesno[switched]) + itm.setData(7, Qt.DisplayRole, self.lockinfo[lockinfo]) + itm.setData(8, Qt.DisplayRole, self.yesno[uptodate]) + itm.setData(9, Qt.DisplayRole, revision) + itm.setData(10, Qt.DisplayRole, change) + itm.setData(11, Qt.DisplayRole, author) + itm.setData(12, Qt.DisplayRole, path) itm.setTextAlignment(1, Qt.AlignLeft) itm.setTextAlignment(2, Qt.AlignHCenter)
--- a/Plugins/VcsPlugins/vcsPySvn/SvnTagBranchListDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsPySvn/SvnTagBranchListDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -205,8 +205,11 @@ @param date date of the tag (string) @param name name (path) of the tag (string) """ - itm = QTreeWidgetItem(self.tagList, - ["{0:6d}".format(revision), author, date, name]) + itm = QTreeWidgetItem(self.tagList) + itm.setData(0, Qt.DisplayRole, revision) + itm.setData(1, Qt.DisplayRole, author) + itm.setData(2, Qt.DisplayRole, date) + itm.setData(3, Qt.DisplayRole, name) itm.setTextAlignment(0, Qt.AlignRight) def getTagList(self):
--- a/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -155,12 +155,11 @@ for line in message: msg.append(line.strip()) - itm = QTreeWidgetItem(self.logTree, [ - "{0:>7}".format(revision), - author, - date, - " ".join(msg), - ]) + itm = QTreeWidgetItem(self.logTree) + itm.setData(0, Qt.DisplayRole, int(revision)) + itm.setData(1, Qt.DisplayRole, author) + itm.setData(2, Qt.DisplayRole, date) + itm.setData(3, Qt.DisplayRole, " ".join(msg)) itm.setData(0, self.__messageRole, message) itm.setData(0, self.__changesRole, changedPaths)
--- a/Plugins/VcsPlugins/vcsSubversion/SvnRepoBrowserDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnRepoBrowserDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -108,13 +108,21 @@ """ path = repopath - itm = QTreeWidgetItem(self.parentItem, [ - path, - revision, - author, - size, - date, - ]) + if revision == "": + rev = "" + else: + rev = int(revision) + if size == "": + sz = "" + else: + sz = int(size) + + itm = QTreeWidgetItem(self.parentItem) + itm.setData(0, Qt.DisplayRole, path) + itm.setData(1, Qt.DisplayRole, rev) + itm.setData(2, Qt.DisplayRole, author) + itm.setData(3, Qt.DisplayRole, sz) + itm.setData(4, Qt.DisplayRole, date) if nodekind == "dir": itm.setIcon(0, self.__dirIcon)
--- a/Plugins/VcsPlugins/vcsSubversion/SvnStatusDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnStatusDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -243,21 +243,30 @@ self.currentChangelist == "": return + if revision == "": + rev = "" + else: + rev = int(revision) + if change == "": + chg = "" + else: + chg = int(change) statusText = self.status[status] - itm = QTreeWidgetItem(self.statusList, [ - self.currentChangelist, - statusText, - self.propStatus[propStatus], - self.locked[locked], - self.history[history], - self.switched[switched], - self.lockinfo[lockinfo], - self.uptodate[uptodate], - "{0:7}".format(str(revision)), - "{0:7}".format(str(change)), - author, - path, - ]) + + itm = QTreeWidgetItem(self.statusList) + itm.setData(0, Qt.DisplayRole, "") + itm.setData(1, Qt.DisplayRole, self.currentChangelist) + itm.setData(2, Qt.DisplayRole, statusText) + itm.setData(3, Qt.DisplayRole, self.propStatus[propStatus]) + itm.setData(4, Qt.DisplayRole, self.locked[locked]) + itm.setData(5, Qt.DisplayRole, self.history[history]) + itm.setData(6, Qt.DisplayRole, self.switched[switched]) + itm.setData(7, Qt.DisplayRole, self.lockinfo[lockinfo]) + itm.setData(8, Qt.DisplayRole, self.uptodate[uptodate]) + itm.setData(9, Qt.DisplayRole, rev) + itm.setData(10, Qt.DisplayRole, chg) + itm.setData(11, Qt.DisplayRole, author) + itm.setData(12, Qt.DisplayRole, path) itm.setTextAlignment(1, Qt.AlignLeft) itm.setTextAlignment(2, Qt.AlignHCenter) @@ -477,7 +486,7 @@ change, author, path) elif self.rx_status2.exactMatch(s): flags = self.rx_status2.cap(1) - path = self.rx_status2.cap(2).trimmed() + path = self.rx_status2.cap(2).strip() self.__generateItem(flags[0], flags[1], flags[2], flags[3], flags[4], flags[5], flags[7], "", "",
--- a/Plugins/VcsPlugins/vcsSubversion/SvnTagBranchListDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Plugins/VcsPlugins/vcsSubversion/SvnTagBranchListDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -220,7 +220,11 @@ @param date date of the tag (string) @param name name (path) of the tag (string) """ - itm = QTreeWidgetItem(self.tagList, [revision, author, date, name]) + itm = QTreeWidgetItem(self.tagList) + itm.setData(0, Qt.DisplayRole, int(revision)) + itm.setData(1, Qt.DisplayRole, author) + itm.setData(2, Qt.DisplayRole, date) + itm.setData(3, Qt.DisplayRole, name) itm.setTextAlignment(0, Qt.AlignRight) def __readStdout(self):
--- a/Tasks/TaskViewer.py Sun Feb 19 15:28:21 2012 +0100 +++ b/Tasks/TaskViewer.py Sun Feb 19 15:26:55 2012 +0100 @@ -54,6 +54,8 @@ @param project reference to the project object (Project) @param longtext explanatory text of the task (string) """ + super().__init__() + self.description = description self.longtext = longtext if priority in [0, 1, 2]: @@ -71,8 +73,11 @@ if isProjectTask: self.filename = self.project.getRelativePath(self.filename) - super().__init__(["", "", self.description, self.filename, - (self.lineno and "{0:6d}".format(self.lineno) or "")]) + self.setData(0, Qt.DisplayRole, "") + self.setData(1, Qt.DisplayRole, "") + self.setData(2, Qt.DisplayRole, self.description) + self.setData(3, Qt.DisplayRole, self.filename) + self.setData(4, Qt.DisplayRole, self.lineno or "") if self.completed: self.setIcon(0, UI.PixmapCache.getIcon("taskCompleted.png"))
--- a/UI/FindFileDialog.py Sun Feb 19 15:28:21 2012 +0100 +++ b/UI/FindFileDialog.py Sun Feb 19 15:26:55 2012 +0100 @@ -149,9 +149,10 @@ # is True (< 4.5.0) self.__lastFileItem.setData(0, self.md5Role, md5) - itm = QTreeWidgetItem(self.__lastFileItem, - [' {0:5d} '.format(line), text]) + itm = QTreeWidgetItem(self.__lastFileItem) itm.setTextAlignment(0, Qt.AlignRight) + itm.setData(0, Qt.DisplayRole, line) + itm.setData(1, Qt.DisplayRole, text) itm.setData(0, self.lineRole, line) itm.setData(0, self.startRole, start) itm.setData(0, self.endRole, end)