QComboBox - How to set hint text on combo box

后端 未结 3 1744
悲&欢浪女
悲&欢浪女 2020-12-11 20:50

The application GUI I working requires a combo box for user to select item. When the application starts, the combo box will show a hint text something like \"Please select\"

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-11 21:10

    There is an elegant solution if the QComboBox is editable:

    myQComboBox->lineEdit()->setPlaceHolderText("Please select");
    

    QComboBoxes that are not editable do not have QLineEdits in them, so this would not work on those.

提交回复
热议问题