Results 1 to 6 of 6

Thread: Is there a widget to enable the user to resize a widget at runtime like ms paint

  1. #1
    Join Date
    Jun 2012
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question Is there a widget to enable the user to resize a widget at runtime like ms paint

    Hello at all!

    I'm working with Qt 4 in c++ for a few weeks and I really love it!
    Now I have a question and I hope somebody can help me with that.

    In Qt Designer, the user can resize widgets with the mouse. Also you
    can resize your graphics in many other programs, like webapplications
    or MS Word and Paint.
    Is there a widget in Qt 4 that can contain another widget and enable
    the user to resize the contained widget with the mouse?

    paint.png

    Thank you very much!

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is there a widget to enable the user to resize a widget at runtime like ms paint

    I dont think there is anything in-built that does that.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

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

    eve (20th June 2012)

  4. #3
    Join Date
    Jun 2012
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is there a widget to enable the user to resize a widget at runtime like ms paint

    Thank you for your reply!

    Do you have an idea how I could easily implement such a functionality myself?
    I tried a QScrollArea with a QDialog Widget in it because it has the setSizeGripEnabled(bool) function,
    but of course that did not work
    I don't really want the user to enter the widget size in a dialog, that is inconvenient...

  5. #4
    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: Is there a widget to enable the user to resize a widget at runtime like ms paint

    You need to create your own widget or graphics item (as you should probably use Graphics View and not widgets).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Jun 2012
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is there a widget to enable the user to resize a widget at runtime like ms paint

    Thanks for your reply!

    I have a custom PaintArea that extends from QWidget.
    With the QGraphicsView, I can only display QGraphicsScene Objects and not the PaintArea, right?

  7. #6
    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: Is there a widget to enable the user to resize a widget at runtime like ms paint

    It's a matter of choosing the base class for your PaintArea. You can derive it from QGraphicsWidget instead of QWidget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How to resize parent widget when child widget is resized
    By ainne810329 in forum Qt Programming
    Replies: 4
    Last Post: 29th November 2011, 07:47
  2. child widget resize to parent widget
    By bobFromAccounting in forum Newbie
    Replies: 10
    Last Post: 11th February 2011, 02:53
  3. Replies: 1
    Last Post: 28th June 2010, 20:59
  4. How to remove widget added in runtime?
    By jiveaxe in forum Qt Programming
    Replies: 7
    Last Post: 2nd November 2007, 10:13
  5. Replies: 4
    Last Post: 17th February 2006, 14:28

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.