Skip to content

Commit

Permalink
Merge pull request #3127 from ales-erjavec/fixes/canvas-dock-obsolete
Browse files Browse the repository at this point in the history
[FIX] Replace use of obsolete QStyle.standardPixmap
  • Loading branch information
lanzagar authored Jul 13, 2018
2 parents fa6e605 + 6b87362 commit 371a193
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
23 changes: 12 additions & 11 deletions Orange/canvas/gui/dock.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import logging

from AnyQt.QtWidgets import QDockWidget, QAbstractButton, QSizePolicy, QStyle
from AnyQt.QtGui import QIcon, QTransform
from AnyQt.QtGui import QIcon, QTransform
from AnyQt.QtCore import Qt, QEvent
from AnyQt.QtCore import pyqtProperty as Property, pyqtSignal as Signal

Expand Down Expand Up @@ -54,18 +54,19 @@ def __init__(self, *args, **kwargs):

# Use the toolbar horizontal extension button icon as the default
# for the expand/collapse button
pm = self.style().standardPixmap(
QStyle.SP_ToolBarHorizontalExtensionButton
)
icon = self.style().standardIcon(
QStyle.SP_ToolBarHorizontalExtensionButton)

# Rotate the icon
# Mirror the icon
transform = QTransform()
transform.rotate(180)

pm_rev = pm.transformed(transform)

self.__iconRight = QIcon(pm)
self.__iconLeft = QIcon(pm_rev)
transform = transform.scale(-1.0, 1.0)
icon_rev = QIcon()
for s in (8, 12, 14, 16, 18, 24, 32, 48, 64):
pm = icon.pixmap(s, s)
icon_rev.addPixmap(pm.transformed(transform))

self.__iconRight = QIcon(icon)
self.__iconLeft = QIcon(icon_rev)

close = self.findChild(QAbstractButton,
name="qt_dockwidget_closebutton")
Expand Down
7 changes: 2 additions & 5 deletions Orange/canvas/gui/tests/test_lineedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ def test_lineedit(self):
line = LineEdit()
line.show()

action1 = QAction(QIcon(line.style().standardPixmap(
QStyle.SP_ArrowBack)
),
action1 = QAction(line.style().standardIcon(QStyle.SP_ArrowBack),
"Search", line)
menu = QMenu()
menu.addAction("Regex")
Expand All @@ -40,8 +38,7 @@ def test_lineedit(self):

line.setAction(action1, LineEdit.LeftPosition)

action2 = QAction(QIcon(line.style().standardPixmap(
QStyle.SP_TitleBarCloseButton)),
action2 = QAction(line.style().standardIcon(QStyle.SP_TitleBarCloseButton),
"Delete", line)
line.setAction(action2, LineEdit.RightPosition)

Expand Down
2 changes: 1 addition & 1 deletion Orange/canvas/gui/tests/test_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TestToolBox(test.QAppTestCase):
def test_tool_box(self):
w = toolbox.ToolBox()
style = self.app.style()
icon = QIcon(style.standardPixmap(style.SP_FileIcon))
icon = QIcon(style.standardIcon(style.SP_FileIcon))
p1 = QLabel("A Label")
p2 = QListView()
p3 = QLabel("Another\nlabel")
Expand Down

0 comments on commit 371a193

Please sign in to comment.