天嵌 ARM开发社区

 找回密码
 注册
查看: 5348|回复: 9

qt画图程序问题

[复制链接]
whesear 发表于 2010-3-25 17:20:26 | 显示全部楼层 |阅读模式
我用qt 写了一个画图程序在x86上可以显示动态图形,但是在arm上就非常卡,就像死机了一样,我的程序如下,/****************************************************************************
** Form implementation generated from reading ui file 'frame.ui'
**
** Created: Thu Mar 25 08:15:53 2010
**      by:  The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#define PI 3.1415926
#include "frame.h"

#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>

/*
*  Constructs a mywidget which is a child of 'parent', with the
*  name 'name' and widget flags set to 'f'
*/
mywidget::mywidget( QWidget* parent,  const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    if ( !name )
        setName( "mywidget" );
    resize( 320,240 );
    setCaption( tr( "frame" ) );


    frame=new QFrame(this);
    frame->setBackgroundColor(black);
    frame->setGeometry(QRect(40,40,200,150));
    close = new QPushButton( this, "close" );
    close->setGeometry( QRect( 180, 160, 70, 32 ) );
    close->setText( tr( "Close" ) );

    connect(close,SIGNAL(clicked()),this,SLOT(close()));
    for(int i=0;i<200;i++)
        {
                buffer[i]=(int)(sin((i*PI)/100)*30);
        }
    QTimer *timer=new QTimer(this);
    connect(timer,SIGNAL(timeout()),this,SLOT(flushBuff()));
    timer->start(30);

}

/*  
*  Destroys the object and frees any allocated resources
*/
mywidget::~mywidget()
{
    // no need to delete child widgets, Qt does it all for us
}
void mywidget::flushBuff()
{       
              int tmp=buffer[0];
              int i;
              for(i=0;i<200;i++)
              {
          buffer[i]=buffer[i+1];
              }
              buffer[199]=tmp;
             repaint(0,0,200,160,TRUE);
}
void mywidget::paintEvent(QPaintEvent *)
{
        QPainter painter(frame);
        QPoint beginPoint;
        QPoint endPoint;
        painter.setPen(Qt::blue);

        for(int i=0;i<200;i++)
        {
            beginPoint.setX(2*i);
            beginPoint.setY(buffer[i]+50);
            endPoint.setX(2*i+1);
            endPoint.setY(buffer[i+1]+50);
            painter.drawLine(beginPoint,endPoint);
        }

}
在x86和arm 上都编译通过了。但是在arm 上运行的时候非常卡,还望高手指点一下,应该怎么解决这个情况。
亚瑟王 发表于 2010-3-26 12:24:53 | 显示全部楼层
你在TQ2440上面是单独运行的还是在qtopia中运行的?
 楼主| whesear 发表于 2010-3-26 17:07:03 | 显示全部楼层
2# 亚瑟王

在qtopia 中运行的。
亚瑟王 发表于 2010-3-26 20:17:12 | 显示全部楼层
你在文件系统中复制/bin/qtopia文件为abc(假设为这个名),修改abc文件,将文件中的qpe改为 xxx  -qws,然后修改/etc/init.d/rcS文件的qtopia &为abc &,然后重启开发板单独运行这个程序试试。
 楼主| whesear 发表于 2010-3-28 11:04:12 | 显示全部楼层
4# 亚瑟王
多谢了,问题解决了,main函数中少了一个语句。呵呵
亚瑟王 发表于 2010-3-29 13:03:31 | 显示全部楼层
少了什么语句,能告诉吗?
qddxzhangke 发表于 2010-4-6 17:22:40 | 显示全部楼层
5# whesear
Miko_zhang 发表于 2011-3-20 23:48:07 | 显示全部楼层
我也是用Qt制作了一个绘图软件,编译成arm版的通过了,但是在烧至arm版上时,却无法运行,这是什么原因?
天嵌_support1 发表于 2011-3-21 11:33:13 | 显示全部楼层
串口提示信息是什么呢?
Miko_zhang 发表于 2011-4-5 18:19:55 | 显示全部楼层
串口上并未提示任何信息!!能看到制作的绘图软件的界面,但是里面的功能却无法实现。例如,在更改画笔的粗细时,画笔的粗细并不改变。选择改变画笔颜色时,画笔的粗细却改变了~~~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-9-28 03:27 , Processed in 1.031289 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表