Skip to content

Commit 1ad6cae

Browse files
authored
Merge pull request #1 from githubuser0xFFFF/master
merge base
2 parents 2570a88 + 4dde545 commit 1ad6cae

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

src/DockWidget.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ struct DockWidgetPrivate
6161
CDockWidget* _this;
6262
QBoxLayout* Layout;
6363
QWidget* Widget = nullptr;
64-
CDockWidgetTab* TabWidget;
64+
CDockWidgetTab* TabWidget = nullptr;
6565
CDockWidget::DockWidgetFeatures Features = CDockWidget::AllDockWidgetFeatures;
6666
CDockManager* DockManager = nullptr;
6767
CDockAreaWidget* DockArea = nullptr;
68-
QAction* ToggleViewAction;
68+
QAction* ToggleViewAction = nullptr;
6969
bool Closed = false;
7070
QScrollArea* ScrollArea = nullptr;
7171
QToolBar* ToolBar = nullptr;
@@ -507,7 +507,16 @@ bool CDockWidget::event(QEvent *e)
507507
{
508508
if (e->type() == QEvent::WindowTitleChange)
509509
{
510-
emit titleChanged(windowTitle());
510+
const auto title = windowTitle();
511+
if (d->TabWidget)
512+
{
513+
d->TabWidget->setText(title);
514+
}
515+
if (d->ToggleViewAction)
516+
{
517+
d->ToggleViewAction->setText(title);
518+
}
519+
emit titleChanged(title);
511520
}
512521
return QFrame::event(e);
513522
}

src/DockWidgetTab.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,14 @@ void CDockWidgetTab::setVisible(bool visible)
482482
}
483483

484484

485+
//============================================================================
486+
void CDockWidgetTab::setText(const QString& title)
487+
{
488+
d->TitleLabel->setText(title);
489+
}
490+
491+
492+
485493
//============================================================================
486494
bool CDockWidgetTab::isClosable() const
487495
{

src/DockWidgetTab.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,21 @@ private slots:
125125
*/
126126
QString text() const;
127127

128+
129+
/**
130+
* Sets the tab text
131+
*/
132+
void setText(const QString& title);
133+
128134
/**
129135
* This function returns true if the assigned dock widget is closeable
130136
*/
131137
bool isClosable() const;
132138

133139
public slots:
134-
virtual void setVisible(bool visible) override;
140+
141+
virtual void setVisible(bool visible) override;
142+
135143

136144
signals:
137145
void activeTabChanged();

0 commit comments

Comments
 (0)