首页| 论坛| 消息

标题:【提问】QLabel图标的问题
作者:shengma
日期:2005-09-15 20:08
内容:

#include ".\ebl.h"
#include
#include
#include
#include

Ebl::Ebl(QWidget *parent)
{
bEbl = FALSE;
show();
}
Ebl::~Ebl()
{
}
void Ebl::mousePressEvent(QMouseEvent *e)
{
if(e->button() == Qt::LeftButton){
// QMessageBox::information(this, "mouse key", "this is mouse press");
bEbl = !bEbl;
if(bEbl){
setPixmap(QPixmap(QString::fromUtf8("image\\ebldown.PNG")));
}
else{
setPixmap(QPixmap(QString::fromUtf8("image\\ebldup.PNG")));
}
}
}

#pragma once
#include
class Ebl :
public QLabel
{
Q_OBJECT
public:
Ebl(QWidget *parent = 0);
void mousePressEvent(QMouseEvent *e);
bool bEbl;
~Ebl();
public slots:
signals:

};

#ifndef UI_ECDIS2006_H
#define UI_ECDIS2006_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "ebl.h"
#include "fr.h"
#include "go.h"
#include "ring.h"
#include "vrm.h"
class Ui_ECDIS2006Class
{
public:
QLabel *label;
QPushButton *Exit;
QLabel *ToWP;
QLabel *CursorlatLon;
QLabel *Log;
QLabel *Gyro; ..


#1 [XChinux 09-15 22:33]
是不是你的QLabel的Parent设置的不对?
就是构造的时候parent设置错了。
#2 [shengma 09-16 08:19]
我也这么想,可还是找不出哪里出错了。
#3 [XChinux 09-16 08:27]
Ebl::Ebl(QWidget *parent)
{
bEbl = FALSE;
show();
}
加上个:QLabel(parent)
#4 [shengma 09-16 08:34]
版大,是这问题,构造函数为什么要这样写呢?
#5 [shengma 09-16 08:43]
现在的效果如图。

<< 1 2 >> (1/2)

回复 发表
主题 版块