follow-up 7dcd8d8dc8
- set minimumHeight of VTabWidget (needed for small window size) - keep self.tabBar visible, otherwise the widget border is rendered with a gap on linux - apply stylesheet to both tabTar and surrounding widget - buttons style: align text left, NoFocus - on button click: setChecked always True, draw qr code at the end because it is slow
This commit is contained in:
@@ -155,6 +155,8 @@ class ReceiveTab(QWidget, MessageBoxMixin, Logger):
|
||||
|
||||
from .util import VTabWidget
|
||||
self.receive_tabs = VTabWidget()
|
||||
self.receive_tabs.setMinimumHeight(ReceiveTabWidget.min_size.height())
|
||||
|
||||
#self.receive_tabs.setMinimumHeight(ReceiveTabWidget.min_size.height() + 4) # for margins
|
||||
self.receive_tabs.addTab(self.receive_URI_widget, read_QIcon("link.png"), _('URI'))
|
||||
self.receive_tabs.addTab(self.receive_address_widget, read_QIcon("bitcoin.png"), _('Address'))
|
||||
|
||||
@@ -1576,7 +1576,6 @@ class SquareTabWidget(QtWidgets.QTabWidget):
|
||||
# keep square aspect ratio when resized
|
||||
size = e.size()
|
||||
w = size.height()
|
||||
w += self.tabBar().width() if self.tabBar().isVisible() else 0
|
||||
self.setFixedWidth(w)
|
||||
return super().resizeEvent(e)
|
||||
|
||||
@@ -1606,9 +1605,8 @@ class VTabWidget(QWidget):
|
||||
_tabs_vbox_outer.addStretch(1)
|
||||
|
||||
self.content_w = content_w = SquareTabWidget()
|
||||
content_w.setStyleSheet("QTabBar::tab {height: 0px;}") # TODO Linux/mac: still insufficient to rm top padding...
|
||||
content_w.tabBar().hide()
|
||||
|
||||
content_w.setStyleSheet("QWidget {height: 0px; padding:0px; } QTabBar::tab {height: 0px; padding:0px; }")
|
||||
content_w.tabBar().setMaximumHeight(0) # without this QDarkStyle displays the underlining
|
||||
hbox.addStretch(1)
|
||||
hbox.addWidget(_tabs_vbox_outer_w)
|
||||
hbox.addWidget(content_w)
|
||||
@@ -1618,14 +1616,17 @@ class VTabWidget(QWidget):
|
||||
|
||||
def addTab(self, widget: QWidget, icon: QIcon, text: str):
|
||||
btn = QPushButton(icon, text)
|
||||
btn.setStyleSheet("QPushButton { text-align: left; }")
|
||||
btn.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||
btn.setCheckable(True)
|
||||
btn.setSizePolicy(QSizePolicy.Preferred, btn.sizePolicy().verticalPolicy())
|
||||
|
||||
def on_btn_click():
|
||||
self.content_w.setCurrentIndex(idx)
|
||||
btn.setChecked(True)
|
||||
for btn2 in self._tab_btns:
|
||||
if btn2 != btn:
|
||||
btn2.setChecked(False)
|
||||
self.content_w.setCurrentIndex(idx)
|
||||
btn.clicked.connect(on_btn_click)
|
||||
idx = len(self._tab_btns)
|
||||
self._tab_btns.append(btn)
|
||||
|
||||
Reference in New Issue
Block a user