File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,11 @@ struct DockWidgetPrivate
62
62
CDockWidget* _this;
63
63
QBoxLayout* Layout;
64
64
QWidget* Widget = nullptr ;
65
- CDockWidgetTab* TabWidget;
65
+ CDockWidgetTab* TabWidget = nullptr ;
66
66
CDockWidget::DockWidgetFeatures Features = CDockWidget::AllDockWidgetFeatures;
67
67
CDockManager* DockManager = nullptr ;
68
68
CDockAreaWidget* DockArea = nullptr ;
69
- QAction* ToggleViewAction;
69
+ QAction* ToggleViewAction = nullptr ;
70
70
bool Closed = false ;
71
71
QScrollArea* ScrollArea = nullptr ;
72
72
QToolBar* ToolBar = nullptr ;
@@ -497,7 +497,16 @@ bool CDockWidget::event(QEvent *e)
497
497
{
498
498
if (e->type () == QEvent::WindowTitleChange)
499
499
{
500
- emit titleChanged (windowTitle ());
500
+ const auto title = windowTitle ();
501
+ if (d->TabWidget )
502
+ {
503
+ d->TabWidget ->setText (title);
504
+ }
505
+ if (d->ToggleViewAction )
506
+ {
507
+ d->ToggleViewAction ->setText (title);
508
+ }
509
+ emit titleChanged (title);
501
510
}
502
511
return QFrame::event (e);
503
512
}
Original file line number Diff line number Diff line change @@ -466,6 +466,14 @@ void CDockWidgetTab::setVisible(bool visible)
466
466
}
467
467
468
468
469
+ // ============================================================================
470
+ void CDockWidgetTab::setText (const QString& title)
471
+ {
472
+ d->TitleLabel ->setText (title);
473
+ }
474
+
475
+
476
+
469
477
// ============================================================================
470
478
bool CDockWidgetTab::isClosable () const
471
479
{
Original file line number Diff line number Diff line change @@ -125,13 +125,20 @@ private slots:
125
125
*/
126
126
QString text () const ;
127
127
128
+
129
+ /* *
130
+ * Sets the tab text
131
+ */
132
+ void setText (const QString& title);
133
+
128
134
/* *
129
135
* This function returns true if the assigned dock widget is closeable
130
136
*/
131
137
bool isClosable () const ;
132
138
133
139
public slots:
134
140
virtual void setVisible (bool visible);
141
+
135
142
136
143
signals:
137
144
void activeTabChanged ();
You can’t perform that action at this time.
0 commit comments