Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Replace use of obsolete QStyle.standardPixmap #3127

Merged
merged 1 commit into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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