Results 1 to 8 of 8

Thread: toolbox

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default toolbox

    hi, I inserted a toolBox from designer in MainForm; now from mainForm I'd like to control its width and do something like this:
    Qt Code:
    1. //paintGL()
    2. int widthWidget = this->width();
    3. mainForm->toolBox->setMinimumWidth(widthWidget/4);
    4. mainForm->toolBox->setMaximumWidth(widthWidget/4);
    To copy to clipboard, switch view to plain text mode 
    (but it doesn't work, when I enlarge window app maximumToolBoxWidth block the window app width too...)
    I need set width of toolBox 1/4 of Widget (and when I resize my window app toolBox should be maintain 1/4 width)
    How can I do this? Thanks
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: toolbox

    Have 2 choice :
    - reinplement resizeEvent for your main window, and set toolbox size there
    - use layouts(better way)
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: toolbox

    You can use stretchFactors to manipulate widget size relative to its siblings in a layout.

  4. #4
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: toolbox

    Ok, but I'd like avoid this; is there a way to retrieve the screen resolution (from QT)? Thanks
    Regards

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: toolbox


  6. #6
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: toolbox

    Thanks, this seem works; but return height 704 instead of 768; the task Bar or window isn't included in height...How can I do? Thanks
    Qt Code:
    1. QRect rect = qw->availableGeometry(0);
    2. std::cout << "Screen Width: " << rect.width() << endl;
    3. std::cout << "Screen Height: " << rect.height() << endl;
    To copy to clipboard, switch view to plain text mode 
    Regards

  7. #7
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: toolbox

    Use QScreen instead QDesktopWidget
    a life without programming is like an empty bottle

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: toolbox

    Quote Originally Posted by mickey
    Thanks, this seem works; but return height 704 instead of 768; the task Bar or window isn't included in height...How can I do?
    Qt Code:
    1. QRect rect = qw->screenGeometry(0);
    2. std::cout << "Screen Width: " << rect.width() << endl;
    3. std::cout << "Screen Height: " << rect.height() << endl;
    To copy to clipboard, switch view to plain text mode 

    The docs say:

    const QRect & QDesktopWidget::availableGeometry ( int screen = -1 ) const
    Returns the available geometry of the screen with index screen. What is available will be subrect of screenGeometry() based on what the platform decides is available (for example excludes the Dock and Menubar on Mac OS X, or the taskbar on Windows).
    See also screenNumber() and screenGeometry().

Similar Threads

  1. Replies: 5
    Last Post: 30th March 2007, 18:46
  2. Creating a popup toolbox
    By Jachyra in forum Qt Programming
    Replies: 5
    Last Post: 18th February 2007, 11:23
  3. Replies: 1
    Last Post: 5th November 2006, 23:50
  4. put a toolbox
    By mickey in forum Newbie
    Replies: 4
    Last Post: 27th August 2006, 15:35
  5. QGLWidget, toolbox and paintGL()
    By mickey in forum Qt Programming
    Replies: 3
    Last Post: 21st March 2006, 01:05

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.