
JLabel jlabel = new JLabel("颜色,大小")
public SetColor(){
this.setLayout(null)
jlabel.setBounds(0, 0, 200, 40)
jlabel.setFont(new Font("",1,30))//字体大小
jlabel.setForeground(Color.BLUE)//字体颜色
this.add(jlabel)
this.setSize(200,200)
this.setVisible(true)
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SetColor sc = new SetColor()
}}
解决方案是将父QLabel添加到QGraphicsView。 QLabel具有透明背景颜色,仅显示文本。 应用: label.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)非常重要,这样它就不会干扰QGraphicsView的鼠标事件。欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)