1.样式表的一些bug, 2.如何通过键盘事件插入spinbox,3.不改变系统编码的前提下,单独转换某一字体编码,4.多色彩颜色失败

来源:互联网 发布:戴尔电脑怎么样知乎 编辑:程序博客网 时间:2024/05/02 23:21

1QFrame[outer_stylesheet="frame_detail_show"]{..}qtabwidget 里的frame 无法使用

QFrame:frame_detail_show{..}qtabwidget 里的frame 可以的

2.

    QSpinBox *spinbox = qobject_cast<QSpinBox *>(qApp->focusWidget());
    QKeyEvent * eve1 = new QKeyEvent (QEvent::KeyPress,Qt::Key_1,Qt::NoModifier,"1");
    qApp->postEvent((QObject*)spinbox,(QEvent *)eve1);

3.

    QByteArray b;
    QTextCodec *c=QTextCodec::codecForName("gb2312");//gb2312为转换后的编码
    b.append(c->fromUnicode(in));
    return b;

4.多色彩颜色失败

    p.setBrush(Qt::NoBrush);
    p.setPen(QColor("yellow"));
    p.drawText(this->rect(), Qt::AlignRight, "100");
    p.setPen(QColor("black"));
    p.drawText(this->rect(), Qt::AlignRight, "00");
    p.setPen(QColor("red"));
    p.drawText(this->rect(), Qt::AlignRight, "0");

推断是应为字体边缘本身是有半透明的,所有会出现很明显的描边效果


0 0
原创粉丝点击