mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
Merge pull request #254 from epasveer/253-detachable-tabs-are-always-detached-minimized
Fixed, as best I can, the minimizing of detached windows.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <QAction>
|
||||
#include <QtGui/QCursor>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
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);
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user