#include "minisplitter.h"
#include "stylehelper.h"
#include <QtGui/QPaintEvent>
#include <QtGui/QPainter>
#include <QtGui/QSplitterHandle>
namespace Core {
namespace Internal {
{
public:
MiniSplitterHandle
(Qt
::Orientation orientation,
QSplitter *parent
) {
setAttribute(Qt::WA_MouseNoMask, true);
}
protected:
};
} // namespace Internal
} // namespace Core
using namespace Core;
using namespace Core::Internal;
{
if (orientation() == Qt::Horizontal)
setContentsMargins(2, 0, 2, 0);
else
setContentsMargins(0, 2, 0, 2);
}
void MiniSplitterHandle
::paintEvent(QPaintEvent *event
) {
painter.fillRect(event->rect(), StyleHelper::borderColor());
}
{
return new MiniSplitterHandle(orientation(), this);
}
MiniSplitter
::MiniSplitter(QWidget *parent
){
setHandleWidth(1);
setChildrenCollapsible(false);
setProperty("minisplitter", true);
}
MiniSplitter::MiniSplitter(Qt::Orientation orientation)
{
setHandleWidth(1);
setChildrenCollapsible(false);
setProperty("minisplitter", true);
}
#include "minisplitter.h"
#include "stylehelper.h"
#include <QtGui/QPaintEvent>
#include <QtGui/QPainter>
#include <QtGui/QSplitterHandle>
namespace Core {
namespace Internal {
class MiniSplitterHandle : public QSplitterHandle
{
public:
MiniSplitterHandle(Qt::Orientation orientation, QSplitter *parent)
: QSplitterHandle(orientation, parent)
{
setMask(QRegion(contentsRect()));
setAttribute(Qt::WA_MouseNoMask, true);
}
protected:
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
};
} // namespace Internal
} // namespace Core
using namespace Core;
using namespace Core::Internal;
void MiniSplitterHandle::resizeEvent(QResizeEvent *event)
{
if (orientation() == Qt::Horizontal)
setContentsMargins(2, 0, 2, 0);
else
setContentsMargins(0, 2, 0, 2);
setMask(QRegion(contentsRect()));
QSplitterHandle::resizeEvent(event);
}
void MiniSplitterHandle::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.fillRect(event->rect(), StyleHelper::borderColor());
}
QSplitterHandle *MiniSplitter::createHandle()
{
return new MiniSplitterHandle(orientation(), this);
}
MiniSplitter::MiniSplitter(QWidget *parent)
: QSplitter(parent)
{
setHandleWidth(1);
setChildrenCollapsible(false);
setProperty("minisplitter", true);
}
MiniSplitter::MiniSplitter(Qt::Orientation orientation)
: QSplitter(orientation)
{
setHandleWidth(1);
setChildrenCollapsible(false);
setProperty("minisplitter", true);
}
To copy to clipboard, switch view to plain text mode
Bookmarks