久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='0jQ8Q'><tr id='0jQ8Q'><dt id='0jQ8Q'><q id='0jQ8Q'><span id='0jQ8Q'><b id='0jQ8Q'><form id='0jQ8Q'><ins id='0jQ8Q'></ins><ul id='0jQ8Q'></ul><sub id='0jQ8Q'></sub></form><legend id='0jQ8Q'></legend><bdo id='0jQ8Q'><pre id='0jQ8Q'><center id='0jQ8Q'></center></pre></bdo></b><th id='0jQ8Q'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0jQ8Q'><tfoot id='0jQ8Q'></tfoot><dl id='0jQ8Q'><fieldset id='0jQ8Q'></fieldset></dl></div>
  • <small id='0jQ8Q'></small><noframes id='0jQ8Q'>

    <tfoot id='0jQ8Q'></tfoot>
    • <bdo id='0jQ8Q'></bdo><ul id='0jQ8Q'></ul>

        <legend id='0jQ8Q'><style id='0jQ8Q'><dir id='0jQ8Q'><q id='0jQ8Q'></q></dir></style></legend>

        pyqt5 tabwidget 垂直制表符 水平文本左對齊

        pyqt5 tabwidget vertical tab horizontal text alignment left(pyqt5 tabwidget 垂直制表符 水平文本左對齊)
          <tbody id='joN84'></tbody>

          <small id='joN84'></small><noframes id='joN84'>

                <bdo id='joN84'></bdo><ul id='joN84'></ul>
              • <tfoot id='joN84'></tfoot>
                <legend id='joN84'><style id='joN84'><dir id='joN84'><q id='joN84'></q></dir></style></legend>

                <i id='joN84'><tr id='joN84'><dt id='joN84'><q id='joN84'><span id='joN84'><b id='joN84'><form id='joN84'><ins id='joN84'></ins><ul id='joN84'></ul><sub id='joN84'></sub></form><legend id='joN84'></legend><bdo id='joN84'><pre id='joN84'><center id='joN84'></center></pre></bdo></b><th id='joN84'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='joN84'><tfoot id='joN84'></tfoot><dl id='joN84'><fieldset id='joN84'></fieldset></dl></div>

                1. 本文介紹了pyqt5 tabwidget 垂直制表符 水平文本左對齊的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  由于 pyqt 在垂直選項卡選項中沒有水平文本,我遵循了這個

                  Since pyqt doesn't have horizontal text in vertical tab option, I followed this link to make it happen. I wanted to have icons on the left and then text after icon and different color for selected tab text, inactive tabs text. Below code gets it done almost. The only problem is text alignment is center. I tried changing tabRect.center() but changing it with left and top or right etc is making it crash.

                  The commented code which I got from this linkgets me left alignment but it didn't have icons which I added. But in that I am unable to change text color of inactive tabs.

                  I am new to python and I am unable to find a solution for this. I tried this as well link but this only sets background color. tried using this option as well setTabTextColor link but it didn't work for some reason. been trying from 2 days.

                  Whenever I try to set text color using stylesheet with commented code, the "color" option won't work in stylesheet. any ideas on how to get this done? thanks

                  from PyQt5 import QtCore, QtGui, QtWidgets
                  
                  class TabBar(QtWidgets.QTabBar):
                      def tabSizeHint(self, index):
                          s = QtWidgets.QTabBar.tabSizeHint(self, index)
                          s.transpose()
                          return s
                  
                      def paintEvent(self, event):
                          painter = QtWidgets.QStylePainter(self)
                          opt = QtWidgets.QStyleOptionTab()
                  
                          for i in range(self.count()):
                              self.initStyleOption(opt, i)
                              painter.drawControl(QtWidgets.QStyle.CE_TabBarTabShape, opt)
                              painter.save()
                  
                              s = opt.rect.size()
                              s.transpose()
                              r = QtCore.QRect(QtCore.QPoint(), s)
                              r.moveCenter(opt.rect.center())
                              opt.rect = r
                  
                              c = self.tabRect(i).center()
                              painter.translate(c)
                              painter.rotate(90)
                              painter.translate(-c)
                              painter.drawControl(QtWidgets.QStyle.CE_TabBarTabLabel, opt)
                              painter.restore()
                  
                          # for i in range(self.count()):
                          #     self.initStyleOption(opt, i)
                          #     c = self.tabRect(i)
                          #     c.moveLeft(35)
                          #     painter.drawControl(QtWidgets.QStyle.CE_TabBarTabShape, opt)
                          #     # painter.setPen(QColor(255, 255, 255))
                          #     painter.drawText(c, QtCore.Qt.AlignVCenter | QtCore.Qt.TextDontClip, self.tabText(i))
                          #     if i == 0:
                          #         painter.drawImage(QtCore.QRectF(8, 8, 20, 20), QtGui.QImage("images/logo.png"))
                          #     if i == 1:
                          #         painter.drawImage(QtCore.QRectF(8, 44, 20, 20), QtGui.QImage("images/data.png"))
                          #     if i == 2:
                          #         painter.drawImage(QtCore.QRectF(8, 82, 20, 20), QtGui.QImage("images/browse.png"))
                          #     if i == 3:
                          #         painter.drawImage(QtCore.QRectF(8, 120, 20, 20), QtGui.QImage("images/off.png"))
                          #     if i == 4:
                          #         painter.drawImage(QtCore.QRectF(8, 158, 20, 20), QtGui.QImage("images/cal.png"))
                          #     if i == 5:
                          #         painter.drawImage(QtCore.QRectF(8, 196, 20, 20), QtGui.QImage("images/fol.png"))
                          #     if i == 6:
                          #         painter.drawImage(QtCore.QRectF(8, 232, 20, 20), QtGui.QImage("images/exc.png"))
                          # painter.end()
                  
                  
                  class TabWidget(QtWidgets.QTabWidget):
                      def __init__(self, *args, **kwargs):
                          QtWidgets.QTabWidget.__init__(self, *args, **kwargs)
                          self.setTabBar(TabBar(self))
                          self.setTabPosition(QtWidgets.QTabWidget.West)
                  

                  解決方案

                  The solution is to use a QProxyStyle to redirect text painting:

                  from PyQt5 import QtCore, QtGui, QtWidgets
                  
                  
                  class TabBar(QtWidgets.QTabBar):
                      def tabSizeHint(self, index):
                          s = QtWidgets.QTabBar.tabSizeHint(self, index)
                          s.transpose()
                          return s
                  
                      def paintEvent(self, event):
                          painter = QtWidgets.QStylePainter(self)
                          opt = QtWidgets.QStyleOptionTab()
                  
                          for i in range(self.count()):
                              self.initStyleOption(opt, i)
                              painter.drawControl(QtWidgets.QStyle.CE_TabBarTabShape, opt)
                              painter.save()
                  
                              s = opt.rect.size()
                              s.transpose()
                              r = QtCore.QRect(QtCore.QPoint(), s)
                              r.moveCenter(opt.rect.center())
                              opt.rect = r
                  
                              c = self.tabRect(i).center()
                              painter.translate(c)
                              painter.rotate(90)
                              painter.translate(-c)
                              painter.drawControl(QtWidgets.QStyle.CE_TabBarTabLabel, opt);
                              painter.restore()
                  
                  
                  class TabWidget(QtWidgets.QTabWidget):
                      def __init__(self, *args, **kwargs):
                          QtWidgets.QTabWidget.__init__(self, *args, **kwargs)
                          self.setTabBar(TabBar(self))
                          self.setTabPosition(QtWidgets.QTabWidget.West)
                  
                  class ProxyStyle(QtWidgets.QProxyStyle):
                      def drawControl(self, element, opt, painter, widget):
                          if element == QtWidgets.QStyle.CE_TabBarTabLabel:
                              ic = self.pixelMetric(QtWidgets.QStyle.PM_TabBarIconSize)
                              r = QtCore.QRect(opt.rect)
                              w =  0 if opt.icon.isNull() else opt.rect.width() + self.pixelMetric(QtWidgets.QStyle.PM_TabBarIconSize)
                              r.setHeight(opt.fontMetrics.width(opt.text) + w)
                              r.moveBottom(opt.rect.bottom())
                              opt.rect = r
                          QtWidgets.QProxyStyle.drawControl(self, element, opt, painter, widget)
                  
                  if __name__ == '__main__':
                      import sys
                  
                      app = QtWidgets.QApplication(sys.argv)
                      QtWidgets.QApplication.setStyle(ProxyStyle())
                      w = TabWidget()
                      w.addTab(QtWidgets.QWidget(), QtGui.QIcon("zoom.png"), "ABC")
                      w.addTab(QtWidgets.QWidget(), QtGui.QIcon("zoom-in.png"), "ABCDEFGH")
                      w.addTab(QtWidgets.QWidget(), QtGui.QIcon("zoom-out.png"), "XYZ")
                  
                      w.resize(640, 480)
                      w.show()
                  
                      sys.exit(app.exec_())
                  

                  這篇關于pyqt5 tabwidget 垂直制表符 水平文本左對齊的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)

                      <tbody id='ibm1c'></tbody>
                    <i id='ibm1c'><tr id='ibm1c'><dt id='ibm1c'><q id='ibm1c'><span id='ibm1c'><b id='ibm1c'><form id='ibm1c'><ins id='ibm1c'></ins><ul id='ibm1c'></ul><sub id='ibm1c'></sub></form><legend id='ibm1c'></legend><bdo id='ibm1c'><pre id='ibm1c'><center id='ibm1c'></center></pre></bdo></b><th id='ibm1c'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ibm1c'><tfoot id='ibm1c'></tfoot><dl id='ibm1c'><fieldset id='ibm1c'></fieldset></dl></div>
                    <legend id='ibm1c'><style id='ibm1c'><dir id='ibm1c'><q id='ibm1c'></q></dir></style></legend>
                        <bdo id='ibm1c'></bdo><ul id='ibm1c'></ul>

                        1. <small id='ibm1c'></small><noframes id='ibm1c'>

                          • <tfoot id='ibm1c'></tfoot>
                            主站蜘蛛池模板: 免费a网| 久久99久久 | 亚洲 中文 欧美 日韩 在线观看 | a级黄色毛片免费播放视频 国产精品视频在线观看 | 国产成人网 | 国产在线一级片 | 免费的一级视频 | 免费一二区 | 久久久高清 | 国产91在线精品 | 国产精品久久免费观看 | 视频一区二区在线观看 | 91视频久久| 亚洲一区二区三区在线播放 | 久久av一区| 亚洲国产精品精华素 | 三级视频国产 | 久久99国产精一区二区三区 | 日韩有码在线播放 | 91久久精品一区二区三区 | 91网站视频在线观看 | 国产日韩精品一区二区 | 亚洲国产一区二区三区 | 中文字幕第三页 | 午夜av一区二区 | 免费高清av | 91精品国产一区二区 | 在线电影日韩 | 天天操夜夜艹 | 日韩欧美三级 | 全免费a级毛片免费看视频免 | 免费精品一区 | 二区久久 | 一区二区免费 | 毛片99 | av免费在线观看网站 | www.日本国产 | 91视频入口| 日韩视频在线免费观看 | 久草在线高清 | 成人午夜影院 |