Results 1 to 5 of 5

Thread: put a toolbox

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

    Default put a toolbox

    hi,
    I desinged a toolbox and put onto a tabwidget page (here the toolbox isn't blocked in any point); I create an instance of a myWidget class in mymainform class and I put this widget on left of toolbox; the I managed layout by hand from mymainform (layout horizotal/vertical); maybe is betterfix the layout in designer putting on the left of toolbox a Qframe??? (then in mymainform I can put mywidget inside frame)....thanks
    Regards

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

    Default Re: put a toolbox

    Hi, I tried use a Qframe to put myWidget in, but the problem arise is an old problem: the "cout" print the value 101 because the first time QFrame is drawn with wrong width; only if I resize window app, frame3 take correct value:700; So myWidget4 is drawn in a small square instead of all frame3 dimensions; how do I avoid this? thanks
    Qt Code:
    1. //myMainform constructor
    2. myWidget4 = new MyWidget(frame3, "Advance", myWidget1);
    3. myWidget4->setGeometry(frame3->x(), frame3->y(), frame3->width(), frame3>height());
    4. cout << "frame widget() " << frame3->width() << endl;
    To copy to clipboard, switch view to plain text mode 
    Regards

  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: put a toolbox

    Why don't you use layouts instead of setting the geometry manually yourself?

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

    Default Re: put a toolbox

    hi,
    my aim was avoid to do it manually. But I had a toolbox designed from designer and a mywidgetX instance create in mymainform constructor. So I coudn't set layout from designer because how could I set layout (with myWidgetX+toolbox)from designer if in designer I had created mywidgetX in myMainform? But I wanted a way to fix the toolbox in designer. So I inserted the frame3 and I create layout with frame3+toolbox; then I tried a way to put mywidgetX inside frame3 (will it possible?): I didn't find it. Actually I solve with this:
    Qt Code:
    1. lay2 = new QHBoxLayout(frame3,0,1);
    2. lay2->addWidget(myWidgetX,1,0);
    To copy to clipboard, switch view to plain text mode 
    It work and I think it's ok....right?
    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: put a toolbox

    It's fine. Alternatively you could use a custom widget (either a fake or a real one) to insert your designer made widget into another form in designer.

Similar Threads

  1. toolbox
    By mickey in forum Newbie
    Replies: 7
    Last Post: 14th April 2006, 12:54
  2. 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.