• 10917阅读
  • 9回复

【提问】程序有问题,大家帮我看看! [复制链接]

上一主题 下一主题
离线gongyh
 

只看楼主 倒序阅读 楼主  发表于: 2005-09-13
我的程序是这样的,我用designer设计了界面文件是note.h
#ifndef NOTE_H
#define NOTE_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QPushButton>
#include <QtGui/QTextEdit>
#include <QtGui/QWidget>

class Ui_Form
{
public:
  QPushButton *pushButton;
  QPushButton *pushButton_2;
  QTextEdit *textEdit;

  void setupUi(QWidget *Form)
  {
  Form->setObjectName(QString::fromUtf8("Form"));
  Form->setEnabled(true);
  Form->resize(QSize(220, 277).expandedTo(Form->minimumSizeHint()));
  pushButton = new QPushButton(Form);
  pushButton->setObjectName(QString::fromUtf8("pushButton"));
  pushButton->setGeometry(QRect(10, 250, 75, 23));
  pushButton_2 = new QPushButton(Form);
  pushButton_2->setObjectName(QString::fromUtf8("pushButton_2"));
  pushButton_2->setGeometry(QRect(136, 250, 75, 23));
  textEdit = new QTextEdit(Form);
  textEdit->setObjectName(QString::fromUtf8("textEdit"));
  textEdit->setGeometry(QRect(10, 10, 201, 221));
  retranslateUi(Form);
  QObject::connect(pushButton_2, SIGNAL(clicked()), textEdit, SLOT(clear()));
  QObject::connect(pushButton_2, SIGNAL(clicked()), textEdit, SLOT(setFocus()));

  QMetaObject::connectSlotsByName(Form);
  } // setupUi

  void retranslateUi(QWidget *Form)
  {
  pushButton->setText(QApplication::translate("Form", "Ok"));
  pushButton_2->setText(QApplication::translate("Form", "Cance"));
  Q_UNUSED(Form);
  } // retranslateUi

};

namespace Ui {
  class Form: public Ui_Form {};
} // namespace Ui

#endif // NOTE_H


/////////////////////////////////
//       note_ok.h         //
/////////////////////////////////
#include "note.h"

using namespace Ui;

class note_ok: public Form
  {
    Q_OBJECT
  public:
    note_ok(WQidget *parent = 0);
  public slots:
    void save();
  };

/////////////////////////////////////////////
// note_ok.cpp                     //
////////////////////////////////////////////
#include <QFile>
#include "note_ok.h"

note_ok::note_ok(WQidget *parent):Form(parent)
  {
    QObject::connect(button,SIGNAL(clicked()),textEdit,SOLT(save()));

    }
note_ok::save()
  {

    }
//////////////////////////////
//   main.cpp           //
/////////////////////////////        
#include <QApplication>

#include "note_ok.h"

int main(int argc, char **argv)
{
  QApplication app(argc,argv);
 
  QWidget qwid;
  note_ok note_object;
  note_object.setupUi(&qwid);
  return app.exec();

}
文字文字
[ 此贴被gongyh在2005-09-13 12:56重新编辑 ]
打工不是一辈子的事!
离线XChinux

只看该作者 1楼 发表于: 2005-09-13
楼主啊,问题在哪里啊
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线gongyh

只看该作者 2楼 发表于: 2005-09-13
C:\Qt\4.0.0\notebook1>make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Qt/4.0.0/notebook1'
g++ -c -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_D
LL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
-I"C:/Qt/4.0.0/include/QtGui" -I"C:/Qt/4.0.0/include/QtCore" -I"C:/Qt/4.0.0/inc
lude" -I"." -I"C:/Qt/4.0.0/include/ActiveQt" -I"tmp\moc\release_shared" -I"." -I
"C:\Qt\4.0.0\mkspecs\win32-g++" -o tmp\obj\release_shared\main.o main.cpp
In file included from main.cpp:3:
note_ok.h:9: error: expected `)' before '*' token
main.cpp: In function `int qMain(int, char**)':
main.cpp:9: error: 'class note_ok' has no member named 'show'
mingw32-make[1]: *** [tmp\obj\release_shared\main.o] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/4.0.0/notebook1'
mingw32-make: *** [release] Error 2
[ 此贴被gongyh在2005-09-13 11:37重新编辑 ]
打工不是一辈子的事!
离线XChinux

只看该作者 3楼 发表于: 2005-09-13
你的类定义后面没跟语句分隔符";"
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线XChinux

只看该作者 4楼 发表于: 2005-09-13
不应该单继承Form,它只是界面,并没有实际的东西。
应该以QMainForm或QDialog或QWidget来继承
采用多重继承
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线gongyh

只看该作者 5楼 发表于: 2005-09-13
我觉得那不是问题的所在,现在只有一个错误,大家帮帮看看,
C:\Qt\4.0.0\notebook1>make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Qt/4.0.0/notebook1'
g++ -c -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_D
LL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
-I"C:/Qt/4.0.0/include/QtGui" -I"C:/Qt/4.0.0/include/QtCore" -I"C:/Qt/4.0.0/inc
lude" -I"." -I"C:/Qt/4.0.0/include/ActiveQt" -I"tmp\moc\release_shared" -I"." -I
"C:\Qt\4.0.0\mkspecs\win32-g++" -o tmp\obj\release_shared\main.o main.cpp
In file included from main.cpp:3:
note_ok.h:9: error: expected `)' before '*' token
mingw32-make[1]: *** [tmp\obj\release_shared\main.o] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/4.0.0/notebook1'
mingw32-make: *** [release] Error 2
打工不是一辈子的事!
离线XChinux

只看该作者 6楼 发表于: 2005-09-13
save函数实现部分没有返回值
这些都是语法错误。。晕。
都是C++的问题。不是QT的问题
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线gongyh

只看该作者 7楼 发表于: 2005-09-13
还有一点问题
[ 此贴被gongyh在2005-09-13 13:44重新编辑 ]
打工不是一辈子的事!
离线gongyh

只看该作者 8楼 发表于: 2005-09-13
那不是关键问题,除去那个还是有问题!
打工不是一辈子的事!
离线zwcxxl

只看该作者 9楼 发表于: 2005-09-14
note_ok(WQidget *parent = 0);
这是写的什么啊WQidget,应该是QWidget。
快速回复
限100 字节
 
上一个 下一个