@@ -2769,18 +2769,31 @@ void MainWindow::setupChatHistory()
2769
2769
if (listview)
2770
2770
{
2771
2771
auto chat = new ChatTextList (ui.chatTab );
2772
- delete ui.chatTab ->layout ()->replaceWidget (ui.chatEdit , chat);
2772
+ auto layout = ui.chatTab ->layout ();
2773
+ auto index = layout->indexOf (ui.chatEdit );
2774
+ layout->removeWidget (ui.chatEdit );
2775
+ layout->addWidget (chat);
2773
2776
m_chathistory[TAB_CHAT] = chat;
2777
+ delete ui.chatEdit ;
2778
+ ui.chatEdit = nullptr ;
2774
2779
2775
2780
auto video = new ChatTextList (ui.videoTab );
2776
- delete ui.videoTab ->layout ()->replaceWidget (ui.videochatEdit , video);
2781
+ layout = ui.videoTab ->layout ();
2782
+ index = layout->indexOf (ui.videochatEdit );
2783
+ layout->removeWidget (ui.videochatEdit );
2784
+ layout->addWidget (video);
2777
2785
m_chathistory[TAB_VIDEO] = video;
2786
+ delete ui.videochatEdit ;
2787
+ ui.videochatEdit = nullptr ;
2778
2788
2779
2789
auto desktop = new ChatTextList (ui.desktopTab );
2780
- delete ui.desktopTab ->layout ()->replaceWidget (ui.desktopchatEdit , desktop);
2790
+ layout = ui.desktopTab ->layout ();
2791
+ index = layout->indexOf (ui.desktopchatEdit );
2792
+ layout->removeWidget (ui.desktopchatEdit );
2793
+ layout->addWidget (desktop);
2781
2794
m_chathistory[TAB_DESKTOP] = desktop;
2782
-
2783
- ui.chatEdit = ui. videochatEdit = ui. desktopchatEdit = nullptr ;
2795
+ delete ui. desktopchatEdit ;
2796
+ ui.desktopchatEdit = nullptr ;
2784
2797
}
2785
2798
else
2786
2799
{
0 commit comments