Add scrollbar to options dialog
This commit is contained in:
parent
90b6b82d1d
commit
3b90f0f2ea
@ -55,7 +55,7 @@ class WidgetSize(object):
|
|||||||
'''
|
'''
|
||||||
constant values
|
constant values
|
||||||
'''
|
'''
|
||||||
dialog_width = 720
|
dialog_width = 730
|
||||||
dialog_height_margin = 146
|
dialog_height_margin = 146
|
||||||
map_min_height = 0
|
map_min_height = 0
|
||||||
map_max_height = 30
|
map_max_height = 30
|
||||||
|
|||||||
@ -239,7 +239,11 @@ class OptionsDialog(Dialog):
|
|||||||
self.tab_widget.currentChanged.connect(self.changedTab)
|
self.tab_widget.currentChanged.connect(self.changedTab)
|
||||||
self.changedTab(self.tab_widget.currentIndex())
|
self.changedTab(self.tab_widget.currentIndex())
|
||||||
# size
|
# size
|
||||||
self.adjustSize()
|
tab_frame_width = self.tabs[self.tab_widget.currentIndex()].frameSize().width()
|
||||||
|
self.resize(
|
||||||
|
tab_frame_width + self.frameSize().width() - tab_frame_width,
|
||||||
|
min(max(3, len(self.current_model['flds'])+1), 14) * WIDGET_SIZE.map_max_height + WIDGET_SIZE.dialog_height_margin
|
||||||
|
)
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def addTab(self, maps=None, forcus=True):
|
def addTab(self, maps=None, forcus=True):
|
||||||
@ -303,7 +307,7 @@ class OptionsDialog(Dialog):
|
|||||||
config.update(data)
|
config.update(data)
|
||||||
|
|
||||||
|
|
||||||
class TabContent(QWidget):
|
class TabContent(QScrollArea):
|
||||||
'''Options tab content'''
|
'''Options tab content'''
|
||||||
|
|
||||||
def __init__(self, model, conf, services):
|
def __init__(self, model, conf, services):
|
||||||
@ -315,9 +319,13 @@ class TabContent(QWidget):
|
|||||||
self._options = list()
|
self._options = list()
|
||||||
self._was_built = False
|
self._was_built = False
|
||||||
# add dicts mapping
|
# add dicts mapping
|
||||||
|
self.dicts_widget = QWidget()
|
||||||
self.dicts_layout = QGridLayout()
|
self.dicts_layout = QGridLayout()
|
||||||
self.dicts_layout.setSizeConstraint(QLayout.SetMinAndMaxSize)
|
self.dicts_layout.setSizeConstraint(QLayout.SetMinAndMaxSize)
|
||||||
self.setLayout(self.dicts_layout)
|
self.dicts_widget.setLayout(self.dicts_layout)
|
||||||
|
self.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.setWidgetResizable(True)
|
||||||
|
self.setWidget(self.dicts_widget)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
'''
|
'''
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class WidgetSize(object):
|
|||||||
'''
|
'''
|
||||||
constant values
|
constant values
|
||||||
'''
|
'''
|
||||||
dialog_width = 720
|
dialog_width = 730
|
||||||
dialog_height_margin = 146
|
dialog_height_margin = 146
|
||||||
map_min_height = 0
|
map_min_height = 0
|
||||||
map_max_height = 30
|
map_max_height = 30
|
||||||
|
|||||||
@ -239,7 +239,11 @@ class OptionsDialog(Dialog):
|
|||||||
self.tab_widget.currentChanged.connect(self.changedTab)
|
self.tab_widget.currentChanged.connect(self.changedTab)
|
||||||
self.changedTab(self.tab_widget.currentIndex())
|
self.changedTab(self.tab_widget.currentIndex())
|
||||||
# size
|
# size
|
||||||
self.adjustSize()
|
tab_frame_width = self.tabs[self.tab_widget.currentIndex()].frameSize().width()
|
||||||
|
self.resize(
|
||||||
|
tab_frame_width + self.frameSize().width() - tab_frame_width,
|
||||||
|
min(max(3, len(self.current_model['flds'])+1), 14) * WIDGET_SIZE.map_max_height + WIDGET_SIZE.dialog_height_margin
|
||||||
|
)
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def addTab(self, maps=None, forcus=True):
|
def addTab(self, maps=None, forcus=True):
|
||||||
@ -303,7 +307,7 @@ class OptionsDialog(Dialog):
|
|||||||
config.update(data)
|
config.update(data)
|
||||||
|
|
||||||
|
|
||||||
class TabContent(QWidget):
|
class TabContent(QScrollArea):
|
||||||
'''Options tab content'''
|
'''Options tab content'''
|
||||||
|
|
||||||
def __init__(self, model, conf, services):
|
def __init__(self, model, conf, services):
|
||||||
@ -315,9 +319,13 @@ class TabContent(QWidget):
|
|||||||
self._options = list()
|
self._options = list()
|
||||||
self._was_built = False
|
self._was_built = False
|
||||||
# add dicts mapping
|
# add dicts mapping
|
||||||
|
self.dicts_widget = QWidget()
|
||||||
self.dicts_layout = QGridLayout()
|
self.dicts_layout = QGridLayout()
|
||||||
self.dicts_layout.setSizeConstraint(QLayout.SetMinAndMaxSize)
|
self.dicts_layout.setSizeConstraint(QLayout.SetMinAndMaxSize)
|
||||||
self.setLayout(self.dicts_layout)
|
self.dicts_widget.setLayout(self.dicts_layout)
|
||||||
|
self.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.setWidgetResizable(True)
|
||||||
|
self.setWidget(self.dicts_widget)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
'''
|
'''
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user