[maemo-developers] How to make a finger scrollable frame for widgets in Qt 4.5?
From: Luca Donaggio donaggio at gmail.comDate: Mon Mar 22 12:26:21 EET 2010
- Previous message: How to make a finger scrollable frame for widgets in Qt 4.5?
- Next message: How to make a finger scrollable frame for widgets in Qt 4.5?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This is an example in python using PySide bindings dor Qt4.6:
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtMaemo5 import *
import sys
class StackedWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
# This attribute makes the whole Stacked Window thing work
self.setAttribute(Qt.WA_Maemo5StackedWindow)
# Create button and layout
self.cw = QWidget(self)
# This is ugly, but otherwise widgets don't horizontally expand
inside the ScrollArea
self.cw.setMinimumSize(800,0)
self.vbox = QVBoxLayout(self.cw)
self.button = QMaemo5ValueButton(self)
self.button.setText(QString('Push me'))
self.button.setValueText(QString('I told you to push me!'))
self.vbox.addWidget(self.button)
self.label = QLabel(self)
self.label.setText(QString('Long\nmultiline\nlabel.\n\n\n\n\nVeeery\nlong\nand\nvery\nmultiline\nlabel!'))
self.vbox.addWidget(self.label)
self.vbox.setSizeConstraint(QLayout.SetMinAndMaxSize)
#Create a ScrollArea and put the container widget inside
self.sa = QScrollArea(self)
self.sa.setWidget(self.cw)
self.setCentralWidget(self.sa)
# Connect button to signal
self.connect(self.button, SIGNAL("clicked()"), self.openSubWin)
def openSubWin(self):
# Create subwindow
self.subWindow = SubWindow(self)
self.subWindow.show()
class SubWindow(QMainWindow):
def __init__(self, parent):
# Notice that you must give a parent window as parameter to the
constuctor
QMainWindow.__init__(self, parent)
# Also set the Stacked Window parameter for every subwindow in the
stack
self.setAttribute(Qt.WA_Maemo5StackedWindow)
# Just some content...
self.label = QLabel(self)
self.label.setText(QString("This is a second window in the stack"))
self.setCentralWidget(self.label)
if __name__ == '__main__':
app = QApplication(sys.argv)
sw = StackedWindow()
sw.show()
sys.exit(app.exec_())
On Sat, Mar 20, 2010 at 7:31 AM, Sascha Mäkelä <sascha.makela at gmail.com>wrote:
> Yes I'm using that. I just don't know what "view" I should use. I've tried
> QScrollArea, QFrame, QWidget and also the QMainWindow, but nothing seems to
> work. I'm using successfully "FingerScrollable" in QListWidget. But I want a
> "frame" where I can have multiple object in it.
>
> Thanks for you help anyway,
> Sascha
>
>
> On Sat, Mar 20, 2010 at 08:23, Timo Härkönen <timop.harkonen at gmail.com>wrote:
>
>> Hi
>>
>> 2010/3/19 Sascha Mäkelä <sascha.makela at gmail.com>
>>
>> I'm trying to make a finger scrollable area which has many buttons and
>>> other widgets in it, because I cannot fit them on the screen. I have
>>> something similar in mind as in this video clip:
>>> http://labs.trolltech.com/blogs/?p=1480
>>>
>>> Any idea how can I do it?
>>>
>>>
>> You should be able to make scrollable views use kinetic scrolling by
>> setting
>> setProperty("FingerScrollable", true) on them.
>>
>> For more info see:
>>
>> http://wiki.maemo.org/Qt4_Hildon#Kinetic_scrolling
>> http://wiki.maemo.org/Qt/Finger_Scrolling
>>
>> -Timo
>>
>>
>>> Cheers,
>>> Sascha
>>>
>>> _______________________________________________
>>> maemo-developers mailing list
>>> maemo-developers at maemo.org
>>> https://lists.maemo.org/mailman/listinfo/maemo-developers
>>>
>>>
>>
>
> _______________________________________________
> maemo-developers mailing list
> maemo-developers at maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>
>
--
Luca Donaggio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.maemo.org/pipermail/maemo-developers/attachments/20100322/25383a88/attachment.htm>
- Previous message: How to make a finger scrollable frame for widgets in Qt 4.5?
- Next message: How to make a finger scrollable frame for widgets in Qt 4.5?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
