• 6912阅读
  • 9回复

[提问]有关linux中Qt designer的使用问题 [复制链接]

上一主题 下一主题
离线caffee_1989
 
只看楼主 倒序阅读 楼主  发表于: 2011-04-10
我用的是GT2440的板,现在刚使用QT,问题就出现了:我的Qt环境是按照使用手册建立的,它提供了arm-qtopia_2.2.0.tar.gz这样一个包,详细步骤就不说了。板提供了hello的例子,它里面有个脚本build,直接执行./build就能生成执行文件,build内容如下:

#!/bin/bash

source /opt/GTStudio/GT2440/arm-qtopia/qtopia-2.2.0/setQpeEnv
qmake -spec /opt/GTStudio/GT2440/arm-qtopia/qtopia-2.2.0/qtopia/mkspecs/qws/linux-arm-g++ -o Makefile *.pro

make clean
make
一开始执行./build 还可以生成可执行文件,但如果我打开qt designer编辑过.ui文件后。譬如移动一下按键pushbutton,再保存,执行./build就出现很多错误。有没有人知道这是什么原因呢?其中我发现 .ui  .moc等文件夹没生成hello_base.cpp文件并且hello_base.h里面编程空的。有没有人遇到这种情况?
错误信息:
In file included from hello.cpp:1:
hello.h:6: error: expected class-name before '{' token
hello.h:8: error: expected `)' before '*' token
hello.cpp:4: error: 'WFlags' has not been declared
hello.cpp:4: error: prototype for 'HelloForm::HelloForm(QWidget*, const char*, int)' does not match any in class 'HelloForm'
hello.h:6: error: candidates are: HelloForm::HelloForm(const HelloForm&)
hello.h:6: error:                 HelloForm::HelloForm()
hello.cpp: In member function 'virtual void HelloForm::SayHello()':
hello.cpp:14: error: 'MessageLabel' was not declared in this scope
make: *** [.obj/release-shared/hello.o] Error 1
离线caffee_1989
只看该作者 1楼 发表于: 2011-04-10
本人刚学Qt,希望大家指点一下
离线wxj120bw

只看该作者 2楼 发表于: 2011-04-10
qt designer编辑过的.ui文件保存在那里?
离线caffee_1989
只看该作者 3楼 发表于: 2011-04-11
回 2楼(wxj120bw) 的帖子
保存在原文件夹吧,好像会产生一个 hello_base.ui~  的文件
离线wxj120bw

只看该作者 4楼 发表于: 2011-04-11
Re:回 2楼(wxj120bw) 的帖子
引用第3楼caffee_1989于2011-04-11 18:40发表的 回 2楼(wxj120bw) 的帖子 :
保存在原文件夹吧,好像会产生一个 hello_base.ui~  的文件

怎么文件后还带着~ 这个好像是临时文件 你把hello_base.ui~改称hello_base.ui再贴hello_base.ui~部分代码
离线caffee_1989
只看该作者 5楼 发表于: 2011-04-12
回 4楼(wxj120bw) 的帖子
我把hello_base.ui~改称hello_base.ui,再执行./build   发现可以产生可执行文件,但后来一打开.ui文件发现布局没改动,和原本的一模一样。hello_base.ui~的代码:
<!DOCTYPE UI><UI>
<class>HelloBaseForm</class>
<widget>
    <class>QWidget</class>
    <property stdset="1">
        <name>name</name>
        <cstring>HelloBaseForm</cstring>
    </property>
    <property stdset="1">
        <name>geometry</name>
        <rect>
            <x>0</x>
            <y>0</y>
            <width>354</width>
            <height>223</height>
        </rect>
    </property>
    <property stdset="1">
        <name>caption</name>
        <string>Test my first Qtopia Application</string>
    </property>
    <widget>
        <class>QLabel</class>
        <property stdset="1">
            <name>name</name>
            <cstring>MessageLabel</cstring>
        </property>
        <property stdset="1">
            <name>geometry</name>
            <rect>
                <x>80</x>
                <y>170</y>
                <width>180</width>
                <height>20</height>
            </rect>
        </property>
        <property stdset="1">
            <name>text</name>
            <string></string>
        </property>
    </widget>
    <widget>
        <class>QPushButton</class>
        <property stdset="1">
            <name>name</name>
            <cstring>PushButton1</cstring>
        </property>
        <property stdset="1">
            <name>geometry</name>
            <rect>
                <x>110</x>
                <y>90</y>
                <width>108</width>
                <height>32</height>
            </rect>
        </property>
        <property stdset="1">
            <name>text</name>
            <string>Hello</string>
        </property>
    </widget>
</widget>
<connections>
    <connection>
        <sender>PushButton1</sender>
        <signal>clicked()</signal>
        <receiver>HelloBaseForm</receiver>
        <slot>SayHello()</slot>
    </connection>
    <slot access="protected">SayHello()</slot>
</connections>
</UI>

离线wxj120bw

只看该作者 6楼 发表于: 2011-04-13
qt designer编译过ui后 保存了没有
离线caffee_1989
只看该作者 7楼 发表于: 2011-04-13
保存过了,我写pc上界面的一个例子都没这个问题,会不会跟build有关呢?
离线wxj120bw

只看该作者 8楼 发表于: 2011-04-13
再确定build问题之前 要确定ui文件是不是完整 如果ui完整 那再推build的问题
离线lfk0120
只看该作者 9楼 发表于: 2011-11-14
呜呜,我用qt  的designer为什么建立不了pro工程文件呀???一点击ok就立刻返回到shell,还显示段错误,求解
快速回复
限100 字节
 
上一个 下一个