Results 1 to 5 of 5

Thread: How to hide the handle of QSplitter?

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

    Question How to hide the handle of QSplitter?

    How can I hide the handle of the QSplitter?

    And

    How to change its appearance to a line, like splitters in Qt Creator? QSplitter::setHandleWidth(1) doesn't have the effect.

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to hide the handle of QSplitter?

    not the best suggestion but try this also ...

    use the stylesheet of QSplitter and adda dummy icon

    QSplitter::handle {
    image: url(images/Dummy.png);
    }
    "Behind every great fortune lies a crime" - Balzac

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

    Ashkan_s (15th October 2012)

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

    Post Re: How to hide the handle of QSplitter?

    using
    Qt Code:
    1. splitter->setHandleWidth(1);
    2. qApp->setStyleSheet("QSplitter::handle{background-image: url(:/images/img-1.png);}");
    To copy to clipboard, switch view to plain text mode 
    or
    Qt Code:
    1. splitter->setHandleWidth(1);
    2. qApp->setStyleSheet("QSplitter::handle{background-color: black;}");
    To copy to clipboard, switch view to plain text mode 

    it is possible to change its appearance to look like a line.
    Still I'm not able to hide the handle.

  5. The following user says thank you to Ashkan_s for this useful post:


  6. #4
    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: How to hide the handle of QSplitter?

    My original question needs to be changed and reworded -It is possible to hide the handle but it is not useful- How can I make the handle indistinguishable from widgets around it? In other words How to camouflage the handle?

    What I have done so far:
    I have painted the handle in white by sub-classing QSplitterHandle and QSplitter and re-implementing the QSplitterHandle::paintEvent like this:
    Qt Code:
    1. void SplitterHandle::paintEvent(QPaintEvent *event)
    2. {
    3. QPainter painter(this);
    4. painter.fillRect(event->rect(), Qt::white);
    5. }
    To copy to clipboard, switch view to plain text mode 
    It is not enough because two black lines are visible around the handle, these are borders of the widgets in the splitter.
    I have tried to paint the borders of the a widget (a QTreeWidget) in white:
    Qt Code:
    1. treeWidget.setStyleSheet("border-color: white;");
    To copy to clipboard, switch view to plain text mode 
    But this has no effect.
    Now the question is How to change the border-colors of a widget?

    P.S.
    To hide the handle it is possible to re-implementing its showEvent and call hide()



    Added after 1 55 minutes:


    To hide the handle it is possible to re-implementing its showEvent and call hide()
    It is possible to hide the handle but it is not useful
    It can be useful! With some work it is possible to make the handle visible again, thus it is possible to alternate the state between visible and hidden.

    Still I need to know How to change border-colors of a widget.
    Last edited by Ashkan_s; 15th October 2012 at 23:32.

  7. #5
    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: How to hide the handle of QSplitter?

    Currently I have some problems setting border colors, I will ask them in their own thread.

Similar Threads

  1. qsplitter
    By marc2050 in forum Newbie
    Replies: 3
    Last Post: 31st May 2011, 16:06
  2. QSplitter handle invisible on Win32
    By para in forum Qt Programming
    Replies: 3
    Last Post: 23rd November 2010, 13:21
  3. Bug in QSplitter with Qt4.5.1
    By araglin in forum Qt Programming
    Replies: 1
    Last Post: 28th April 2009, 07:45
  4. New to QSplitter
    By bruccutler in forum Qt Programming
    Replies: 6
    Last Post: 6th September 2007, 16:43
  5. Override QSplitter to draw new handle
    By grogan in forum Qt Programming
    Replies: 4
    Last Post: 27th September 2006, 03:40

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.