Results 1 to 2 of 2

Thread: qwt canvas border

  1. #1
    Join Date
    May 2008
    Location
    Rijeka, Croatia
    Posts
    85
    Thanks
    10
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default qwt canvas border

    Hi,
    i'm trying to remove sunken canvas (it looks ugly).
    Qt Code:
    1. ui->qwtPlot->canvas()->setFrameStyle(QFrame::StyledPanel|QFrame::Plain);
    To copy to clipboard, switch view to plain text mode 
    but the result is a transparent border line around canvas (transparent - probably because my "transparent oxygen" widget style):
    snapshot4.png
    How to remove this border, and get a elegant round border (as in line edit or table widget)?

    i tried
    Qt Code:
    1. ui->qwtPlot->layout()->setMargin(0);
    To copy to clipboard, switch view to plain text mode 
    but program crashes on starting ("The program has unexpectedly finished.")

    Thanks for any help

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qwt canvas border

    Quote Originally Posted by stefan View Post
    but the result is a transparent border line around canvas (transparent - probably because my "transparent oxygen" widget style):
    Well your screenshot looks like your border is not painted at all. What version of Qwt are you using ?

    Recently I was playing around with style sheets and had to learn, that the whole concept is made for Qt widgets only. Nevertheless people want to use style sheets and I hacked a lot of code dealing with rounded borders for the plot canvas.

    The problem with rounded borders is, that widgets are designed to be rectangular and the content of a widget needs to be clipped against the rounded borders. Unfortunately the style sheets have no answer to this problem - here you simply add some pixels as padding, what of course is not acceptable for a plot canvas. Further more the style sheet style draws the border as a part of the background, with the effect, that the border gets antialiased against the background - not the plot items ( think about plot items with filled areas like a spectrogram ). So I had to hack the order how background and border are painted.

    I'm afraid you will have the similar problems with styles that draw rounded borders. Guess the oxygen style also can't solve the design problem of the QStyle API and also has to add padding.

    At the moment QwtPlotCanvas does some reverse engineering of the border for styled backgrounds ( Qt::WA_StyledBackground ) only. I could try to do the same for styled frames - but calculating the clipping, when you don't have an API for the radii of the borders is no fun.

    Please try Qwt 6 from SVN trunk ( no snapshot ) with the Oxygen style. You could also try QwtPlotCanvas::setBorderRadius() or if you want to use stylesheets you can try ( and adopt ) choco.css from the examples/stylesheets directory.

    Uwe

Similar Threads

  1. QDockWidget border
    By QPlace in forum Qt Programming
    Replies: 5
    Last Post: 25th May 2012, 02:28
  2. Replies: 2
    Last Post: 21st March 2012, 15:30
  3. QTextTableCell Border
    By ChrisW67 in forum Newbie
    Replies: 2
    Last Post: 14th December 2009, 13:59
  4. Bitmap border
    By SailinShoes in forum Qt Programming
    Replies: 5
    Last Post: 14th May 2008, 19:37
  5. getting rid of border
    By darksaga in forum Qt Programming
    Replies: 3
    Last Post: 17th August 2007, 21:53

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.