summaryrefslogtreecommitdiff
path: root/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@nokia.com>2011-03-09 17:25:18 +0100
committerThomas Hartmann <Thomas.Hartmann@nokia.com>2011-03-17 10:44:29 +0100
commit9061ef2d7a8907b2f7416b0fa56e37efa608de42 (patch)
tree60f5afda292a3d32e939ee1fd6fbbd3503fb202a /src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
parentf77e395941df39c067b900241e127d6bd8d0cf91 (diff)
downloadqt-creator-9061ef2d7a8907b2f7416b0fa56e37efa608de42.tar.gz
QtQuickToolBar: tooltip fix
Task-number: QTCREATORBUG-2620
Diffstat (limited to 'src/libs/qmleditorwidgets/contextpanewidgetimage.cpp')
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidgetimage.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp b/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
index d6e77eb7b5..97ca6c8bc7 100644
--- a/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
+++ b/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
@@ -654,11 +654,11 @@ void PreviewLabel::paintEvent(QPaintEvent *event)
if (m_left >= 0)
p.drawLine(m_left * m_zoom, 4, m_left * m_zoom, height() - 4);
if (m_right >= 0)
- p.drawLine(width() - m_right * m_zoom, 4, width() - m_right * m_zoom, height() - 4);
+ p.drawLine(width() - m_right * m_zoom - 1, 4, width() - m_right * m_zoom - 1, height() - 4);
if (m_top >= 0)
p.drawLine(4, m_top * m_zoom, width() - 4, m_top * m_zoom);
if (m_bottom >= 0)
- p.drawLine(4, height() - m_bottom * m_zoom, width() - 4, height() - m_bottom * m_zoom);
+ p.drawLine(4, height() - m_bottom * m_zoom - 1, width() - 4, height() - m_bottom * m_zoom - 1);
}
{
@@ -671,11 +671,11 @@ void PreviewLabel::paintEvent(QPaintEvent *event)
if (m_left >= 0)
p.drawLine(m_left * m_zoom, 4, m_left * m_zoom, height() - 4);
if (m_right >= 0)
- p.drawLine(width() - m_right * m_zoom, 4, width() - m_right * m_zoom, height() - 4);
+ p.drawLine(width() - m_right * m_zoom - 1, 4, width() - m_right * m_zoom - 1, height() - 4);
if (m_top >= 0)
p.drawLine(4, m_top * m_zoom, width() - 4, m_top * m_zoom);
if (m_bottom >= 0)
- p.drawLine(4, height() - m_bottom * m_zoom, width() - 4, height() - m_bottom * m_zoom);
+ p.drawLine(4, height() - m_bottom * m_zoom - 1, width() - 4, height() - m_bottom * m_zoom - 1);
}
}
}
@@ -690,6 +690,8 @@ void PreviewLabel::mousePressEvent(QMouseEvent * event)
if (!m_borderImage)
return QLabel::mouseMoveEvent(event);
+ bool bottom = false;
+
if (event->button() == Qt::LeftButton) {
if (QApplication::overrideCursor())
QApplication::restoreOverrideCursor();
@@ -717,11 +719,15 @@ void PreviewLabel::mousePressEvent(QMouseEvent * event)
event->accept();
m_hooverInfo->setText("Bottom " + QString::number(m_bottom));
m_hooverInfo->show();
+ bottom = true;
} else {
QLabel::mousePressEvent(event);
}
m_startPos = event->pos();
- m_hooverInfo->move(mapToParent(event->pos()) + QPoint(0, 40));
+ if (bottom)
+ m_hooverInfo->move(mapToParent(m_startPos) + QPoint(0, -10));
+ else
+ m_hooverInfo->move(mapToParent(m_startPos) + QPoint(0, 40));
m_hooverInfo->resize(m_hooverInfo->sizeHint());
m_hooverInfo->raise();
}
@@ -809,6 +815,7 @@ void PreviewLabel::mouseMoveEvent(QMouseEvent * event)
return QLabel::mouseMoveEvent(event);
QPoint p = event->pos();
+ bool bottom = false;
if (m_dragging_left) {
m_left = p.x() / m_zoom;
m_left = limitPositive(m_left);
@@ -832,6 +839,7 @@ void PreviewLabel::mouseMoveEvent(QMouseEvent * event)
m_bottom = limitPositive(m_bottom);
event->accept();
m_hooverInfo->setText("Bottom " + QString::number(m_bottom));
+ bottom = true;
update();
} else if (rangeCheck(m_left * m_zoom, p.x())) {
QApplication::setOverrideCursor(QCursor(Qt::SizeHorCursor));
@@ -853,6 +861,7 @@ void PreviewLabel::mouseMoveEvent(QMouseEvent * event)
event->accept();
m_hooverInfo->setText("Bottom " + QString::number(m_bottom));
m_hooverInfo->show();
+ bottom = true;
} else {
if (QApplication::overrideCursor())
QApplication::restoreOverrideCursor();
@@ -860,7 +869,10 @@ void PreviewLabel::mouseMoveEvent(QMouseEvent * event)
m_hooverInfo->hide();
}
m_startPos = p;
- m_hooverInfo->move(mapToParent(p) + QPoint(0, 40));
+ if (bottom)
+ m_hooverInfo->move(mapToParent(p) + QPoint(0, -10));
+ else
+ m_hooverInfo->move(mapToParent(p) + QPoint(0, 40));
m_hooverInfo->resize(m_hooverInfo->sizeHint());
m_hooverInfo->raise();
}
@@ -889,7 +901,7 @@ PreviewDialog::PreviewDialog(QWidget *parent) : DragWidget(parent)
QHBoxLayout *horizontalLayout = new QHBoxLayout();
QHBoxLayout *horizontalLayout2 = new QHBoxLayout();
layout->setMargin(0);
- layout->setContentsMargins(2, 2, 2, 6);
+ layout->setContentsMargins(2, 2, 2, 16);
layout->setSpacing(4);
QToolButton *toolButton = new QToolButton(this);
QIcon icon(style()->standardIcon(QStyle::SP_DockWidgetCloseButton));