我的text不知道为啥刷新后字体出现重叠。代码如下
.h代码
class VideoDisplay : public QDialog
{
Q_OBJECT
public:
VideoDisplay(QWidget *parent = 0);
~VideoDisplay();
private Q_SLOTS:
void tim_slot();
private:
Ui::Dialog ui;
//Ui::Esc_Dialog esc_ui;
Esc_Dialog *esc_dialog ;
Menu_Dialog *menu_dialog ;
QTimer *timer1;
QLabel *timeLabel;
};
cpp代码
VideoDisplay::VideoDisplay(QWidget *parent)
: QDialog(parent)
, bufrgb(NULL)
{
QPalette pe;
pe.setColor(QPalette::WindowText,Qt::white);
timeLabel = new QLabel(this);
timeLabel->setObjectName(QString::fromUtf8("timeLabel"));
timeLabel->setGeometry(QRect(10, 20, 140, 17));
timeLabel->setPalette(pe);
timer1=new QTimer(this);//用于时间显示
timer1->start(1000);
connect(timer1, SIGNAL(timeout()), this, SLOT(tim_slot()));
}
VideoDisplay::~VideoDisplay()
{
}
/**
*时间显示
*/
void VideoDisplay::tim_slot()
{
timeLabel->clear();
timeLabel->setText((new QDateTime)->currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
}
请问下为啥每次刷新text都会重叠,背景颜色改为透明为啥还是黑颜色?哪位大神给我指点下,跪谢!