[PyKDE] Changing Color in QTable entries
David Sathiaraj
davids at mistral.srcc.lsu.edu
Mon Nov 11 16:29:01 GMT 2002
Hello QT folks:
I have been trying to implement a GUI that uses the QTable and
QTableItem methods. I have a table of entries and
I want to keep track of the changes I make to the table entries.
Now I want to highlight the changed cells with a different color. I
sub-classed QTableItem and re-implemented the
QTableItem::Paint method to change the color of the entries. However, I
see a quick flicker of color change and
then the old white background seems to override it. I believe before
the color change is incorporated, garbage collection
takes over and clears the colored objects created. If anyone has
encountered such a problem, can you tell me how I could force the color
of the
changed items to persist?
I have attached a small test snippet - The main process is coded in
changeColor.py. Table.py is the code generated by Qt designer that is
used by changeColor.py. One can run changeColor.py to test it. The
button 'show changes' should ideally color the items.
Regards,
David S.
-------------- next part --------------
from qt import *
from qttable import *
from table import Form1
import sys
class changeColor(Form1):
def __init__(self,parent=None):
Form1.__init__(self,parent)
self.connect(self.insertB,SIGNAL('clicked()'),self.insertData)
self.connect(self.Table1,SIGNAL('valueChanged(int,int)'),self.trackChanges)
self.connect(self.showB,SIGNAL('clicked()'),self.color)
self.list=[]
def insertData(self):
for row in xrange(3):
for col in xrange(3):
self.Table1.setText(row,col,str(row))
self.list=[]
def trackChanges(self,row,col):
if [row,col] not in self.list:
self.list.append([row,col])
print self.list
def color(self):
row=0
col=0
for cell in self.list:
row=cell[0]
col=cell[1]
self.item=colorItem(self.Table1,QTableItem.Always,self.Table1.text(row,col))
self.Table1.setItem(row,col,self.item)
class colorItem(QTableItem):
def __init__(self, table, edittype, text):
QTableItem.__init__(self, table, edittype, text)
print "New MyTableItem"
def paint(self, painter, colorgroup, rect, selected):
print "paint called"
cg = QColorGroup(colorgroup)
cg.setColor(QColorGroup.Base, Qt.red)
QTableItem.paint(self,painter, cg, rect, selected)
if __name__=="__main__":
app = QApplication(sys.argv)
print app.desktop().width()
print app.desktop().height()
cc = changeColor()
app.setMainWidget(cc)
cc.show()
app.exec_loop()
-------------- next part --------------
# Form implementation generated from reading ui file 'table.ui'
#
# Created: Fri Nov 8 15:45:15 2002
# by: The PyQt User Interface Compiler (pyuic)
#
# WARNING! All changes made in this file will be lost!
from qt import *
from qttable import QTable
image0_data = [
"22 22 7 1",
". c None",
"# c #000000",
"b c #2e2e2e",
"c c #5c5c5c",
"d c #878787",
"e c #c2c2c2",
"a c #ffffff",
"......................",
"....##########........",
"....#aaaaaaa#b#.......",
"....#aaaaaaa#cb#......",
"....#aaaaaaa#dcb#.....",
"....#aaaaaaa#edcb#....",
"....#aaaaaaa#aedcb#...",
"....#aaaaaaa#######...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....###############...",
"......................",
"......................"
]
image1_data = [
"22 22 5 1",
". c None",
"# c #000000",
"c c #848200",
"a c #ffff00",
"b c #ffffff",
"......................",
"......................",
"......................",
"............####....#.",
"...........#....##.##.",
"..................###.",
".................####.",
".####...........#####.",
"#abab##########.......",
"#babababababab#.......",
"#ababababababa#.......",
"#babababababab#.......",
"#ababab###############",
"#babab##cccccccccccc##",
"#abab##cccccccccccc##.",
"#bab##cccccccccccc##..",
"#ab##cccccccccccc##...",
"#b##cccccccccccc##....",
"###cccccccccccc##.....",
"##cccccccccccc##......",
"###############.......",
"......................"
]
image2_data = [
"22 22 5 1",
". c None",
"# c #000000",
"a c #848200",
"b c #c1c1c1",
"c c #cab5d1",
"......................",
".####################.",
".#aa#bbbbbbbbbbbb#bb#.",
".#aa#bbbbbbbbbbbb#bb#.",
".#aa#bbbbbbbbbcbb####.",
".#aa#bbbccbbbbbbb#aa#.",
".#aa#bbbccbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aaa############aaa#.",
".#aaaaaaaaaaaaaaaaaa#.",
".#aaaaaaaaaaaaaaaaaa#.",
".#aaa#############aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
"..##################..",
"......................"
]
image3_data = [
"22 22 88 2",
"Qt c None",
".2 c #000000",
".S c #08ff08",
"#v c #100810",
".U c #101010",
"#c c #101018",
".M c #181018",
"#e c #181818",
".A c #181821",
".L c #211821",
"#l c #212121",
".z c #212129",
"#m c #292129",
"#u c #292929",
"#n c #292931",
".R c #29ff29",
"#o c #312931",
".T c #313131",
"#p c #313139",
".Z c #31ff31",
"#q c #393139",
"#t c #393939",
".y c #393942",
"#s c #423942",
".o c #424242",
"#h c #4a4a52",
".n c #5a525a",
"#r c #5a5a63",
".I c #5ace5a",
"#b c #6b636b",
".p c #6b6b6b",
".x c #6b6b73",
".Y c #6bff63",
".l c #736b73",
".t c #7b737b",
".s c #7b7384",
".0 c #7bff7b",
".r c #847b84",
".u c #847b8c",
"#g c #84848c",
".v c #8c7b94",
"#i c #8c848c",
".w c #8c8494",
"#j c #8c8c8c",
".8 c #8c8c94",
".m c #948c94",
"#k c #948c9c",
"#f c #949494",
".q c #94949c",
".J c #94c694",
"#d c #9c949c",
"#a c #9c94a5",
".k c #9c9c9c",
".N c #9c9ca5",
".H c #9ccea5",
".K c #a59ca5",
"#. c #a59cad",
".i c #a5a5a5",
".3 c #a5a5ad",
"## c #ad9cad",
".V c #ada5ad",
".d c #adadad",
".j c #adadb5",
".9 c #b5adb5",
".# c #b5b5b5",
".a c #bdbdbd",
".7 c #bdd6bd",
".c c #c6c6c6",
".5 c #cec6ce",
".b c #cecece",
".4 c #ceced6",
".F c #d6ced6",
".G c #d6cede",
".h c #d6d6d6",
".E c #d6d6de",
".Q c #d6ffd6",
".B c #ded6de",
".1 c #ded6e7",
".g c #dedede",
".D c #dedee7",
".6 c #e7dee7",
".f c #e7e7e7",
".C c #e7e7ef",
".X c #e7ffe7",
".O c #efe7ef",
".e c #efefef",
".W c #f7f7f7",
".P c #ffffff",
"QtQtQtQtQtQt.#.a.b.b.b.b.c.c.a.a.d.aQtQtQtQt",
"QtQtQtQtQtQt.a.e.f.f.f.f.f.e.e.e.g.aQtQtQtQt",
"QtQtQtQtQtQt.a.c.c.c.b.b.c.c.c.c.a.cQtQtQtQt",
"QtQtQtQtQtQt.#.a.a.a.a.#.a.a.#.#.d.aQtQtQtQt",
"QtQtQtQtQt.c.d.c.a.c.c.c.a.a.a.c.#QtQtQtQtQt",
"QtQtQtQtQt.a.a.#.a.a.a.a.a.a.c.c.#QtQtQtQtQt",
"QtQtQtQtQt.a.#.c.a.a.a.a.a.c.a.c.dQtQtQtQtQt",
"QtQtQtQtQt.c.a.a.a.a.a.a.a.a.a.a.#QtQtQtQtQt",
"QtQtQtQtQt.d.b.f.g.g.g.g.g.g.h.g.i.i.jQtQtQt",
"QtQtQt.a.k.l.#.h.b.h.b.h.b.h.g.g.m.n.o.p.#Qt",
"QtQt.a.q.r.s.t.t.t.t.t.t.t.u.v.w.x.y.z.A.o.i",
"Qt.a.k.B.C.D.B.E.E.E.E.F.G.H.I.J.K.o.L.L.M.y",
".a.N.O.P.P.P.P.P.P.P.P.P.Q.R.S.R.b.v.T.A.U.L",
".V.W.P.P.P.P.P.P.P.P.P.P.X.Y.Z.0.P.1.t.A.2.L",
".3.E.4.5.4.h.E.E.g.6.D.B.D.E.7.F.4.5.8.M.2.A",
".m.9.j.V.3#..3.K#.#..i#..K#.###a.q.8#b#c.2.L",
".m.j.j#..3.K.K.K.N.K.N.N.N.N#a#d#d.w#b#c.2#e",
"#f#.#..K.N.K.N.N.N#a.k#a#d#d#d#a.m#g#b.M.2#h",
".m.3.K.K#a.k#a#d#a.k#a#d#a#d.q.m.8#i.x#c#e.d",
"#f#g#i.w#j.w#i.8.w#i.8.8.m.8.m#k.8.w#b#e#fQt",
".#.l.z.A#l.z#m#m#m#n#o#o#p#p#q#q#p#o#p#fQtQt",
"QtQt.d#r#s#s#t#p.T.T.T#u#u.z#e#e#v.o.kQtQtQt"
]
image4_data = [
"22 22 3 1",
". c None",
"# c #000084",
"a c #848284",
"......................",
"......................",
"......................",
"......................",
"......................",
"...........######a....",
"..#......##########...",
"..##...####......##a..",
"..###.###.........##..",
"..######..........##..",
"..#####...........##..",
"..######..........##..",
"..#######.........##..",
"..########.......##a..",
"...............a###...",
"...............###....",
"......................",
"......................",
"......................",
"......................",
"......................",
"......................"
]
image5_data = [
"22 22 3 1",
". c None",
"a c #000084",
"# c #848284",
"......................",
"......................",
"......................",
"......................",
"......................",
"....#aaaaaa...........",
"...aaaaaaaaaa......a..",
"..#aa......aaaa...aa..",
"..aa.........aaa.aaa..",
"..aa..........aaaaaa..",
"..aa...........aaaaa..",
"..aa..........aaaaaa..",
"..aa.........aaaaaaa..",
"..#aa.......aaaaaaaa..",
"...aaa#...............",
"....aaa...............",
"......................",
"......................",
"......................",
"......................",
"......................",
"......................"
]
image6_data = [
"22 22 3 1",
". c None",
"# c #000000",
"a c #000082",
"......................",
".......#.....#........",
".......#.....#........",
".......#.....#........",
".......#....##........",
".......##...#.........",
"........#...#.........",
"........##.##.........",
".........###..........",
".........###..........",
"..........#...........",
".........a#a..........",
"........aa.aaa........",
".......a.a.a..a.......",
"......a..a.a...a......",
".....a...a.a....a.....",
"....a....a.a....a.....",
"....a....a..a...a.....",
"....a....a..a..a......",
"....a...a....aa.......",
".....aaa..............",
"......................"
]
image7_data = [
"22 22 6 1",
". c None",
"# c #000000",
"b c #000082",
"c c #3c3cfd",
"d c #8b8bfd",
"a c #ffffff",
"......................",
"......................",
"########..............",
"#aaaaaa##.............",
"#a####a#a#............",
"#aaaaaa#aa#...........",
"#a####a#bbbbbbbb......",
"#aaaaaa#baaaaaabb.....",
"#a#####aba####abcb....",
"#aaaaaaabaaaaaabdcb...",
"#a#####aba####abadcb..",
"#aaaaaaabaaaaaabbbbbb.",
"#a#####aba####aaaaaab.",
"#aaaaaaabaaaaaaaaaaab.",
"#a#####aba#########ab.",
"#aaaaaaabaaaaaaaaaaab.",
"########ba#########ab.",
"........baaaaaaaaaaab.",
"........ba#########ab.",
"........baaaaaaaaaaab.",
"........bbbbbbbbbbbbb.",
"......................"
]
image8_data = [
"22 22 8 1",
". c None",
"# c #000000",
"e c #000084",
"c c #848200",
"b c #848284",
"d c #c6c3c6",
"a c #ffff00",
"f c #ffffff",
"......................",
".......#####..........",
"..######aaa######.....",
".######aaaaa######....",
"##bcb##a###a##bcb##...",
"#bcb#ddddddddd#bcb#...",
"#cbc#ddddddddd#cbc#...",
"#bcb###########bcb#...",
"#cbcbcbcbcbcbcbcbc#...",
"#bcbcbcbcbcbcbcbcb#...",
"#cbcbcbceeeeeeeeee#...",
"#bcbcbcbefffffffefe...",
"#cbcbcbcefeeeeefeffe..",
"#bcbcbcbefffffffefffe.",
"#cbcbcbcefeeeeefeffffe",
"#bcbcbcbefffffffeeeeee",
"#cbcbcbcefeeeeeffffffe",
"#bcbcbcbeffffffffffffe",
"#cbcbcbcefeeeeeeeeeefe",
".#######effffffffffffe",
"........eeeeeeeeeeeeee",
"......................"
]
image9_data = [
"22 22 106 2",
"Qt c None",
"#N c #212121",
"#J c #292929",
"#K c #393939",
"#M c #424242",
".m c #5a5a5a",
"#r c #5a736b",
"#A c #5a9c84",
"#B c #636363",
".N c #636b6b",
"#G c #63736b",
"#v c #63ad8c",
"#H c #6b6b6b",
".c c #6b7373",
"#D c #6b7b73",
".l c #6b7b7b",
".W c #6b847b",
".t c #6b8c7b",
"#x c #6b9484",
"#w c #6bad94",
".u c #737373",
".v c #737b73",
".g c #737b7b",
".D c #738c84",
".7 c #739484",
"#d c #73948c",
"#z c #73a59c",
"#p c #73b594",
"#o c #73bd9c",
".b c #7b7b7b",
".O c #7b8484",
"#a c #7bad94",
"#q c #7bad9c",
"#i c #7bb59c",
".5 c #7bbd9c",
"#b c #7bbda5",
"#h c #7bc69c",
"#y c #7bc6a5",
".8 c #848484",
".4 c #8484b5",
".h c #849c94",
"#n c #84a5ad",
".V c #84ada5",
"#E c #84b59c",
"#F c #84b5a5",
"#j c #84bda5",
"#t c #84c6a5",
"#l c #84cead",
".E c #8c8c8c",
"#g c #8c8cbd",
"## c #8c94b5",
"#m c #8cadbd",
"#c c #8cb5a5",
".L c #8cc6ad",
".T c #8ccead",
"#f c #8cceb5",
".a c #949494",
".n c #94a59c",
"#u c #94a5ce",
".k c #94bdad",
".M c #94c6ad",
".6 c #94c6b5",
".B c #94ceb5",
".1 c #94d6b5",
".C c #94d6bd",
".9 c #94debd",
".K c #9c94d6",
".d c #9c9c9c",
".w c #9cbdb5",
"#. c #9cbdd6",
"#s c #9ccebd",
".2 c #9ccece",
".0 c #9cdebd",
".S c #9ce7bd",
".Z c #9ce7c6",
".U c #a594de",
"#L c #a5a5a5",
".A c #a5b5de",
".3 c #a5b5ef",
".I c #a5cece",
"#k c #a5dec6",
".s c #a5e7c6",
".f c #adadad",
".J c #adadef",
".R c #adb5de",
".i c #adcec6",
".P c #add6c6",
".j c #addece",
"#e c #ade7ce",
".# c #b5b5b5",
".H c #b5bdde",
".Q c #b5dede",
".r c #b5efd6",
".e c #bdbdbd",
".z c #bdc6f7",
".y c #bdd6ff",
".X c #bde7d6",
".q c #bdefde",
".Y c #bdf7de",
"#I c #c6c6c6",
".x c #c6def7",
".p c #c6f7e7",
"#C c #ced6ce",
".G c #cedeff",
".o c #ceffef",
".F c #d6fff7",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
"QtQtQt.#.a.b.c.c.b.d.eQtQtQtQtQtQtQtQtQtQtQt",
"QtQt.f.g.h.i.j.j.k.l.b.#QtQtQtQtQtQtQtQtQtQt",
"Qt.f.m.n.o.o.p.q.r.s.t.u.eQtQtQtQtQtQtQtQtQt",
".e.v.w.q.p.x.y.z.A.B.C.D.EQtQtQtQtQtQtQtQtQt",
".d.h.F.q.G.H.I.I.J.K.L.M.N.#QtQtQtQtQtQtQtQt",
".O.P.o.Q.R.B.S.T.A.U.V.B.W.dQtQtQtQtQtQtQtQt",
".g.X.Y.Z.Z.0.1.2.3.4.5.6.7.8QtQtQtQtQtQtQtQt",
".g.j.r.0.9.1#..3###a#b#c#d.8QtQtQtQtQtQtQtQt",
".v.P#e.1.1#f.A#g.5#h#i#j.W.EQtQtQtQtQtQtQtQt",
".E#c#k#f.L#l#m#n#o#p#p#q#r.fQtQtQtQtQtQtQtQt",
".f.g#s#t#t#b#u.4#v#w#w#x.u.eQtQtQtQtQtQtQtQt",
"Qt.E.t#y#b.5#z#d#p#A#A#B.d#C.f.eQtQtQtQtQtQt",
"Qt.e.b#D#E#F#j#i#a.7.m.dQt.f#B.m.fQtQtQtQtQt",
"QtQt.e.E.N#D.W.W#G#H.fQtQt#I.b#J#K.E.eQtQtQt",
"QtQtQtQt.#.d.E.a#L#IQtQtQtQtQt#L#M#J#H.fQtQt",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.e.u#N#K.aQt",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.d#K#N#H",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.##B.m",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"
]
class Form1(QMainWindow):
def __init__(self,parent = None,name = None,fl = 0):
QMainWindow.__init__(self,parent,name,fl)
self.statusBar()
image0 = QPixmap(image0_data)
image1 = QPixmap(image1_data)
image2 = QPixmap(image2_data)
image3 = QPixmap(image3_data)
image4 = QPixmap(image4_data)
image5 = QPixmap(image5_data)
image6 = QPixmap(image6_data)
image7 = QPixmap(image7_data)
image8 = QPixmap(image8_data)
image9 = QPixmap(image9_data)
if name == None:
self.setName("Form1")
self.resize(961,705)
self.setCaption(self.trUtf8("Form1"))
self.setCentralWidget(QWidget(self,"qt_central_widget"))
self.Table1 = QTable(self.centralWidget(),"Table1")
self.Table1.setGeometry(QRect(60,60,540,320))
self.Table1.setNumRows(3)
self.Table1.setNumCols(3)
self.insertB = QPushButton(self.centralWidget(),"insertB")
self.insertB.setGeometry(QRect(160,440,120,40))
self.insertB.setText(self.trUtf8("insert Data"))
self.showB = QPushButton(self.centralWidget(),"showB")
self.showB.setGeometry(QRect(310,440,120,40))
self.showB.setText(self.trUtf8("Show Changes"))
self.fileNewAction = QAction(self,"fileNewAction")
self.fileNewAction.setIconSet(QIconSet(image0))
self.fileNewAction.setText(self.trUtf8("New"))
self.fileNewAction.setMenuText(self.trUtf8("&New"))
self.fileNewAction.setAccel(4194382)
self.fileOpenAction = QAction(self,"fileOpenAction")
self.fileOpenAction.setIconSet(QIconSet(image1))
self.fileOpenAction.setText(self.trUtf8("Open"))
self.fileOpenAction.setMenuText(self.trUtf8("&Open..."))
self.fileOpenAction.setAccel(4194383)
self.fileSaveAction = QAction(self,"fileSaveAction")
self.fileSaveAction.setIconSet(QIconSet(image2))
self.fileSaveAction.setText(self.trUtf8("Save"))
self.fileSaveAction.setMenuText(self.trUtf8("&Save"))
self.fileSaveAction.setAccel(4194387)
self.fileSaveAsAction = QAction(self,"fileSaveAsAction")
self.fileSaveAsAction.setText(self.trUtf8("Save As"))
self.fileSaveAsAction.setMenuText(self.trUtf8("Save &As..."))
self.fileSaveAsAction.setAccel(0)
self.filePrintAction = QAction(self,"filePrintAction")
self.filePrintAction.setIconSet(QIconSet(image3))
self.filePrintAction.setText(self.trUtf8("Print"))
self.filePrintAction.setMenuText(self.trUtf8("&Print..."))
self.filePrintAction.setAccel(4194384)
self.fileExitAction = QAction(self,"fileExitAction")
self.fileExitAction.setText(self.trUtf8("Exit"))
self.fileExitAction.setMenuText(self.trUtf8("E&xit"))
self.fileExitAction.setAccel(0)
self.editUndoAction = QAction(self,"editUndoAction")
self.editUndoAction.setIconSet(QIconSet(image4))
self.editUndoAction.setText(self.trUtf8("Undo"))
self.editUndoAction.setMenuText(self.trUtf8("&Undo"))
self.editUndoAction.setAccel(4194394)
self.editRedoAction = QAction(self,"editRedoAction")
self.editRedoAction.setIconSet(QIconSet(image5))
self.editRedoAction.setText(self.trUtf8("Redo"))
self.editRedoAction.setMenuText(self.trUtf8("&Redo"))
self.editRedoAction.setAccel(4194393)
self.editCutAction = QAction(self,"editCutAction")
self.editCutAction.setIconSet(QIconSet(image6))
self.editCutAction.setText(self.trUtf8("Cut"))
self.editCutAction.setMenuText(self.trUtf8("&Cut"))
self.editCutAction.setAccel(4194392)
self.editCopyAction = QAction(self,"editCopyAction")
self.editCopyAction.setIconSet(QIconSet(image7))
self.editCopyAction.setText(self.trUtf8("Copy"))
self.editCopyAction.setMenuText(self.trUtf8("C&opy"))
self.editCopyAction.setAccel(4194371)
self.editPasteAction = QAction(self,"editPasteAction")
self.editPasteAction.setIconSet(QIconSet(image8))
self.editPasteAction.setText(self.trUtf8("Paste"))
self.editPasteAction.setMenuText(self.trUtf8("&Paste"))
self.editPasteAction.setAccel(4194390)
self.editFindAction = QAction(self,"editFindAction")
self.editFindAction.setIconSet(QIconSet(image9))
self.editFindAction.setText(self.trUtf8("Find"))
self.editFindAction.setMenuText(self.trUtf8("&Find..."))
self.editFindAction.setAccel(4194374)
self.helpContentsAction = QAction(self,"helpContentsAction")
self.helpContentsAction.setText(self.trUtf8("Contents"))
self.helpContentsAction.setMenuText(self.trUtf8("&Contents..."))
self.helpContentsAction.setAccel(0)
self.helpIndexAction = QAction(self,"helpIndexAction")
self.helpIndexAction.setText(self.trUtf8("Index"))
self.helpIndexAction.setMenuText(self.trUtf8("&Index..."))
self.helpIndexAction.setAccel(0)
self.helpAboutAction = QAction(self,"helpAboutAction")
self.helpAboutAction.setText(self.trUtf8("About"))
self.helpAboutAction.setMenuText(self.trUtf8("&About..."))
self.helpAboutAction.setAccel(0)
self.menubar = QMenuBar(self,"menubar")
self.fileMenu = QPopupMenu(self)
self.fileNewAction.addTo(self.fileMenu)
self.fileOpenAction.addTo(self.fileMenu)
self.fileSaveAction.addTo(self.fileMenu)
self.fileSaveAsAction.addTo(self.fileMenu)
self.fileMenu.insertSeparator()
self.filePrintAction.addTo(self.fileMenu)
self.fileMenu.insertSeparator()
self.fileExitAction.addTo(self.fileMenu)
self.menubar.insertItem(self.trUtf8("&File"),self.fileMenu)
self.editMenu = QPopupMenu(self)
self.editUndoAction.addTo(self.editMenu)
self.editRedoAction.addTo(self.editMenu)
self.editMenu.insertSeparator()
self.editCutAction.addTo(self.editMenu)
self.editCopyAction.addTo(self.editMenu)
self.editPasteAction.addTo(self.editMenu)
self.editMenu.insertSeparator()
self.editFindAction.addTo(self.editMenu)
self.menubar.insertItem(self.trUtf8("&Edit"),self.editMenu)
self.helpMenu = QPopupMenu(self)
self.helpContentsAction.addTo(self.helpMenu)
self.helpIndexAction.addTo(self.helpMenu)
self.helpMenu.insertSeparator()
self.helpAboutAction.addTo(self.helpMenu)
self.menubar.insertItem(self.trUtf8("&Help"),self.helpMenu)
self.connect(self.fileNewAction,SIGNAL("activated()"),self.fileNew)
self.connect(self.fileOpenAction,SIGNAL("activated()"),self.fileOpen)
self.connect(self.fileSaveAction,SIGNAL("activated()"),self.fileSave)
self.connect(self.fileSaveAsAction,SIGNAL("activated()"),self.fileSaveAs)
self.connect(self.filePrintAction,SIGNAL("activated()"),self.filePrint)
self.connect(self.fileExitAction,SIGNAL("activated()"),self.fileExit)
self.connect(self.editUndoAction,SIGNAL("activated()"),self.editUndo)
self.connect(self.editRedoAction,SIGNAL("activated()"),self.editRedo)
self.connect(self.editCutAction,SIGNAL("activated()"),self.editCut)
self.connect(self.editCopyAction,SIGNAL("activated()"),self.editCopy)
self.connect(self.editPasteAction,SIGNAL("activated()"),self.editPaste)
self.connect(self.editFindAction,SIGNAL("activated()"),self.editFind)
self.connect(self.helpIndexAction,SIGNAL("activated()"),self.helpIndex)
self.connect(self.helpContentsAction,SIGNAL("activated()"),self.helpContents)
self.connect(self.helpAboutAction,SIGNAL("activated()"),self.helpAbout)
def fileNew(self):
print "Form1.fileNew(): Not implemented yet"
def fileOpen(self):
print "Form1.fileOpen(): Not implemented yet"
def fileSave(self):
print "Form1.fileSave(): Not implemented yet"
def fileSaveAs(self):
print "Form1.fileSaveAs(): Not implemented yet"
def filePrint(self):
print "Form1.filePrint(): Not implemented yet"
def fileExit(self):
print "Form1.fileExit(): Not implemented yet"
def editUndo(self):
print "Form1.editUndo(): Not implemented yet"
def editRedo(self):
print "Form1.editRedo(): Not implemented yet"
def editCut(self):
print "Form1.editCut(): Not implemented yet"
def editCopy(self):
print "Form1.editCopy(): Not implemented yet"
def editPaste(self):
print "Form1.editPaste(): Not implemented yet"
def editFind(self):
print "Form1.editFind(): Not implemented yet"
def helpIndex(self):
print "Form1.helpIndex(): Not implemented yet"
def helpContents(self):
print "Form1.helpContents(): Not implemented yet"
def helpAbout(self):
print "Form1.helpAbout(): Not implemented yet"
More information about the PyQt
mailing list