Commit fa5fa92b authored by Yimgo's avatar Yimgo

ToolWidget unpin fixed.

parent 60e3951a
...@@ -2041,7 +2041,6 @@ void UBBoardController::togglePodcast(bool checked) ...@@ -2041,7 +2041,6 @@ void UBBoardController::togglePodcast(bool checked)
void UBBoardController::moveGraphicsWidgetToControlView(UBGraphicsWidgetItem* graphicsWidget) void UBBoardController::moveGraphicsWidgetToControlView(UBGraphicsWidgetItem* graphicsWidget)
{ {
QPointF controlViewPos = mControlView->mapFromScene(graphicsWidget->sceneBoundingRect().center());
graphicsWidget->hide(); graphicsWidget->hide();
UBToolWidget *toolWidget = new UBToolWidget(graphicsWidget); UBToolWidget *toolWidget = new UBToolWidget(graphicsWidget);
...@@ -2055,30 +2054,11 @@ void UBBoardController::moveGraphicsWidgetToControlView(UBGraphicsWidgetItem* gr ...@@ -2055,30 +2054,11 @@ void UBBoardController::moveGraphicsWidgetToControlView(UBGraphicsWidgetItem* gr
void UBBoardController::moveToolWidgetToScene(UBToolWidget* toolWidget) void UBBoardController::moveToolWidgetToScene(UBToolWidget* toolWidget)
{ {
QPoint mainWindowCenter = (QPointF(toolWidget->preferredWidth(), toolWidget->preferredHeight()) / 2).toPoint();
UBGraphicsWidgetItem *graphicsWidgetItem = toolWidget->graphicsWidgetItem(); UBGraphicsWidgetItem *graphicsWidgetItem = toolWidget->graphicsWidgetItem();
graphicsWidgetItem->setParent(0);
if (qobject_cast<UBGraphicsW3CWidgetItem*>(graphicsWidgetItem))
{
graphicsWidgetItem = qobject_cast<UBGraphicsW3CWidgetItem*>(graphicsWidgetItem);
}
else
{
if (qobject_cast<UBGraphicsAppleWidgetItem*>(graphicsWidgetItem))
{
graphicsWidgetItem = qobject_cast<UBGraphicsAppleWidgetItem*>(graphicsWidgetItem);
}
}
QPoint controlViewCenter = mControlView->mapFrom(mMainWindow, mainWindowCenter);
QPointF scenePos = mControlView->mapToScene(controlViewCenter);
mActiveScene->addGraphicsWidget(graphicsWidgetItem, scenePos);
toolWidget->hide(); toolWidget->hide();
toolWidget->deleteLater(); graphicsWidgetItem->show();
graphicsWidgetItem->setSelected(true);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment