Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Stackable Windows PyQt

    Reply
    Page 1 of 2 | 1   2   | Next
    kevinm2k | # 1 | 2010-06-01, 20:41 | Report

    I have been looking for examples on how to do stackable windows using pyqt.. I found the following on this forum:

    Code:
    class StackedWindow(QtGui.QMainWindow):
        def __init__(self, *args):
            apply(QtGui.QMainWindow.__init__, (self, ) + args)
            self.setWindowTitle("Stacked Window")
            centralwidget = QtGui.QWidget(self)
            frame = QtGui.QFrame(centralwidget)
            verticalLayout = QtGui.QVBoxLayout(frame)
            pushButton = QtGui.QPushButton("Push Button 1", frame)
            verticalLayout.addWidget(pushButton)
            pushButton_2 = QtGui.QPushButton("Push Button 2", frame)
            verticalLayout.addWidget(pushButton_2)
            lineEdit = QtGui.QLineEdit(frame)
            verticalLayout.addWidget(lineEdit)
            lineEdit_2 = QtGui.QLineEdit(frame)
            verticalLayout.addWidget(lineEdit_2)
            self.setCentralWidget(centralwidget)
    This does indeed create a new window with widgets on it, however I want the window to be stackable so it has a back button top right rather than a close button which the above produces.

    Can anyone point me in the right direction?

    On a side note, what's the best way of showing results that you may want to click on (think witter or facebrick style), I'm using a qtextbrowser at the minute and its not exactly what i'm after.

    Edit: Also is there a way of creating the secondary window in Qt Designer and including the ui somehow?

    Thanks

    Edit | Forward | Quote | Quick Reply | Thanks

     
    pete.fu | # 2 | 2010-06-01, 22:17 | Report

    You might want to have a look at this: http://doc.trolltech.com/4.6/qstackedwidget.html

    Edit | Forward | Quote | Quick Reply | Thanks

     
    pete.fu | # 3 | 2010-06-01, 22:39 | Report

    or: http://talk.maemo.org/showthread.php?t=45373

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 3 Users Say Thank You to pete.fu For This Useful Post:
    clasificado, danielwilms, kevinm2k

     
    pete.fu | # 4 | 2010-06-02, 00:46 | Report

    also just found this (sorry for spamming): http://doc.qt.nokia.com/qt-maemo-4.6...edwindows.html

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to pete.fu For This Useful Post:
    kojacker

     
    kevinm2k | # 5 | 2010-06-02, 08:43 | Report

    Thanks pete.fu

    It was the:

    Code:
    self.setAttribute(Qt.WA_Maemo5StackedWindow, True)
    I needed to add in both windows, but I also needed to import

    Code:
    from PyQt4.QtCore import Qt
    For it to work! hopefully will help someone else out!

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to kevinm2k For This Useful Post:
    clasificado

     
    kevinm2k | # 6 | 2010-06-02, 09:20 | Report

    I do have 2 more questions though, the answers seem hard to find in python (or at least to find good examples).

    1) How do you do a drop down menu on the top menu bar (so like for config so I can write the configuration to a .conf file)

    2) What is the widget used to show posts which you can cilck on (similar to facebrick, witter etc). Im using qtextbrowser which is quite useless.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    krk969 | # 7 | 2010-06-02, 09:39 | Report

    Originally Posted by kevinm2k View Post
    I do have 2 more questions though, the answers seem hard to find in python (or at least to find good examples).

    1) How do you do a drop down menu on the top menu bar (so like for config so I can write the configuration to a .conf file)
    http://talk.maemo.org/showthread.php?p=589505

    Originally Posted by kevinm2k View Post
    2) What is the widget used to show posts which you can cilck on (similar to facebrick, witter etc). Im using qtextbrowser which is quite useless.
    can you make it clearer ? or post a screenshot if you have ?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 3 Users Say Thank You to krk969 For This Useful Post:
    attila77, kevinm2k, noobmonkey

     
    noobmonkey | # 8 | 2010-06-02, 09:41 | Report

    Also this works for me:
    Code:
    self.setAttribute(QtCore.Qt.WA_Maemo5StackedWindow, True)
    The Menubar is a bit more complicated as it entirely depends on what you want to do
    Healthcheck just uses the following and adds buttons to the menu using the following code

    Code:
                    fremantle = MainWindow.menuBar().addMenu("Update");
    		act = fremantle.addAction("All")
    		QtCore.QObject.connect(act, QtCore.SIGNAL("triggered()"), self.updateAll)
    		actb = fremantle.addAction("System")
    		QtCore.QObject.connect(actb, QtCore.SIGNAL("triggered()"), self.updateTab1)
    		actc = fremantle.addAction("Comms")
    		QtCore.QObject.connect(actc, QtCore.SIGNAL("triggered()"), self.updateTab2)
    (Actually changed it to one button since, but you get the idea)

    A few good places too look for the menu are :
    http://www.forum.nokia.com/info/sw.n...yle_Guide.html

    http://wiki.maemo.org/Documentation/...ines/View_Menu

    Send a msg to w00t_ about the other question though or ask in the facebrick thread - just asked him on irc - but he may be asleep or just busy

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to noobmonkey For This Useful Post:
    kevinm2k, krk969

     
    kevinm2k | # 9 | 2010-06-02, 10:55 | Report

    Ah, in QT Designer I remember deleting the 'MenuBar' bit thinking I didn't need it, but looking at your code it looks like I do, so i'll have to add that back in, then I can try your code above.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to kevinm2k For This Useful Post:
    noobmonkey

     
    noobmonkey | # 10 | 2010-06-02, 11:16 | Report

    Originally Posted by kevinm2k View Post
    Ah, in QT Designer I remember deleting the 'MenuBar' bit thinking I didn't need it, but looking at your code it looks like I do, so i'll have to add that back in, then I can try your code above.
    adding that to the code should work just fine, but i dont get along too well with QT designer, hehe

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Page 1 of 2 | 1   2   | Next
vBulletin® Version 3.8.8
Normal Logout