devwiki:python_qt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
devwiki:python_qt [2024/01/04 08:24] – [Layout and Container] yingdevwiki:python_qt [2024/01/10 03:08] (current) – [Layout and Container] ying
Line 1183: Line 1183:
     * customize look <code python>     * customize look <code python>
 my_tab.setStyleSheet("QTabWidget::tab-bar{alignment:center;}QTabBar::tab { min-width: 100px; }") my_tab.setStyleSheet("QTabWidget::tab-bar{alignment:center;}QTabBar::tab { min-width: 100px; }")
 +</code>
 +  * QScrollArea
 +    * put widget into a scroll area <code python>
 +# main_layout is top most layout
 +main_scroll = QtWidgets.QScrollArea()
 +main_scroll.setWidgetResizable(1)
 +
 +content_widget = QtWidgets.QWidget()
 +content_layout = QtWidgets.QVBoxLayout(content_widget)
 +
 +main_scroll.setWidget(content_widget)
 +
 +test_label = QtWidgets.QLabel('Example Text')
 +test_label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
 +content_layout.addWidget(tmpLabel)
 +
 +main_layout.addWidget(main_scroll)
 +# optional
 +main_layout.setStyleSheet("QScrollArea{min-width:500 px; min-height: 400px}")
 </code> </code>
 ===== QWidget Property ===== ===== QWidget Property =====
Line 1210: Line 1229:
 self.uiList['user_input'].setDisabled(1) # grey out look, can use style to tune better self.uiList['user_input'].setDisabled(1) # grey out look, can use style to tune better
 self.uiList['user_input'].setReadOnly(1) # normal look, but not editable self.uiList['user_input'].setReadOnly(1) # normal look, but not editable
 +</code>
 +  * QLineEdit password hide <code python>
 +self.uiList['user_input'].setEchoMode(QtWidgets.QLineEdit.Password)
 </code> </code>
   * QTextEdit make it accept plain text only <code python>   * QTextEdit make it accept plain text only <code python>
  • devwiki/python_qt.txt
  • Last modified: 2024/01/10 03:08
  • by ying