1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

GCS: Right, fixed this the right way per suggestion of PeterG (Thanks :)

). Splitters now have 6 pixels of grab area on each side again, without
crashing 4.7.0.
I still is ugly code, but Qt leaves us no option :) Added some comments
to make this clear.


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1769 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
cranphin 2010-09-26 09:29:23 +00:00 committed by cranphin
parent da583e0914
commit c2fee8fc6d

View File

@ -46,7 +46,6 @@ public:
setMask(QRegion(contentsRect()));
setAttribute(Qt::WA_MouseNoMask, true);
}
void setOrientation(Qt::Orientation orientation);
protected:
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
@ -60,8 +59,20 @@ using namespace Core::Internal;
void MiniSplitterHandle::resizeEvent(QResizeEvent *event)
{
// Warning: We specifically replace the QSplitterHandle::resizeEvent,
// since there's no way of doing this while still calling it.
// That's because it has pretty much identical code (in 4.7.0) which
// undoes what we do here. And they didn't make that code configurable :)
// This means that with Qt upgrades it's worthwhile to see if anything changed
// in QSplitterHandle::resizeEvent, to see if there's anything important we miss.
if (orientation() == Qt::Horizontal)
setContentsMargins(6, 0, 6, 0);
else
setContentsMargins(0, 6, 0, 6);
setMask(QRegion(contentsRect()));
QSplitterHandle::resizeEvent(event);
QWidget::resizeEvent(event);
}
void MiniSplitterHandle::paintEvent(QPaintEvent *event)
@ -70,16 +81,6 @@ void MiniSplitterHandle::paintEvent(QPaintEvent *event)
painter.fillRect(event->rect(), Utils::StyleHelper::borderColor());
}
void MiniSplitterHandle::setOrientation(Qt::Orientation orientation)
{
QSplitterHandle::setOrientation(orientation);
if (orientation == Qt::Horizontal)
setContentsMargins(6, 0, 6, 0);
else
setContentsMargins(0, 6, 0, 6);
}
QSplitterHandle *MiniSplitter::createHandle()
{
return new MiniSplitterHandle(orientation(), this);