View Full Version : Remove Widget Border?
winston2020
19th October 2008, 20:20
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.
JimDaniel
19th October 2008, 20:26
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.
winston2020
19th October 2008, 20:54
Here's a pic and some code. Thanks :)
MovieTabPane.h
#pragma once
#include <QtGui>
#include <Phonon>
#include "ChatWindowPane.h"
class MovieTabPane : public QWidget
{
Q_OBJECT
public:
MovieTabPane( QWidget *parent = 0 )
: QWidget( parent )
{
// Create Gui
init();
}
void init()
{
// Vertical Splitter (Top is VideoPlayer)
vSplitter = new QSplitter( this );
vSplitter->setOrientation( Qt::Vertical );
// Create Video Player and add it to the layout
vidWindow = new Phonon::VideoPlayer( Phonon::VideoCategory, this );
vSplitter->addWidget( vidWindow );
// Create Chat Window and add it
chatWindow = new ChatWindowPane( this );
vSplitter->addWidget( chatWindow );
// Horizontal Splitter (Left Side is Vertical Splitter, right side is contact list)
hSplitter = new QSplitter( this );
hSplitter->setOrientation( Qt::Horizontal );
// Create Buddy List
buddyList = new QListView( this );
// Add vSplitter, then Buddy List
hSplitter->addWidget( vSplitter );
hSplitter->addWidget( buddyList );
// Add Splitter to hLayout to size correctly
hLayout = new QHBoxLayout;
hLayout->addWidget(hSplitter);
hLayout->setSpacing(0);
// Set Layout
this->setLayout( hLayout );
}
protected:
QSplitter *hSplitter;
QSplitter *vSplitter;
QHBoxLayout *hLayout;
Phonon::VideoPlayer *vidWindow;
ChatWindowPane *chatWindow;
QListView *buddyList;
QString *mTitle;
};
And here's ChatWindowPane.h
#pragma once
#include <QtGui>
#include <Phonon>
class ChatWindowPane : public QWidget
{
Q_OBJECT
public:
ChatWindowPane( QWidget *parent = 0 )
: QWidget( parent )
{
// Create Gui
init();
}
void init()
{
textIn = new QLineEdit( this );
textOut = new QTextEdit( this );
send = new QPushButton( this );
send->setText( tr("Send") );
vLayout = new QVBoxLayout( this );
vLayout->addWidget( textOut );
hLayout = new QHBoxLayout( this );
hLayout->addWidget( textIn );
hLayout->addWidget( send );
vLayout->addLayout( hLayout );
this->setLayout( vLayout );
}
protected:
QHBoxLayout *hLayout;
QVBoxLayout *vLayout;
QLineEdit *textIn;
QTextEdit *textOut;
QPushButton *send;
};
http://i37.tinypic.com/soomsn.jpg
jacek
19th October 2008, 22:10
Change vLayout's margins.
winston2020
20th October 2008, 03:39
Change vLayout's margins.
How do I do that?
aamer4yu
20th October 2008, 05:26
QLayout::setContentsMargins
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.