forked from qt-creator/qt-creator
All: Fix some more Qt 6.7 induced deprecation warnings
Change-Id: I4f3fc9c34ff664ab153d4a9a641ec84a11e555a9 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -187,7 +187,7 @@ namespace ADS
|
||||
void DockWidgetTabPrivate::moveTab(QMouseEvent *event)
|
||||
{
|
||||
event->accept();
|
||||
QPoint distance = event->globalPos() - m_globalDragStartMousePosition;
|
||||
QPoint distance = event->globalPosition().toPoint() - m_globalDragStartMousePosition;
|
||||
distance.setY(0);
|
||||
auto targetPos = distance + m_tabDragStartPosition;
|
||||
targetPos.rx() = qMax(targetPos.x(), 0);
|
||||
@@ -294,7 +294,7 @@ namespace ADS
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
event->accept();
|
||||
d->saveDragStartMousePosition(event->globalPos());
|
||||
d->saveDragStartMousePosition(event->globalPosition().toPoint());
|
||||
d->m_dragState = DraggingMousePressed;
|
||||
emit clicked();
|
||||
return;
|
||||
@@ -314,7 +314,7 @@ namespace ADS
|
||||
case DraggingTab:
|
||||
// End of tab moving, emit signal
|
||||
if (d->m_dockArea) {
|
||||
emit moved(event->globalPos());
|
||||
emit moved(event->globalPosition().toPoint());
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -354,7 +354,7 @@ namespace ADS
|
||||
auto mappedPos = mapToParent(event->pos());
|
||||
bool mouseOutsideBar = (mappedPos.x() < 0) || (mappedPos.x() > parentWidget()->rect().right());
|
||||
// Maybe a fixed drag distance is better here ?
|
||||
int dragDistanceY = qAbs(d->m_globalDragStartMousePosition.y() - event->globalPos().y());
|
||||
int dragDistanceY = qAbs(d->m_globalDragStartMousePosition.y() - event->globalPosition().toPoint().y());
|
||||
if (dragDistanceY >= DockManager::startDragDistance() || mouseOutsideBar) {
|
||||
// If this is the last dock area in a dock container with only
|
||||
// one single dock widget it does not make sense to move it to a new
|
||||
@@ -382,7 +382,7 @@ namespace ADS
|
||||
}
|
||||
return;
|
||||
} else if (d->m_dockArea->openDockWidgetsCount() > 1
|
||||
&& (event->globalPos() - d->m_globalDragStartMousePosition).manhattanLength()
|
||||
&& (event->globalPosition().toPoint() - d->m_globalDragStartMousePosition).manhattanLength()
|
||||
>= QApplication::startDragDistance()) // Wait a few pixels before start moving
|
||||
{
|
||||
// If we start dragging the tab, we save its initial position to
|
||||
@@ -502,7 +502,7 @@ namespace ADS
|
||||
// sense to move it to a new floating widget and leave this one empty
|
||||
if ((!d->m_dockArea->dockContainer()->isFloating() || d->m_dockArea->dockWidgetsCount() > 1)
|
||||
&& d->m_dockWidget->features().testFlag(DockWidget::DockWidgetFloatable)) {
|
||||
d->saveDragStartMousePosition(event->globalPos());
|
||||
d->saveDragStartMousePosition(event->globalPosition().toPoint());
|
||||
d->startFloating(DraggingInactive);
|
||||
}
|
||||
|
||||
|
@@ -44,7 +44,7 @@ DragWidget::DragWidget(QWidget *parent) : QFrame(parent)
|
||||
void DragWidget::mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
m_startPos = event->globalPos() - parentWidget()->mapToGlobal((pos()));
|
||||
m_startPos = event->globalPosition().toPoint() - parentWidget()->mapToGlobal((pos()));
|
||||
m_opacityEffect = new QGraphicsOpacityEffect;
|
||||
setGraphicsEffect(m_opacityEffect);
|
||||
event->accept();
|
||||
@@ -77,7 +77,7 @@ void DragWidget::mouseMoveEvent(QMouseEvent * event)
|
||||
{
|
||||
if (event->buttons() & Qt::LeftButton) {
|
||||
if (m_startPos != QPoint(-1, -1)) {
|
||||
QPoint newPos = parentWidget()->mapFromGlobal(event->globalPos() - m_startPos);
|
||||
QPoint newPos = parentWidget()->mapFromGlobal(event->globalPosition().toPoint() - m_startPos);
|
||||
|
||||
newPos.setX(limit(newPos.x(), 20, parentWidget()->width() - 20 - width()));
|
||||
newPos.setY(limit(newPos.y(), 2, parentWidget()->height() - 20 - height()));
|
||||
|
@@ -587,7 +587,7 @@ ItemViewEvent::ItemViewEvent(QEvent *ev, QAbstractItemView *view)
|
||||
case QEvent::DragEnter:
|
||||
case QEvent::DragMove:
|
||||
case QEvent::Drop:
|
||||
m_pos = static_cast<QDropEvent *>(ev)->pos();
|
||||
m_pos = static_cast<QDropEvent *>(ev)->position().toPoint();
|
||||
m_index = view->indexAt(m_pos);
|
||||
break;
|
||||
default:
|
||||
|
@@ -99,7 +99,7 @@ static int indexOf(Id id)
|
||||
void ModeManagerPrivate::showMenu(int index, QMouseEvent *event)
|
||||
{
|
||||
QTC_ASSERT(m_modes.at(index)->menu(), return);
|
||||
m_modes.at(index)->menu()->popup(event->globalPos());
|
||||
m_modes.at(index)->menu()->popup(event->globalPosition().toPoint());
|
||||
}
|
||||
|
||||
ModeManager::ModeManager(Internal::MainWindow *mainWindow,
|
||||
|
@@ -173,7 +173,7 @@ public:
|
||||
void DraggableLabel::mousePressEvent(QMouseEvent * event)
|
||||
{
|
||||
if (active && event->button() == Qt::LeftButton) {
|
||||
m_moveStartPos = event->globalPos();
|
||||
m_moveStartPos = event->globalPosition().toPoint();
|
||||
event->accept();
|
||||
}
|
||||
QLabel::mousePressEvent(event);
|
||||
@@ -190,7 +190,7 @@ void DraggableLabel::mouseMoveEvent(QMouseEvent * event)
|
||||
{
|
||||
if (active && (event->buttons() & Qt::LeftButton)) {
|
||||
if (m_moveStartPos != QPoint(-1, -1)) {
|
||||
const QPoint newPos = event->globalPos();
|
||||
const QPoint newPos = event->globalPosition().toPoint();
|
||||
const QPoint offset = newPos - m_moveStartPos;
|
||||
|
||||
m_target->move(m_target->pos() + offset);
|
||||
|
@@ -226,7 +226,7 @@ QString UnifiedDiffEditorWidget::lineNumber(int blockNumber) const
|
||||
const QString line = lineExists
|
||||
? QString::number(m_data.m_lineNumbers[side].value(blockNumber).first)
|
||||
: QString();
|
||||
lineNumberString += QString(m_data.m_lineNumberDigits[side] - line.count(), ' ') + line;
|
||||
lineNumberString += QString(m_data.m_lineNumberDigits[side] - line.size(), ' ') + line;
|
||||
};
|
||||
addSideNumber(LeftSide, leftLineExists);
|
||||
lineNumberString += '|';
|
||||
@@ -263,7 +263,7 @@ void UnifiedDiffData::setLineNumber(DiffSide side, int blockNumber, int lineNumb
|
||||
QTC_ASSERT(side < SideCount, return);
|
||||
const QString lineNumberString = QString::number(lineNumber);
|
||||
m_lineNumbers[side].insert(blockNumber, {lineNumber, rowNumberInChunk});
|
||||
m_lineNumberDigits[side] = qMax(m_lineNumberDigits[side], lineNumberString.count());
|
||||
m_lineNumberDigits[side] = qMax(m_lineNumberDigits[side], lineNumberString.size());
|
||||
}
|
||||
|
||||
QString UnifiedDiffData::setChunk(const DiffEditorInput &input, const ChunkData &chunkData,
|
||||
|
@@ -535,7 +535,7 @@ public:
|
||||
projectModel->resetProjects();
|
||||
});
|
||||
contextMenu.addAction(action);
|
||||
contextMenu.exec(mouseEvent->globalPos());
|
||||
contextMenu.exec(mouseEvent->globalPosition().toPoint());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ bool AssetsLibraryWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
} else if (event->type() == QMouseEvent::MouseMove) {
|
||||
if (!m_assetsToDrag.isEmpty() && m_assetsView->model()) {
|
||||
QMouseEvent *me = static_cast<QMouseEvent *>(event);
|
||||
if ((me->globalPos() - m_dragStartPoint).manhattanLength() > 10) {
|
||||
if ((me->globalPosition().toPoint() - m_dragStartPoint).manhattanLength() > 10) {
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData(Constants::MIME_TYPE_ASSETS, m_assetsToDrag.join(',').toUtf8());
|
||||
|
||||
|
@@ -61,7 +61,7 @@ bool ContentLibraryWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
|
||||
if (m_materialToDrag) {
|
||||
QMouseEvent *me = static_cast<QMouseEvent *>(event);
|
||||
if ((me->globalPos() - m_dragStartPoint).manhattanLength() > 20
|
||||
if ((me->globalPosition().toPoint() - m_dragStartPoint).manhattanLength() > 20
|
||||
&& m_materialToDrag->isDownloaded()) {
|
||||
QByteArray data;
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
@@ -76,7 +76,7 @@ bool ContentLibraryWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
}
|
||||
} else if (m_textureToDrag) {
|
||||
QMouseEvent *me = static_cast<QMouseEvent *>(event);
|
||||
if ((me->globalPos() - m_dragStartPoint).manhattanLength() > 20
|
||||
if ((me->globalPosition().toPoint() - m_dragStartPoint).manhattanLength() > 20
|
||||
&& m_textureToDrag->isDownloaded()) {
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData(Constants::MIME_TYPE_BUNDLE_TEXTURE,
|
||||
|
@@ -341,14 +341,14 @@ void GraphicsView::keyPressEvent(QKeyEvent *event)
|
||||
|
||||
void GraphicsView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (m_playhead.mousePress(globalToScene(event->globalPos()))) {
|
||||
if (m_playhead.mousePress(globalToScene(event->globalPosition().toPoint()))) {
|
||||
m_dragging = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Shortcut shortcut(event);
|
||||
if (shortcut == m_style.shortcuts.insertKeyframe) {
|
||||
m_scene->insertKeyframe(globalToRaster(event->globalPos()).x());
|
||||
m_scene->insertKeyframe(globalToRaster(event->globalPosition().toPoint()).x());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ void GraphicsView::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
void GraphicsView::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (m_playhead.mouseMove(globalToScene(event->globalPos()), this))
|
||||
if (m_playhead.mouseMove(globalToScene(event->globalPosition().toPoint()), this))
|
||||
return;
|
||||
|
||||
QGraphicsView::mouseMoveEvent(event);
|
||||
|
@@ -38,7 +38,7 @@ void Selector::mousePress(QMouseEvent *event, GraphicsView *view, GraphicsScene
|
||||
{
|
||||
m_shortcut = Shortcut(event);
|
||||
|
||||
QPointF click = view->globalToScene(event->globalPos());
|
||||
QPointF click = view->globalToScene(event->globalPosition().toPoint());
|
||||
|
||||
if (SelectableItem *sitem = scene->intersect(click)) {
|
||||
KeyframeItem *kitem = qobject_cast<KeyframeItem *>(sitem);
|
||||
@@ -54,8 +54,8 @@ void Selector::mousePress(QMouseEvent *event, GraphicsView *view, GraphicsScene
|
||||
applyPreSelection(scene);
|
||||
|
||||
// Init selection tools.
|
||||
m_mouseInit = event->globalPos();
|
||||
m_mouseCurr = event->globalPos();
|
||||
m_mouseInit = event->globalPosition().toPoint();
|
||||
m_mouseCurr = event->globalPosition().toPoint();
|
||||
|
||||
m_lasso = QPainterPath(click);
|
||||
m_lasso.closeSubpath();
|
||||
@@ -72,17 +72,17 @@ void Selector::mouseMove(QMouseEvent *event,
|
||||
if (m_mouseInit.isNull())
|
||||
return;
|
||||
|
||||
if ((event->globalPos() - m_mouseInit).manhattanLength() < QApplication::startDragDistance())
|
||||
if ((event->globalPosition().toPoint() - m_mouseInit).manhattanLength() < QApplication::startDragDistance())
|
||||
return;
|
||||
|
||||
QPointF delta = event->globalPos() - m_mouseCurr;
|
||||
QPointF delta = event->globalPosition().toPoint() - m_mouseCurr;
|
||||
if (m_shortcut == m_shortcuts.newSelection || m_shortcut == m_shortcuts.addToSelection
|
||||
|| m_shortcut == m_shortcuts.removeFromSelection
|
||||
|| m_shortcut == m_shortcuts.toggleSelection) {
|
||||
if (scene->hasActiveItem())
|
||||
return;
|
||||
|
||||
select(m_tool, view->globalToScene(event->globalPos()), scene);
|
||||
select(m_tool, view->globalToScene(event->globalPosition().toPoint()), scene);
|
||||
|
||||
event->accept();
|
||||
view->viewport()->update();
|
||||
@@ -91,13 +91,13 @@ void Selector::mouseMove(QMouseEvent *event,
|
||||
double bigger = std::abs(delta.x()) > std::abs(delta.y()) ? delta.x() : delta.y();
|
||||
double factor = bigger / view->width();
|
||||
view->setZoomX(view->zoomX() + factor, m_mouseInit);
|
||||
m_mouseCurr = event->globalPos();
|
||||
m_mouseCurr = event->globalPosition().toPoint();
|
||||
event->accept();
|
||||
|
||||
} else if (m_shortcut == m_shortcuts.pan) {
|
||||
view->scrollContent(-delta.x(), -delta.y());
|
||||
playhead.resize(view);
|
||||
m_mouseCurr = event->globalPos();
|
||||
m_mouseCurr = event->globalPosition().toPoint();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -77,7 +77,7 @@ bool ItemLibraryWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
} else if (event->type() == QMouseEvent::MouseMove) {
|
||||
if (m_itemToDrag.isValid()) {
|
||||
QMouseEvent *me = static_cast<QMouseEvent *>(event);
|
||||
if ((me->globalPos() - m_dragStartPoint).manhattanLength() > 10) {
|
||||
if ((me->globalPosition().toPoint() - m_dragStartPoint).manhattanLength() > 10) {
|
||||
ItemLibraryEntry entry = m_itemToDrag.value<ItemLibraryEntry>();
|
||||
// For drag to be handled correctly, we must have the component properly imported
|
||||
// beforehand, so we import the module immediately when the drag starts
|
||||
|
@@ -95,7 +95,7 @@ bool MaterialBrowserWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
|
||||
if (m_materialToDrag.isValid() || m_textureToDrag.isValid()) {
|
||||
QMouseEvent *me = static_cast<QMouseEvent *>(event);
|
||||
if ((me->globalPos() - m_dragStartPoint).manhattanLength() > 20) {
|
||||
if ((me->globalPosition().toPoint() - m_dragStartPoint).manhattanLength() > 20) {
|
||||
bool isMaterial = m_materialToDrag.isValid();
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
QByteArray internalId;
|
||||
|
@@ -288,7 +288,7 @@ bool NameItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *, const QS
|
||||
if (event->type() == QEvent::MouseButtonRelease) {
|
||||
auto mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->button() == Qt::RightButton) {
|
||||
openContextMenu(index, mouseEvent->globalPos());
|
||||
openContextMenu(index, mouseEvent->globalPosition().toPoint());
|
||||
mouseEvent->accept();
|
||||
return true;
|
||||
}
|
||||
|
@@ -340,14 +340,14 @@ void ColorPaletteBackend::releaseEyeDropper()
|
||||
|
||||
bool ColorPaletteBackend::handleEyeDropperMouseMove(QMouseEvent *e)
|
||||
{
|
||||
updateEyeDropperPosition(e->globalPos());
|
||||
updateEyeDropperPosition(e->globalPosition().toPoint());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ColorPaletteBackend::handleEyeDropperMouseButtonRelease(QMouseEvent *e)
|
||||
{
|
||||
if (e->button() == Qt::LeftButton)
|
||||
emit currentColorChanged(grabScreenColor(e->globalPos()));
|
||||
emit currentColorChanged(grabScreenColor(e->globalPosition().toPoint()));
|
||||
else
|
||||
emit eyeDropperRejected();
|
||||
|
||||
@@ -364,7 +364,7 @@ bool ColorPaletteBackend::handleEyeDropperKeyPress(QKeyEvent *e)
|
||||
} //else
|
||||
#endif
|
||||
//if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
|
||||
// emit currentColorChanged(grabScreenColor(e->globalPos()));
|
||||
// emit currentColorChanged(grabScreenColor(e->globalPosition().toPoint()));
|
||||
// releaseEyeDropper();
|
||||
//}
|
||||
e->accept();
|
||||
|
@@ -23,7 +23,7 @@ void SizeGrip::resizeEvent(QResizeEvent *e)
|
||||
void SizeGrip::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
QWidget::mousePressEvent(e);
|
||||
m_startPoint = e->globalPos();
|
||||
m_startPoint = e->globalPosition().toPoint();
|
||||
m_startRect = parentWidget()->rect();
|
||||
m_mouseDown = true;
|
||||
checkCursor(e->pos());
|
||||
@@ -32,7 +32,7 @@ void SizeGrip::mousePressEvent(QMouseEvent *e)
|
||||
void SizeGrip::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
if (m_mouseDown) {
|
||||
QPoint p = e->globalPos() - m_startPoint;
|
||||
QPoint p = e->globalPosition().toPoint() - m_startPoint;
|
||||
parentWidget()->resize(m_startRect.width() + p.x(), m_startRect.height() + p.y());
|
||||
} else {
|
||||
checkCursor(e->pos());
|
||||
|
@@ -37,5 +37,5 @@ void TreeView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
QTreeView::mousePressEvent(event);
|
||||
if (event->button() == Qt::RightButton)
|
||||
emit rightButtonClicked(currentIndex(), event->globalPos());
|
||||
emit rightButtonClicked(currentIndex(), event->globalPosition().toPoint());
|
||||
}
|
||||
|
@@ -1339,7 +1339,7 @@ void TerminalWidget::mousePressEvent(QMouseEvent *event)
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(configureAction);
|
||||
|
||||
contextMenu->popup(event->globalPos());
|
||||
contextMenu->popup(event->globalPosition().toPoint());
|
||||
} else if (m_selection) {
|
||||
copyToClipboard();
|
||||
setSelection(std::nullopt);
|
||||
|
@@ -78,7 +78,7 @@ void SizeHandleRect::mousePressEvent(QMouseEvent *e)
|
||||
return;
|
||||
|
||||
m_startSize = m_curSize = m_resizable->size();
|
||||
m_startPos = m_curPos = m_resizable->mapFromGlobal(e->globalPos());
|
||||
m_startPos = m_curPos = m_resizable->mapFromGlobal(e->globalPosition().toPoint());
|
||||
if (debugSizeHandle)
|
||||
qDebug() << "SizeHandleRect::mousePressEvent" << m_startSize << m_startPos << m_curPos;
|
||||
|
||||
@@ -94,7 +94,7 @@ void SizeHandleRect::mouseMoveEvent(QMouseEvent *e)
|
||||
// causes the handle and the mouse cursor to become out of sync
|
||||
// once a min/maxSize limit is hit. When the cursor reenters the valid
|
||||
// areas, it will now snap to it.
|
||||
m_curPos = m_resizable->mapFromGlobal(e->globalPos());
|
||||
m_curPos = m_resizable->mapFromGlobal(e->globalPosition().toPoint());
|
||||
QSize delta = QSize(m_curPos.x() - m_startPos.x(), m_curPos.y() - m_startPos.y());
|
||||
switch (m_dir) {
|
||||
case Right:
|
||||
|
Reference in New Issue
Block a user