Results 1 to 5 of 5

Thread: Initialise toolbar in a different area

  1. #1
    Join Date
    May 2006
    Location
    Australia
    Posts
    53
    Thanks
    11
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Initialise toolbar in a different area

    I would like for my toolbar to be movable (i.e. I can't just set one area only to be the allowed area), but to start off in the right toolbar area instead of the top....

    I am using QT 4.1

    I tried set orientation, but that keeps the toolbar in the same position, just changes the position of the moving handle....

    I also tried
    Qt Code:
    1. this->setCorner(Qt::BottomRightCorner, Qt::TopDockWidgetArea);
    To copy to clipboard, switch view to plain text mode 

    but I get an assert failure

    Qt Code:
    1. ASSERT failure in QMainWindow::setCorner: "'area' is not valid for 'corner'", file widgets/qmainwindow.cpp, line 452
    2. Aborted
    To copy to clipboard, switch view to plain text mode 

    and I can't 100% tell if it is the function I want anyway....because it seems that I can't specify a single toolbar to be in a different position to the other one.....

    thanks

  2. #2
    Join Date
    Jan 2006
    Posts
    22
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Initialise toolbar in a different area

    To position a toolbar on the right, just can just use
    addToolBar(Qt::RightToolBarArea, toolBar);
    Is that what you wanted?
    ImageRocket - My Qt4-based image editing program
    Project Page / Screenshots / Source

  3. The following user says thank you to init2null for this useful post:

    georgie (4th May 2006)

  4. #3
    Join Date
    May 2006
    Location
    Australia
    Posts
    53
    Thanks
    11
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Initialise toolbar in a different area

    that's cool....it is about 95% what I meant....and I will totally use it if I can't find exactly what I want (i looked and looked through the docs, but because I was coming at the prob with preconceptions of what the solution would be, I was looking in the wrong place --- always seems to happen when I think I'm right )

    I didn't describe it very well....so I have attached a pic which kinda describes what I want better

    I know it is a pretty trivial change....but I think it makes a difference because it uses less screen real estate and makes the whole thing less cluttered.....

    thanks
    Attached Images Attached Images

  5. #4
    Join Date
    Jan 2006
    Posts
    22
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Initialise toolbar in a different area

    I tried different ways of making it work like your mockup, but I couldn't. There is one option, although it probably won't be one you like.

    Qt Code:
    1. QWidget *w = new QWidget(toolBar);
    2. w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    3. toolBar->addWidget(w);
    To copy to clipboard, switch view to plain text mode 

    This puts in a spacer which will push all the following entries to the right or bottom.
    Attached Images Attached Images
    ImageRocket - My Qt4-based image editing program
    Project Page / Screenshots / Source

  6. #5
    Join Date
    May 2006
    Location
    Australia
    Posts
    53
    Thanks
    11
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Initialise toolbar in a different area

    .....mmm.....yeah.....i guess i'll have to think more seriously about exactly the functionality I want this to have.....seems trivial, but I really want to make this easy to use

    thankyou so much for your effort.....it is definitely a solution which I will take into consideration

Similar Threads

  1. Toolbar in dockwidget
    By AD in forum Qt Programming
    Replies: 7
    Last Post: 2nd October 2008, 14:34
  2. unable to hide combobox or spinbox in toolbar
    By Sandip in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2008, 11:52
  3. Create a Toolbar on a Subclassed Textedit?
    By c_07 in forum Qt Programming
    Replies: 5
    Last Post: 12th October 2007, 18:17

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.