Results 1 to 11 of 11

Thread: Scrollbar overlaps border of Widget with colored border

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2012
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Scrollbar overlaps border of Widget with colored border

    For a second there I was hoping that i could do something like "xyz.exe -style cleanlooks -stylesheet=style.qss". Unfortunately: no! Still getting the gray line there. If I could find out how to change that color then I might have a lot of work to get rid of the then-changed occurences of this element but at least that border might be rendered correctly.

    Does anybody have any suggestions where that gray color could be defined?

  2. #2
    Join Date
    Sep 2012
    Location
    Iran, Tehran
    Posts
    76
    Thanks
    17
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Scrollbar overlaps border of Widget with colored border

    As I know all the colors come form style classes such as QWindowsVistaStyle or QWindowsXPStyle.

    P.S.
    I can't say I'm 100% sure, You can implement your own style as a plugin and then force the program to use it via -style. There's no need to change the program.

    I have created one. It is working, I don't say I'm 100% sure because for now I can use the plugin only when it is in Qt's plugins directory (a sub-directory of Qt SDK installation directory). It is my first plugin, so I think it can be easily solved

  3. #3
    Join Date
    Sep 2012
    Location
    Iran, Tehran
    Posts
    76
    Thanks
    17
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Scrollbar overlaps border of Widget with colored border

    I created a directory named styles in the directory of the program's executable and put the plugin inside it, now it is working. Now I'm 100% sure that it is possible, however it needs more work than stylesheets.
    Last edited by Ashkan_s; 22nd October 2012 at 19:52. Reason: spelling corrections

  4. #4
    Join Date
    Oct 2012
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Scrollbar overlaps border of Widget with colored border

    Thanks again, Ashkan_s!
    I still don't think that I will be able to convince the right people of the need for a style. At the moment I feel like Stylesheets are the only way for me to get some "wow, nice!" into that application. So I'm still searching for any ideas how to get rid of that strange behaviour.

    I noticed something: if i take a QTextEdit with for example 3 lines and start writing into it until the scrollbar appears, than everything looks fine. Once that QTextEdit looses the focus, that ugly 1px line is back. If I then remove enough content for the scrollbar to disappear (focus still inside the QTextEdit) that line is still there. But once the QTextEdit looses focus again: ugly line is gone.
    O.o

  5. #5
    Join Date
    Oct 2012
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Scrollbar overlaps border of Widget with colored border

    Just to let you know: i found something that you could call a workaround.

    as the unwanted line is colored like the background of the widget, i set the background-color to the border-color (blue) and used a 1x1 pixel image as white background for the widget. As i am using rounded edges it is still visible if you know about the problem but it is still a huge improvement.

  6. #6
    Join Date
    May 2012
    Posts
    1
    Platforms
    Unix/X11 Windows

    Default Re: Scrollbar overlaps border of Widget with colored border

    Hi JCarpenter,
    I met exactly same issue as you did.

    I tried to subclass QTextEdit:: paintEvent() and do the border painting work myself,
    but I found QTextEdit:: paintEvent is actually the Paint handler for QTextEdit::viewport() who has installed an eventfilter, NOT for painting QTextEdit itselft.

    On my way of testing I found a solution
    Qt Code:
    1. bool AttachmentListEdit::event(QEvent* e)
    2. {
    3. #ifdef Q_OS_WIN
    4. switch (e->type())
    5. {
    6. case QEvent::Paint:
    7. // skip QFrame::paintEvent() to prevent buggy border painting
    8. e->accept();
    9. return true;
    10. default:
    11. break;
    12. }
    13. #endif
    14.  
    15. return QTextEdit::event(e);
    16. }
    To copy to clipboard, switch view to plain text mode 

    Though it works for me, I can not explain it exactly.
    I've no idea who finally paint the border but I'm going to dig out.
    I'm using Qt4.7.4

Similar Threads

  1. How to change border colors of a widget?
    By Ashkan_s in forum Newbie
    Replies: 0
    Last Post: 16th October 2012, 10:40
  2. Replies: 2
    Last Post: 21st March 2012, 14:30
  3. Widget Resizable Border
    By ale6111 in forum Qt Programming
    Replies: 3
    Last Post: 22nd July 2010, 17:20
  4. Dock widget between widgets, not near the border
    By maverick_pol in forum Qt Programming
    Replies: 0
    Last Post: 22nd May 2009, 13:23
  5. Remove Widget Border?
    By winston2020 in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2008, 05:26

Tags for this Thread

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.