Results 1 to 20 of 23

Thread: raised view of Widgets.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: raised view of Widgets.

    Qt Code:
    1. void MyWidget::paintEvent(QPaintEvent *e){
    2. QPainter p(this);
    3. QPen pen = p.pen();
    4. pen.setWidth(10);
    5. pen.setColor(Qt::red);
    6. p.setPen(pen);
    7. p.drawRect(rect());
    8. QWidget::paintEvent(e);
    9. }
    To copy to clipboard, switch view to plain text mode 

    Doesn't this work?

  2. #2
    Join Date
    Dec 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: raised view of Widgets.

    Thank you very much!
    It worked only in the interior of wndow. i actually want the frame to be drawn. the frame which holds the windows.
    Also how to draw the frame in different colours. please see the out put that i have obtained with your code, Wysota.

    the painted red rectangle is now movable with the window. but any mouse event is repainting the window and the red rectangle is disappearing. how to over come this?
    Attached Images Attached Images

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

    Default Re: raised view of Widgets.

    Quote Originally Posted by krishna.bv View Post
    It worked only in the interior of wndow. i actually want the frame to be drawn. the frame which holds the windows.
    Also how to draw the frame in different colours.
    Oh, you mean the window decoration? That's not possible, the window manager handles that. You can only turn off the decoration and draw one yourself, but it's quite hard and doesn't really give satisfactory results.

    the painted red rectangle is now movable with the window. but any mouse event is repainting the window and the red rectangle is disappearing. how to over come this?
    Did you reimplement any of the mouse events?

  4. #4
    Join Date
    Dec 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: raised view of Widgets.

    Sorry for the delay in response Wysota, i am on vacation.
    First of all thank you :-)
    I have not re implemented the mouse event.
    shall i have to do that.

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

    Default Re: raised view of Widgets.

    No, but something is causing the rectangle to disappear. Could you prepare a minimal compilable example reproducing the problem?

Similar Threads

  1. Model, View and Proxy
    By No-Nonsense in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 08:50
  2. Replies: 11
    Last Post: 7th July 2006, 13:09
  3. Model - View Programming doubt.
    By munna in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2006, 13:01
  4. Replies: 6
    Last Post: 20th April 2006, 10:23
  5. Creating Widgets
    By hylke in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 08:37

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
  •  
Qt is a trademark of The Qt Company.