mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
GCS/core: Fix visual glitch at startup.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@432 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
3fa05861c6
commit
d0e1ba96e3
@ -196,7 +196,7 @@ UAVGadgetManager::UAVGadgetManager(ICore *core, QWidget *parent) :
|
||||
cmd = am->registerAction(tmpaction, QLatin1String("OpenPilot.Window.Sep.Split"), uavGadgetManagerContext);
|
||||
mwindow->addAction(cmd, Constants::G_WINDOW_HIDE_TOOLBAR);
|
||||
|
||||
m_d->m_showToolbarsAction = new QAction(tr("Show toolbars"), this);
|
||||
m_d->m_showToolbarsAction = new QAction(tr("Edit Gadgets Mode"), this);
|
||||
m_d->m_showToolbarsAction->setCheckable(true);
|
||||
cmd = am->registerAction(m_d->m_showToolbarsAction, Constants::HIDE_TOOLBARS, uavGadgetManagerContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F10")));
|
||||
|
@ -208,7 +208,8 @@ void UAVGadgetView::updateToolBar()
|
||||
toolBar = m_defaultToolBar;
|
||||
if (m_activeToolBar == toolBar)
|
||||
return;
|
||||
toolBar->setVisible(toolBar->count() > 0);
|
||||
if (toolBar->count() == 0)
|
||||
toolBar->hide();
|
||||
m_toolBar->layout()->addWidget(toolBar);
|
||||
m_activeToolBar->setVisible(false);
|
||||
m_activeToolBar = toolBar;
|
||||
@ -267,56 +268,56 @@ void SplitterOrView::mousePressEvent(QMouseEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
void SplitterOrView::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
if (m_uavGadgetManager->currentSplitterOrView() != this)
|
||||
return;
|
||||
|
||||
if (!m_view)
|
||||
return;
|
||||
|
||||
if (hasGadget())
|
||||
return;
|
||||
|
||||
if (m_uavGadgetManager->toolbarsShown())
|
||||
return;
|
||||
|
||||
// Discreet indication where an uavGadget would be if there is none
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setPen(Qt::NoPen);
|
||||
QColor shadeBrush(Qt::black);
|
||||
shadeBrush.setAlpha(25);
|
||||
painter.setBrush(shadeBrush);
|
||||
const int r = 3;
|
||||
painter.drawRoundedRect(rect().adjusted(r, r, -r, -r), r * 2, r * 2);
|
||||
|
||||
#if 0
|
||||
if (hasFocus()) {
|
||||
#ifdef Q_WS_MAC
|
||||
// With QMacStyle, we have to draw our own focus rect, since I didn't find
|
||||
// a way to draw the nice mac focus rect _inside_ this widget
|
||||
if (qobject_cast<QMacStyle *>(style())) {
|
||||
painter.setPen(Qt::DotLine);
|
||||
painter.setBrush(Qt::NoBrush);
|
||||
painter.setOpacity(0.75);
|
||||
painter.drawRect(rect());
|
||||
} else {
|
||||
#endif
|
||||
QStyleOptionFocusRect option;
|
||||
option.initFrom(this);
|
||||
option.backgroundColor = palette().color(QPalette::Background);
|
||||
|
||||
// Some styles require a certain state flag in order to draw the focus rect
|
||||
option.state |= QStyle::State_KeyboardFocusChange;
|
||||
|
||||
style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter);
|
||||
#ifdef Q_WS_MAC
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//void SplitterOrView::paintEvent(QPaintEvent *event)
|
||||
//{
|
||||
// if (m_uavGadgetManager->currentSplitterOrView() != this)
|
||||
// return;
|
||||
//
|
||||
// if (!m_view)
|
||||
// return;
|
||||
//
|
||||
// if (hasGadget())
|
||||
// return;
|
||||
//
|
||||
// if (m_uavGadgetManager->toolbarsShown())
|
||||
// return;
|
||||
//
|
||||
// // Discreet indication where an uavGadget would be if there is none
|
||||
// QPainter painter(this);
|
||||
// painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
// painter.setPen(Qt::NoPen);
|
||||
// QColor shadeBrush(Qt::black);
|
||||
// shadeBrush.setAlpha(25);
|
||||
// painter.setBrush(shadeBrush);
|
||||
// const int r = 3;
|
||||
// painter.drawRoundedRect(rect().adjusted(r, r, -r, -r), r * 2, r * 2);
|
||||
//
|
||||
//#if 0
|
||||
// if (hasFocus()) {
|
||||
//#ifdef Q_WS_MAC
|
||||
// // With QMacStyle, we have to draw our own focus rect, since I didn't find
|
||||
// // a way to draw the nice mac focus rect _inside_ this widget
|
||||
// if (qobject_cast<QMacStyle *>(style())) {
|
||||
// painter.setPen(Qt::DotLine);
|
||||
// painter.setBrush(Qt::NoBrush);
|
||||
// painter.setOpacity(0.75);
|
||||
// painter.drawRect(rect());
|
||||
// } else {
|
||||
//#endif
|
||||
// QStyleOptionFocusRect option;
|
||||
// option.initFrom(this);
|
||||
// option.backgroundColor = palette().color(QPalette::Background);
|
||||
//
|
||||
// // Some styles require a certain state flag in order to draw the focus rect
|
||||
// option.state |= QStyle::State_KeyboardFocusChange;
|
||||
//
|
||||
// style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter);
|
||||
//#ifdef Q_WS_MAC
|
||||
// }
|
||||
//#endif
|
||||
// }
|
||||
//#endif
|
||||
//}
|
||||
|
||||
/* Contract: return SplitterOrView that is not splitter, or 0 if not found.
|
||||
* Implications: must not return SplitterOrView that is splitter.
|
||||
|
@ -138,7 +138,7 @@ public:
|
||||
void unsplitAll();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
// void paintEvent(QPaintEvent *);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user