Add text configuration in panel
This commit is contained in:
@@ -291,6 +291,7 @@ void CaptureWidget::mousePressEvent(QMouseEvent *e) {
|
||||
}
|
||||
}
|
||||
m_activeTool = m_activeButton->tool()->copy(this);
|
||||
|
||||
connect(this, &CaptureWidget::colorChanged,
|
||||
m_activeTool, &CaptureTool::colorChanged);
|
||||
connect(this, &CaptureWidget::thicknessChanged,
|
||||
@@ -573,13 +574,12 @@ void CaptureWidget::setState(CaptureButton *b) {
|
||||
if (m_toolWidget) {
|
||||
m_toolWidget->deleteLater();
|
||||
if (m_activeTool->isValid()) {
|
||||
auto mod = new ModificationCommand(
|
||||
&m_context.screenshot, m_activeTool);
|
||||
m_undoStack.push(mod);
|
||||
m_activeTool = nullptr;
|
||||
pushToolToStack();
|
||||
}
|
||||
}
|
||||
processTool(b->tool());
|
||||
if (m_activeButton != b) {
|
||||
processTool(b->tool());
|
||||
}
|
||||
// Only close activated from button
|
||||
if (b->tool()->closeOnButtonPressed()) {
|
||||
close();
|
||||
@@ -587,12 +587,15 @@ void CaptureWidget::setState(CaptureButton *b) {
|
||||
|
||||
if (b->tool()->isSelectable()) {
|
||||
if (m_activeButton != b) {
|
||||
QWidget *confW = b->tool()->configurationWidget();
|
||||
m_panel->addToolWidget(confW);
|
||||
if (m_activeButton) {
|
||||
m_activeButton->setColor(m_uiColor);
|
||||
}
|
||||
m_activeButton = b;
|
||||
m_activeButton->setColor(m_contrastUiColor);
|
||||
} else if (m_activeButton) {
|
||||
m_panel->clearToolWidget();
|
||||
m_activeButton->setColor(m_uiColor);
|
||||
m_activeButton = nullptr;
|
||||
}
|
||||
@@ -606,10 +609,6 @@ void CaptureWidget::processTool(CaptureTool *t) {
|
||||
m_activeTool = t;
|
||||
t->pressed(m_context);
|
||||
m_activeTool = backup;
|
||||
QWidget *cw = t->configurationWidget();
|
||||
if (cw) {
|
||||
m_panel->addToolWidget(t->configurationWidget());
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureWidget::handleButtonSignal(CaptureTool::Request r) {
|
||||
@@ -797,11 +796,14 @@ void CaptureWidget::updateCursor() {
|
||||
void CaptureWidget::pushToolToStack() {
|
||||
auto mod = new ModificationCommand(
|
||||
&m_context.screenshot, m_activeTool);
|
||||
m_undoStack.push(mod);
|
||||
disconnect(this, &CaptureWidget::colorChanged,
|
||||
m_activeTool, &CaptureTool::colorChanged);
|
||||
disconnect(this, &CaptureWidget::thicknessChanged,
|
||||
m_activeTool, &CaptureTool::thicknessChanged);
|
||||
if (m_panel->toolWidget()) {
|
||||
disconnect(m_panel->toolWidget(), nullptr, m_activeTool, nullptr);
|
||||
}
|
||||
m_undoStack.push(mod);
|
||||
m_activeTool = nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user