Skip to content

Commit 1ecc362

Browse files
author
Shuge Lee
committed
Added disabled highlight for QTreeView demo.
1 parent 0af09b2 commit 1ecc362

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

common_widgets/icon/use_buildin_icon.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def __init__(self):
4949

5050
icon = QtGui.QIcon.fromTheme("user-online", my_online)
5151
print "icon not found:", icon.isNull()
52+
print "availableSizes:", icon.availableSizes()
5253

5354
lab = QtGui.QLabel('foo', self)
5455
pixmap = icon.pixmap(QtCore.QSize(32, 32), QtGui.QIcon.Normal, QtGui.QIcon.On)

style_and_theme/disable_highlight.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env python
2+
#-*- coding:utf-8 -*-
3+
"""
4+
disable highlight focused widget
5+
6+
Test environment:
7+
Mac OS X 10.6.8
8+
9+
http://stackoverflow.com/questions/1987546/qt4-stylesheets-and-focus-rect
10+
"""
11+
import sys
12+
13+
try:
14+
from PySide import QtCore
15+
from PySide import QtGui
16+
except ImportError:
17+
from PyQt4 import QtCore
18+
from PyQt4 import QtGui
19+
20+
class Demo(QtGui.QWidget):
21+
def __init__(self):
22+
super(Demo, self).__init__()
23+
24+
x, y, w, h = 500, 200, 300, 400
25+
self.setGeometry(x, y, w, h)
26+
27+
28+
# highlight
29+
tv = QtGui.QTreeView(self)
30+
tv.setGeometry(10, 10, 100, 100)
31+
32+
33+
# disable highlight
34+
tv2 = QtGui.QTreeView(self)
35+
tv2.setGeometry(10, 110, 100, 100)
36+
37+
tv2.setFrameShape(QtGui.QFrame.NoFrame)
38+
tv2.setFrameShadow(QtGui.QFrame.Plain)
39+
tv2.setAttribute(QtCore.Qt.WA_MacShowFocusRect, 0)
40+
41+
42+
def show_and_raise(self):
43+
self.show()
44+
self.raise_()
45+
46+
47+
if __name__ == "__main__":
48+
app = QtGui.QApplication(sys.argv)
49+
50+
demo = Demo()
51+
demo.show_and_raise()
52+
53+
sys.exit(app.exec_())

0 commit comments

Comments
 (0)