zoukankan      html  css  js  c++  java
  • QComboBox使用方法,QComboBox详解

    fromComboBox = QComboBox() 添加一个 combobox

    fromComboBox.addItem(rates) 添加一个下拉选项

    fromComboBox.addItems(["%d years" % x for x in range(2, 26)]) 从序列中添加

    fromComboBox.setMaxVisibleItems(10) #设置最大显示下列项 超过要使用滚动条拖拉

    fromComboBox.setMaxCount(5) #设置最大下拉项 超过将不显示

    fromComboBox.setInsertPolicy(QComboBox.InsertAfterCurrent) #设置插入方式

    插入方式有:NoInsert,InsertAtTop,InsertAtCurrent,InsertAtBottom,InsertAfterCurrent

    InsertBeforeCurrent,InsertAlphabetically

    字面意思都好理解 最后一个是按字母表顺序插入

    QComboBox 发出一个currentIndexChanged(int) 的信号.

    QComboBox 得到当前项 currentIndex() + 1 #QComboBox 默认的currentIndex为 -1

    QComboBox.findText('dsfds') #返回 内容为dsfds的索引

    QComboBox 得到当前项文本内容     currentText()

    fromSpinBox = QDoubleSpinBox()
    fromSpinBox.setRange(0.01, 10000000.00)

    fromSpinBox.setSuffix(" %d") #设置后缀 如显示 10.0%d

    fromSpinBox.setPrefix('#d') #设置前缀
    fromSpinBox.setValue(1.00) 设置值

    QDoubleSpinBox 发出 valueChanged(double) 信号 有setValue(double)插槽

     要使combobox不发送信息,阻塞信号通道就可以了。
    comboBox->blockSignals(true);
    再次打开信号通道
    comboBox->blockSignals(false);

    原文: https://blog.csdn.net/ymc0329/article/details/7284498

  • 相关阅读:
    *Reverse Linked List II
    *Insertion Sort List
    Convert Sorted List to Binary Search Tree
    Reverse Integer
    read cache return null
    纳秒和随机数
    libthread_db
    gdb
    tls session resumption
    http://www.linux-commands-examples.com/xmllint
  • 原文地址:https://www.cnblogs.com/nanqiang/p/10650357.html
Copyright © 2011-2022 走看看