C++

Qt

2012年3月17日 #

collect: ld returned 1 exit status 问题

 collect: ld returned 1 exit status
问题:如果有自定义的类,类中定义了构造函数,和析构函数时,请注意析构函数声明了,记得定义,如果不想麻烦,在定义时可以:
1
 #ifndef MYCONFIG_H
 2 #define MYCONFIG_H
 3 
 4 
 5 #include <QtGui/QWidget>
 6 #include <QLabel>
 7 #include <QLineEdit>
 8 
 9 
10 class MyPage1 : public QWidget
11 {
12     Q_OBJECT
13 
14 public:
15     MyPage1(QWidget *parent = 0);
16     ~MyPage1(){};
17     QLabel *NameLabel,*HeightLabel,*NumLabel,*QuotationLabel;
18     QLineEdit *NameEdit,*HeightEdit,*NumEdit,*QuotationEdit;
19 };
20 
21 class MyPage2 : public QWidget
22 {
23     Q_OBJECT
24 
25 public:
26     MyPage2(QWidget *parent = 0);
27     ~MyPage2(){};
28 
29 };
30 class MyPage3 : public QWidget
31 {
32     Q_OBJECT
33 
34 public:
35     MyPage3(QWidget *parent = 0);
36     ~MyPage3(){};
37 
38 };
39 #endif // MYCONFIG_H

posted @ 2012-03-17 16:39 xiaoxinhe1989 阅读(468) | 评论 (0)编辑 收藏

2012年3月11日 #

关于QPixmap

#include "windows.h"
#include <QColor>
#include <QPainter>
#include <QString>
windows::windows(QWidget *parent)
    : QWidget(parent)
{
    resize(800,600);
    pixmap = QPixmap(100,50);
    background = QPixmap("background.bmp");
    x = -1;
    y = -1;
}
windows::~windows()
{
}
void windows::mouseMoveEvent(QMouseEvent *event){
    x = event->x();
    y = event->y();
    pixmap.fill(QColor(255,255,255,127));
    QPainter painter(&pixmap);
    painter.setPen(QColor(255,0,0));
    painter.drawText(20,40,QString("%1").arg(x) + "," + QString("%1").arg(y));
    update();
}
void windows::paintEvent(QPaintEvent *event){
    QPainter painter(this);
    painter.drawPixmap(0,0,background);
    painter.drawPixmap(x,y,pixmap);
}

posted @ 2012-03-11 14:25 xiaoxinhe1989 阅读(1218) | 评论 (0)编辑 收藏

仅列出标题  

My Links

Blog Stats

常用链接

留言簿

随笔档案

新闻档案

搜索

最新评论

阅读排行榜

评论排行榜