File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -61,11 +61,11 @@ struct DockWidgetPrivate
61
61
CDockWidget* _this;
62
62
QBoxLayout* Layout;
63
63
QWidget* Widget = nullptr ;
64
- CDockWidgetTab* TabWidget;
64
+ CDockWidgetTab* TabWidget = nullptr ;
65
65
CDockWidget::DockWidgetFeatures Features = CDockWidget::AllDockWidgetFeatures;
66
66
CDockManager* DockManager = nullptr ;
67
67
CDockAreaWidget* DockArea = nullptr ;
68
- QAction* ToggleViewAction;
68
+ QAction* ToggleViewAction = nullptr ;
69
69
bool Closed = false ;
70
70
QScrollArea* ScrollArea = nullptr ;
71
71
QToolBar* ToolBar = nullptr ;
@@ -507,7 +507,16 @@ bool CDockWidget::event(QEvent *e)
507
507
{
508
508
if (e->type () == QEvent::WindowTitleChange)
509
509
{
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);
511
520
}
512
521
return QFrame::event (e);
513
522
}
Original file line number Diff line number Diff line change @@ -482,6 +482,14 @@ void CDockWidgetTab::setVisible(bool visible)
482
482
}
483
483
484
484
485
+ // ============================================================================
486
+ void CDockWidgetTab::setText (const QString& title)
487
+ {
488
+ d->TitleLabel ->setText (title);
489
+ }
490
+
491
+
492
+
485
493
// ============================================================================
486
494
bool CDockWidgetTab::isClosable () const
487
495
{
Original file line number Diff line number Diff line change @@ -125,13 +125,21 @@ 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
- virtual void setVisible (bool visible) override ;
140
+
141
+ virtual void setVisible (bool visible) override ;
142
+
135
143
136
144
signals:
137
145
void activeTabChanged ();
You can’t perform that action at this time.
0 commit comments