Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed, as best I can, the minimizing of detached windows. #254

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions src/QDetachTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QAction>
#include <QtGui/QCursor>
#include <QtGui/QIcon>
#include <QtCore/QTimer>
#include <QtCore/QDebug>

QDetachTabWidget::QDetachTabWidget(QWidget* parent) : QTabWidget(parent) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/QDetachTabWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion src/SeerConsoleWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/SeerEditorWidgetSourceAreas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions src/SeerGdbWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
7 changes: 0 additions & 7 deletions src/SeerLogWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
4 changes: 2 additions & 2 deletions src/SeerStackFramesBrowserWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>794</width>
<height>528</height>
<width>600</width>
<height>700</height>
</rect>
</property>
<property name="windowTitle">
Expand Down
Loading