void ChatRooms::closeCurrent() { ChatRoom* room = dynamic_cast<ChatRoom*>(currentWidget()); if (room) museeq->leaveRoom(room->room()); else { PublicChat* pchat = dynamic_cast<PublicChat*>(currentWidget()); if (pchat) { museeq->stopPublicChat(); delete pchat; } } }