在QT安装qt_x86下 ./buildx86 后,输入ldconfig 出现如下错误
[root@localhost qt_x86]# ldconfig
ldconfig: /armsys2410/qt_arm/qtopia/lib/libuuid.so.1 is not a symbolic link
是啥意思?会带来啥后果啊?
第86句说是有语法错误 QTimer *timer = new QTtimer(this);
第89句 timer->start(40);
第141句 //3:Paint the pixmap. Cool wave effect
QPaitner p;
第145句 p.begin( &pm );
make 后结果:
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/usr/lib/qt-3.1/include -o hello.o hello.cpp
hello.cpp: In method `Hello::Hello(QWidget * = 0, const char * = 0, unsigned int = 0)':
hello.cpp:86: parse error before `('
hello.cpp: In method `void Hello::paintEvent(QPaintEvent *)':
hello.cpp:141: `QPaitner' undeclared (first use this function)
hello.cpp:141: (Each undeclared identifier is reported only once
hello.cpp:141: for each function it appears in.)
hello.cpp:141: parse error before `;'
hello.cpp:145: `p' undeclared (first use this function)
make: *** [hello.o] Error 1
程序完全按照书上写的,查看过qpainter类,也有例子就是QPainter p这么定义的 ..
不知道这里怎么不行了,顺便问下qt下的所有类都放在哪个文件夹下的?
上面两个问题有联系么 ?
hello.cpp程序代码如下:
#include "hello.h"
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qpushbutton.h>
#include <qtimer.h>
#include <qpainter.h>
#include <qpixmap.h>
/*
* Constructs a Hello which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
Hello::Hello( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "Hello" );
resize( 240, 320 );
setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sizePolicy().hasHeightForWidth() ) );
setMinimumSize( QSize( 240, 320 ) );
setMaximumSize( QSize( 240, 320 ) );
setSizeIncrement( QSize( 240, 320 ) );
setBaseSize( QSize( 240, 320 ) );
QPalette pal;
QColorGroup cg;
cg.setColor( QColorGroup::Foreground, black );
cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );
cg.setColor( QColorGroup::Light, white );
cg.setColor( QColorGroup::Midlight, QColor( 223, 223, 223) );
cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );
cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
cg.setColor( QColorGroup::Text, black );
cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
cg.setColor( QColorGroup::Text, black );
cg.setColor( QColorGroup::BrightText, white );
cg.setColor( QColorGroup::ButtonText, black );
cg.setColor( QColorGroup::Base, white );
cg.setColor( QColorGroup::Background, white );
cg.setColor( QColorGroup::Shadow, black );
cg.setColor( QColorGroup::Highlight, black );
cg.setColor( QColorGroup::HighlightedText, white );
pal.setActive( cg );
cg.setColor( QColorGroup::Foreground, black );
cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );
cg.setColor( QColorGroup::Light, white );
cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) );
cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );
cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
cg.setColor( QColorGroup::Text, black );
cg.setColor( QColorGroup::BrightText, white );
cg.setColor( QColorGroup::ButtonText, black );
cg.setColor( QColorGroup::Base, white );
cg.setColor( QColorGroup::Background, white );
cg.setColor( QColorGroup::Shadow, black );
cg.setColor( QColorGroup::Highlight, black );
cg.setColor( QColorGroup::Shadow, black );
cg.setColor( QColorGroup::Highlight, black );
cg.setColor( QColorGroup::HighlightedText, white );
pal.setInactive( cg );
cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) );
cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );
cg.setColor( QColorGroup::Light, white );
cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) );
cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );
cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );
cg.setColor( QColorGroup::Text, black );
cg.setColor( QColorGroup::BrightText, white );
cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) );
cg.setColor( QColorGroup::Base, white );
cg.setColor( QColorGroup::Background, white );
cg.setColor( QColorGroup::Shadow, black );
cg.setColor( QColorGroup::Highlight, black );
cg.setColor( QColorGroup::HighlightedText, white );
pal.setDisabled( cg );
setPalette( pal );
setCaption( tr( "Hello,World" ) );
t="Hello ,World";
b=0;
t="Hello ,World";
b=0;
QTimer *timer = new QTtimer(this);
connect (timer,SIGNAL(timeout()),SLOT(animate()));
timer->start(40);
}
/*
* Destroys the object and frees any allocated resources
*/
Hello::~Hello()
{
// no need to delete child widgets, Qt does it all for us
}
void Hello::animate()
{
b = (b+1) & 15;
repaint( FALSE );
}
/*Handles mouse button release events for the Hello widget.
We emit the clicked() signal when the mouse is released inside
the widget.
*/
void Hello::mouseReleaseEvent( QMouseEvent *e )
{
if ( rect().contains( e->pos() ) )
emit clicked();
}
/* Handles paint events for the Hello widget.
Flicker-free update. The text is first drawn in the pixmap and the
pixmap is then blt'ed to the screen.
*/
void Hello::paintEvent( QPaintEvent * )
{
static int sin_tbl[16] = {
0,38,71,92,100,92,71,38,0,-38,-71,-92,-100,-92,-71,-38};
if ( t.isEmpty() )
return;
//1: Compute some sizes, positions etc.
QFontMetrics fm = fontMetrics();
int w = fm.width(t) + 20;
int h = fm.height() * 2;
int pmx = width()/2 - w/2;
int pmy =height()/2 - h/2;
//2:Create the pixmap and fill it with the widget's background
QPixmap pm( w, h);
pm.fill( this, pmx, pmy );
//3:Paint the pixmap. Cool wave effect
QPaitner p;
int x = 10;
int y = h/2+fm.descent();
int i = 0;
p.begin( &pm );
p.setFont( font() );
while ( !t.isNull() ){
int i16 = (b+i) & 15;
p.setPen( QColor((15-i16)*16,255,255,QColor::Hsv) );
p.drawText( x, y-sin_tbl[i16]*h/800, t.mid(i,1), 1);
x += fm.width( t );
i++;
}
p.end();
//4:Copy the pixmap to the Hello widget
bitBlt( this, pmx, pmy, &pm );
}