# Path: objbrowser/qtpy/QtCore.py

# 
# Path: objbrowser/qtpy/QtWidgets.py

# 
# Path: objbrowser/qtpy/QtCore.py

# 
# Path: objbrowser/app.py
# def get_qsettings():
#     """ Creates a QSettings object for this application.    
#         We do not set the application and organization in the QApplication object to 
#         prevent side-effects.
#     """
#     return QtCore.QSettings("titusjan.nl", PROGRAM_NAME)


import logging
from objbrowser.qtpy import QtCore, QtWidgets
from objbrowser.qtpy.QtCore import Qt
from objbrowser.app import get_qsettings

class ToggleColumnMixIn(object):
    """ Adds actions to a QTableView that can show/hide columns 
        by right clicking on the header
    """ 
    def add_header_context_menu(self, checked = None, checkable = None, enabled = None):
        """ Adds the context menu from using header information
        
            checked can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the checked value from the dictionary. 
            The corresponding column will be hidden if checked is False.
        
            checkable can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the checkable value from the dictionary.
            
            enabled can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the enabled value from the dictionary.
        """
        checked = checked if checked is not None else {}
        checkable = checkable if checkable is not None else {}
        enabled = enabled if enabled is not None else {}
        
        horizontal_header = self._horizontal_header()
        horizontal_header.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)

        self.toggle_column_actions_group = QtWidgets.QActionGroup(self)
        self.toggle_column_actions_group.setExclusive(False)
        self.__toggle_functions = []  # for keeping references
        
        for col in range(horizontal_header.count()):

# Path: objbrowser/qtpy/QtCore.py

# 
# Path: objbrowser/qtpy/QtWidgets.py

# 
# Path: objbrowser/qtpy/QtCore.py

# 
# Path: objbrowser/app.py
# def get_qsettings():
#     """ Creates a QSettings object for this application.    
#         We do not set the application and organization in the QApplication object to 
#         prevent side-effects.
#     """
#     return QtCore.QSettings("titusjan.nl", PROGRAM_NAME)


# Path: objbrowser/toggle_column_mixin.py
import logging
from objbrowser.qtpy import QtCore, QtWidgets
from objbrowser.qtpy.QtCore import Qt
from objbrowser.app import get_qsettings


class ToggleColumnMixIn(object):
    """ Adds actions to a QTableView that can show/hide columns 
        by right clicking on the header
    """ 
    def add_header_context_menu(self, checked = None, checkable = None, enabled = None):
        """ Adds the context menu from using header information
        
            checked can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the checked value from the dictionary. 
            The corresponding column will be hidden if checked is False.
        
            checkable can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the checkable value from the dictionary.
            
            enabled can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the enabled value from the dictionary.
        """
        checked = checked if checked is not None else {}
        checkable = checkable if checkable is not None else {}
        enabled = enabled if enabled is not None else {}
        
        horizontal_header = self._horizontal_header()
        horizontal_header.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)

        self.toggle_column_actions_group = QtWidgets.QActionGroup(self)
        self.toggle_column_actions_group.setExclusive(False)
        self.__toggle_functions = []  # for keeping references
        
        for col in range(horizontal_header.count()):

            column_label = self.model().headerData(col, Qt.Horizontal, Qt.DisplayRole)