From 9eaa72c3fa8f33ddde8200fd96b6f3a555fb1378 Mon Sep 17 00:00:00 2001 From: Ernie Pasveer Date: Mon, 7 Oct 2024 18:08:06 -0500 Subject: [PATCH] Fixed, as best I can, the minimizing of detached windows. --- src/QDetachTabWidget.cpp | 31 ++++++++++++++++++++++++----- src/QDetachTabWidget.h | 2 +- src/SeerConsoleWidget.cpp | 1 - src/SeerEditorWidgetSourceAreas.cpp | 2 +- src/SeerGdbWidget.cpp | 8 ++------ src/SeerLogWidget.cpp | 7 ------- src/SeerStackFramesBrowserWidget.ui | 4 ++-- 7 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/QDetachTabWidget.cpp b/src/QDetachTabWidget.cpp index ae0ab8b3..9e035532 100644 --- a/src/QDetachTabWidget.cpp +++ b/src/QDetachTabWidget.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include QDetachTabWidget::QDetachTabWidget(QWidget* parent) : QTabWidget(parent) { @@ -42,7 +43,7 @@ QWidget* QDetachTabWidget::tabWidget (int tabIndex) const { return _tabInfo[tabIndex]._widget; } -void QDetachTabWidget::detachTab (int tabIndex) { +void QDetachTabWidget::detachTab (int tabIndex, bool minimized) { // Get the tab the user selected. QWidget* w = widget(tabIndex); @@ -77,7 +78,12 @@ void QDetachTabWidget::detachTab (int tabIndex) { w->setWindowFlags(flags); w->setWindowTitle(tabinfo._title); w->setWindowIcon(windowIcon()); - w->showMinimized(); + + if (minimized) { + w->showMinimized(); + }else{ + w->showNormal(); + } // Connect the placeholder's 'reattach' signal to the slot. QObject::connect(placeholder, &QDetachTabWidgetPlaceholder::reattach, this, &QDetachTabWidget::handleTabClosedRequested); @@ -153,16 +159,19 @@ void QDetachTabWidget::handleShowContextMenu (const QPoint& point) { // Create the menu. QMenu menu("Window Action", this); - QAction* detachAction = menu.addAction(tr("Detach")); - QAction* reattachAction = menu.addAction(tr("Reattach")); + QAction* detachAction = menu.addAction(tr("Detach")); + QAction* detachMinimizedAction = menu.addAction(tr("Detach Minimized")); + QAction* reattachAction = menu.addAction(tr("Reattach")); // Enable/disable depending if it was already detached. QWidget* w = widget(tabIndex); if (w->objectName() == "QDetachTabWidgetPlaceholder") { detachAction->setEnabled(false); + detachMinimizedAction->setEnabled(false); reattachAction->setEnabled(true); }else{ detachAction->setEnabled(true); + detachMinimizedAction->setEnabled(true); reattachAction->setEnabled(false); } @@ -175,7 +184,19 @@ void QDetachTabWidget::handleShowContextMenu (const QPoint& point) { if (action == detachAction) { // Detach the tab. - detachTab(tabIndex); + detachTab(tabIndex, false); + + // Set the tabwidget to the placeholder tab. + setCurrentIndex(tabIndex); + } + + // + // Handle detaching a tab. + // + if (action == detachMinimizedAction) { + + // Detach the tab. + detachTab(tabIndex, true); // Set the tabwidget to the placeholder tab. setCurrentIndex(tabIndex); diff --git a/src/QDetachTabWidget.h b/src/QDetachTabWidget.h index c866b09e..e9f86747 100644 --- a/src/QDetachTabWidget.h +++ b/src/QDetachTabWidget.h @@ -25,7 +25,7 @@ class QDetachTabWidget : public QTabWidget { QWidget* tabWidget (int tabIndex) const; public slots: - void detachTab (int tabIndex); + void detachTab (int tabIndex, bool minimized=false); void reattachTab (int tabIndex); signals: diff --git a/src/SeerConsoleWidget.cpp b/src/SeerConsoleWidget.cpp index bfe9d805..a0fa6f30 100644 --- a/src/SeerConsoleWidget.cpp +++ b/src/SeerConsoleWidget.cpp @@ -34,7 +34,6 @@ SeerConsoleWidget::SeerConsoleWidget (QWidget* parent) : QWidget(parent) { // Setup the widgets setWindowIcon(QIcon(":/seer/resources/seergdb_64x64.png")); setWindowTitle("Seer Console"); - setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint); textEdit->setReadOnly(true); textEdit->setTextInteractionFlags(textEdit->textInteractionFlags() | Qt::TextSelectableByKeyboard); // Show cursor diff --git a/src/SeerEditorWidgetSourceAreas.cpp b/src/SeerEditorWidgetSourceAreas.cpp index 5bfcfb03..68916330 100644 --- a/src/SeerEditorWidgetSourceAreas.cpp +++ b/src/SeerEditorWidgetSourceAreas.cpp @@ -1767,7 +1767,7 @@ void SeerEditorWidgetSourceArea::handleText (const QString& text) { } if (id_text.toInt() == _selectedBreakpointId && _selectedBreakpointPosition != QPoint()) { - qDebug() << "XXX - Error displaying breakpoint info as a ToolTip"; + qDebug() << "Error displaying breakpoint info as a ToolTip"; } return; diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index f834a03b..6173d42e 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -2859,20 +2859,16 @@ void SeerGdbWidget::handleConsoleModeChanged () { } if (_consoleMode == "detached") { - logsTabWidget->detachTab(_consoleIndex); - _consoleWidget->setWindowState(Qt::WindowNoState); + logsTabWidget->detachTab(_consoleIndex, false); _consoleWidget->raise(); _consoleWidget->resetSize(); }else if (_consoleMode == "detachedminimized") { - logsTabWidget->detachTab(_consoleIndex); - _consoleWidget->setWindowState(Qt::WindowMinimized); + logsTabWidget->detachTab(_consoleIndex, true); _consoleWidget->resetSize(); }else if (_consoleMode == "attached") { logsTabWidget->reattachTab(_consoleIndex); - _consoleWidget->setWindowState(Qt::WindowNoState); }else{ logsTabWidget->reattachTab(_consoleIndex); - _consoleWidget->setWindowState(Qt::WindowNoState); } } diff --git a/src/SeerLogWidget.cpp b/src/SeerLogWidget.cpp index 31edc765..db354fe3 100644 --- a/src/SeerLogWidget.cpp +++ b/src/SeerLogWidget.cpp @@ -54,13 +54,6 @@ void SeerLogWidget::setLogEnabled (bool flag) { void SeerLogWidget::moveToEnd () { - /* XXX - // Move to the end and then to the beginning of that line. - QTextCursor cursor = textEdit->textCursor(); - textEdit->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); - textEdit->moveCursor(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor); - */ - textEdit->verticalScrollBar()->setValue(textEdit->verticalScrollBar()->maximum()); } diff --git a/src/SeerStackFramesBrowserWidget.ui b/src/SeerStackFramesBrowserWidget.ui index cecc4edf..e5f45be0 100644 --- a/src/SeerStackFramesBrowserWidget.ui +++ b/src/SeerStackFramesBrowserWidget.ui @@ -6,8 +6,8 @@ 0 0 - 794 - 528 + 600 + 700