diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 90825e2392b2d70e43c7a25b8a3752299a933894 (patch) | |
tree | e33aa27f02b74604afbfd0ea4f1cfca8833d882a /python/pyqt/examples2/splitter.py | |
download | tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'python/pyqt/examples2/splitter.py')
-rwxr-xr-x | python/pyqt/examples2/splitter.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/python/pyqt/examples2/splitter.py b/python/pyqt/examples2/splitter.py new file mode 100755 index 00000000..1c2fef7b --- /dev/null +++ b/python/pyqt/examples2/splitter.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python + +import sys +from qt import * + +class Test(QWidget): + def __init__(self, parent=None, name='Test', f=0): + QWidget.__init__(self, parent, name, f) + + def paintEvent(self, e): + p = QPainter(self) + p.setClipRect(e.rect()) + d = 1000 + x1 = 0 + x2 = self.width() - 1 + y1 = 0 + y2 = self.height() - 1 + + x = (x1+x2)/2 + p.drawLine(x, y1, x+d, y1+d) + p.drawLine(x, y1, x-d, y1+d) + p.drawLine(x, y2, x+d, y2-d) + p.drawLine(x, y2, x-d, y2-d) + + y = (y1+y2)/2 + p.drawLine(x1, y, x1+d, y+d) + p.drawLine(x1, y, x1+d, y-d) + p.drawLine(x2, y, x2-d, y+d) + p.drawLine(x2, y, x2-d, y-d) + + +if __name__=="__main__": + a = QApplication(sys.argv) + + s1 = QSplitter(Qt.Vertical, None, "main") + s2 = QSplitter(Qt.Horizontal, s1, "top") + + t1 = Test(s2) + t1.setBackgroundColor(Qt.blue.light(180)) + t1.setMinimumSize(50,0) + + t2 = Test(s2) + t2.setBackgroundColor(Qt.green.light(180)) + s2.setResizeMode(t2, QSplitter.KeepSize) + s2.moveToFirst(t2) + + s3 = QSplitter(Qt.Horizontal, s1, "bottom") + + t3 = Test(s3) + t3.setBackgroundColor(Qt.red) + t4 = Test(s3) + t4.setBackgroundColor(Qt.white) + + t5 = Test(s3) + t5.setMaximumHeight(250) + t5.setMinimumSize(80,50) + t5.setBackgroundColor(Qt.yellow) + + s1.setOpaqueResize(1) + s2.setOpaqueResize(1) + s3.setOpaqueResize(1) + + a.setMainWidget(s1) + s1.show() + a.exec_loop() |