def syncView(self, recursive=False):
        gantt = self.ganttWidget()
        tree = self.treeWidget()
        if not gantt:
            return
        vwidget = gantt.viewWidget()
        scene = vwidget.scene()
        cell_w = gantt.cellWidth()
        tree_offset_y  = tree.header().height() + 1
        tree_offset_y += tree.verticalScrollBar().value()
        items = [self]
        if recursive:
            items += list(self.children(recursive=True))
        for item in items:
            vitem = item.viewItem()
            if not vitem.scene():
                scene.addItem(vitem)
            if item.isHidden() or not tree:
                vitem.hide()
                continue
            vitem.show()
            tree_rect = tree.visualItemRect(item)
            tree_y  = tree_rect.y() + tree_offset_y
            tree_h  = tree_rect.height()
            if tree_rect.height() == 0:
                vitem.hide()
                continue
            if gantt.timescale() in (gantt.Timescale.Minute,
                                     gantt.Timescale.Hour, 
                                     gantt.Timescale.Day):
                dstart = item.dateTimeStart()
                dend   = item.dateTimeEnd()
                view_x = scene.datetimeXPos(dstart)
                view_r = scene.datetimeXPos(dend)
                view_w = view_r - view_x
            else:
                view_x = scene.dateXPos(item.dateStart())
                view_w = item.duration() * cell_w
                if not item.isAllDay():
                    full_day = 24 * 60 * 60
                    start      = item.timeStart()
                    start_day  = (start.hour() * 60 * 60) 
                    start_day += (start.minute() * 60) 
                    start_day += (start.second())
                    offset_start = (start_day / float(full_day)) * cell_w
                    end         = item.timeEnd()
                    end_day     = (end.hour() * 60 * 60)
                    end_day    += (start.minute() * 60)
                    end_day    += (start.second() + 1)
                    offset_end  = ((full_day - end_day) / float(full_day))
                    offset_end *= cell_w
                    view_x += offset_start
                    view_w -= (offset_start + offset_end)
            view_w = max(view_w, 5)
            vitem.setSyncing(True)
            vitem.setPos(view_x, tree_y)
            vitem.setRect(0, 0, view_w, tree_h)
            vitem.setSyncing(False)
            flags  = vitem.ItemIsSelectable 
            flags |= vitem.ItemIsFocusable
            if item.flags() & Qt.ItemIsEditable:
                flags |= vitem.ItemIsMovable
            vitem.setFlags(flags)
            item.syncDependencies()