Results 1 to 3 of 3

Thread: Using QMainWindow change default position of toolbar. PYQT4

  1. #1
    Join Date
    Nov 2010
    Posts
    5
    Qt products
    Platforms
    Unix/X11 Windows

    Question Using QMainWindow change default position of toolbar. PYQT4

    Hello guys.
    I was wondering if anyone can help me with some syntax/expression. i am using QMainWindow

    The GUI i am working on has a tool bar , now i want to change the default position of it to the left of the CenterWidget. i am having problem saying put the toolbar to the left ..


    Here is the code i have at the moment
    Qt Code:
    1. toolbar = self.addToolBar('toolbar')
    2. toolbar.addAction(NewDoc)
    3. toolbar.addAction(Map)
    4. toolbar.addAction(Change)
    5. toolbar.addAction(exit)
    To copy to clipboard, switch view to plain text mode 

    Here things i tried without luck.

    Qt Code:
    1. toolbar = self.addToolBar(Qt.LeftToolBarArea)
    2. toolbar.addAction(NewDoc)
    3. toolbar.addAction(Map)
    4. toolbar.addAction(Change)
    5. toolbar.addAction(exit)
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. toolbar = self.addToolBar('toolabr')
    2. toolbar.LeftToolbarArea()
    3. toolbar.addAction(NewDoc)
    4. toolbar.addAction(Map)
    5. toolbar.addAction(Change)
    6. toolbar.addAction(exit)
    To copy to clipboard, switch view to plain text mode 



    Qt Code:
    1. toolbar = self.addToolBar(Qt.BottomToolBarArea,'Toolbar')
    2. toolbar.LeftToolbarArea()
    3. toolbar.addAction(NewDoc)
    4. toolbar.addAction(Map)
    5. toolbar.addAction(Change)
    6. toolbar.addAction(exit)
    To copy to clipboard, switch view to plain text mode 

    i would appreciate any help. Thank you
    ps: sorry for the indent..
    Last edited by blanka; 14th November 2010 at 19:31.

  2. #2
    Join Date
    Nov 2010
    Posts
    5
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: Using QMainWindow change default position of toolbar. PYQT4

    31 views and people have no idea? any python people in this forum?

  3. #3
    Join Date
    Sep 2011
    Posts
    1
    Qt products
    Platforms
    MacOS X Windows

    Default Re: Using QMainWindow change default position of toolbar. PYQT4

    check http://www.riverbankcomputing.co.uk/...ainwindow.html

    you are looking for:
    addToolBar (self, Qt.ToolBarArea area, QToolBar toolbar)

    What you are doing is storing the result of adding a toolbar to your MainWindow as a variable named toolbar.
    You need to first create the toolbar and only then add it to the main window with a position.

    example:
    Qt Code:
    1. from PyQt4.QtGui import *
    2.  
    3. class MainWindow(QMainWindow):
    4. def __init__(self, parent=None):
    5. super(MainWindow, self).__init__(parent)
    6.  
    7. myToolbar = QToolBar()
    8. self.addToolBar( Qt.LeftToolBarArea , myToolbar )
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. how to change the position of menu of QMainWindow
    By yxmaomao in forum Qt Programming
    Replies: 11
    Last Post: 17th September 2016, 16:12
  2. How to change default clipping?
    By swbluto in forum Qt Programming
    Replies: 2
    Last Post: 29th October 2009, 18:35
  3. toolbar initial position
    By baray98 in forum Qt Programming
    Replies: 7
    Last Post: 7th September 2007, 07:39
  4. Fixing default Window position with move.
    By VireX in forum Qt Programming
    Replies: 4
    Last Post: 3rd April 2007, 21:13
  5. disable QMainWindow toolbar menu?
    By gfunk in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2007, 18:24

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.