Results 1 to 6 of 6

Thread: Remove Widget Border?

  1. #1
    Join Date
    Oct 2008
    Posts
    29
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Remove Widget Border?

    Ok, so I've got a QSplitter, and in on frame of the QSplitter is a VideoPlayer. That works fine. For the other frame, I have a custom widget (which is a simple chat window). The problem is that the custom widget is padded more than the VideoPlayer, so it ends up looking offset.

  2. #2
    Join Date
    Sep 2007
    Location
    Rome, GA
    Posts
    199
    Thanks
    14
    Thanked 41 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Remove Widget Border?

    I'd like to help you figure out the problem, but you'll need to provide some more info - code and maybe a screenshot of the problem.

  3. #3
    Join Date
    Oct 2008
    Posts
    29
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Remove Widget Border?

    Here's a pic and some code. Thanks

    MovieTabPane.h
    Qt Code:
    1. #pragma once
    2.  
    3. #include <QtGui>
    4. #include <Phonon>
    5. #include "ChatWindowPane.h"
    6.  
    7. class MovieTabPane : public QWidget
    8. {
    9. Q_OBJECT
    10. public:
    11. MovieTabPane( QWidget *parent = 0 )
    12. : QWidget( parent )
    13. {
    14. // Create Gui
    15. init();
    16. }
    17.  
    18. void init()
    19. {
    20. // Vertical Splitter (Top is VideoPlayer)
    21. vSplitter = new QSplitter( this );
    22. vSplitter->setOrientation( Qt::Vertical );
    23.  
    24. // Create Video Player and add it to the layout
    25. vidWindow = new Phonon::VideoPlayer( Phonon::VideoCategory, this );
    26. vSplitter->addWidget( vidWindow );
    27.  
    28. // Create Chat Window and add it
    29. chatWindow = new ChatWindowPane( this );
    30. vSplitter->addWidget( chatWindow );
    31.  
    32. // Horizontal Splitter (Left Side is Vertical Splitter, right side is contact list)
    33. hSplitter = new QSplitter( this );
    34. hSplitter->setOrientation( Qt::Horizontal );
    35.  
    36. // Create Buddy List
    37. buddyList = new QListView( this );
    38.  
    39. // Add vSplitter, then Buddy List
    40. hSplitter->addWidget( vSplitter );
    41. hSplitter->addWidget( buddyList );
    42.  
    43. // Add Splitter to hLayout to size correctly
    44. hLayout = new QHBoxLayout;
    45. hLayout->addWidget(hSplitter);
    46.  
    47. hLayout->setSpacing(0);
    48.  
    49.  
    50. // Set Layout
    51. this->setLayout( hLayout );
    52. }
    53.  
    54. protected:
    55. QSplitter *hSplitter;
    56. QSplitter *vSplitter;
    57.  
    58. QHBoxLayout *hLayout;
    59.  
    60. Phonon::VideoPlayer *vidWindow;
    61. ChatWindowPane *chatWindow;
    62. QListView *buddyList;
    63.  
    64. QString *mTitle;
    65.  
    66.  
    67. };
    To copy to clipboard, switch view to plain text mode 

    And here's ChatWindowPane.h
    Qt Code:
    1. #pragma once
    2.  
    3. #include <QtGui>
    4. #include <Phonon>
    5.  
    6. class ChatWindowPane : public QWidget
    7. {
    8. Q_OBJECT
    9. public:
    10. ChatWindowPane( QWidget *parent = 0 )
    11. : QWidget( parent )
    12. {
    13. // Create Gui
    14. init();
    15. }
    16.  
    17. void init()
    18. {
    19. textIn = new QLineEdit( this );
    20. textOut = new QTextEdit( this );
    21.  
    22. send = new QPushButton( this );
    23. send->setText( tr("Send") );
    24.  
    25. vLayout = new QVBoxLayout( this );
    26. vLayout->addWidget( textOut );
    27.  
    28. hLayout = new QHBoxLayout( this );
    29. hLayout->addWidget( textIn );
    30. hLayout->addWidget( send );
    31.  
    32. vLayout->addLayout( hLayout );
    33.  
    34. this->setLayout( vLayout );
    35. }
    36.  
    37. protected:
    38. QHBoxLayout *hLayout;
    39. QVBoxLayout *vLayout;
    40.  
    41. QLineEdit *textIn;
    42. QTextEdit *textOut;
    43.  
    44. QPushButton *send;
    45.  
    46. };
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Remove Widget Border?

    Change vLayout's margins.

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

    winston2020 (20th October 2008)

  6. #5
    Join Date
    Oct 2008
    Posts
    29
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Remove Widget Border?

    Quote Originally Posted by jacek View Post
    Change vLayout's margins.
    How do I do that?

  7. #6
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Remove Widget Border?


Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. How to Open & Close a Widget ?!!
    By Fatla in forum Qt Programming
    Replies: 6
    Last Post: 13th June 2008, 20:39
  3. Showing QWidget border around the window
    By maverick_pol in forum Qt Programming
    Replies: 2
    Last Post: 20th March 2008, 20:14
  4. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  5. Custom tab widget question
    By PrimeCP in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2007, 11:17

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.