标题:急,错误出在那里?( 看完我这个简单的程序)
作者:amaorn
日期:2006-11-30 07:28
内容:
//////////////////////////////////
mainwindow.h
//////////////////////////////////
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
class MyMainWindow : public QWidget
{
Q_OBJECT
public:
MyMainWindow();
public slots:
void MyExitSlot();
private:
QPushButton *b1;
QPushButton *b2;
QPushButton *b3;
QLineEdit *ledit;
QPushButton *quit;
QLCDNumber *lcd;
QSlider *slider;
QLabel *label;
};
#endif
//////////////////////////////////////////////////////
mainwindow.cpp
//////////////////////////////////////////////////////
#include "mainwindow.h"
void MyMainWindow::MyExitSlot()
{
exit( 0 );
}
MyMainWindow::MyMainWindow()
{
setGeometry( 0, 0, 800, 800 );
b1 = new QPushButton( "Button 1", this );
b1->setGeometry( 0, 0, 40, 40 );
b1->setFont( QFont( "Times", 18, QFont::Bold ) );
quit = new QPushButton( "quit", this );
quit->setGeometry( 50,50, 40, 40 );
quit->setFont( QFont( "Times", 18, QFont::Bold ) );
connect( quit, SIGNAL( clicked() ), qApp, SLOT( MyExitSolt( ) ) );
lcd = new QLCDNumber( 2, this );
lcd->setGeometry( 100, 100, 100, 100 );
slider = new QSlider( Vertical, this );
slider->setGeometry( 200, 200, 100,100 );
connect( slider, SIGNAL( valueChanged( int ) ), lcd, SLOT( display( int ) ) );
b2 = new QPushButton( "Click here ", this );
b2->setGeometry( 40, 0 ,50, 5 ..
#1 [浪漫天使 11-30 09:17]
connect( quit, SIGNAL( clicked() ), qApp, SLOT( MyExitSolt( ) ) );
qApp 改成this
#2 [amaorn 11-30 11:54]
引用第1楼浪漫天使于2006-11-30 09:17发表的“”:
connect( quit, SIGNAL( clicked() ), qApp, SLOT( MyExitSolt( ) ) );
qApp 改成this
太感谢楼上的兄弟了,。刚刚激动了一会
能解释一下为什么改成this的原因马?
还有你知道上面的那个警告是怎么回事马?
#3 [浪漫天使 11-30 12:34]
MyExitSolt is the slot of MyMainWindow(this)
you have better look this file
/home/amao/qt-x11-free-3.1.2/include/private/qucomextra_p.h
in line 87
#4 [amaorn 11-30 17:27]
我看过了,但是还是没有能力改这个东西?
也不敢乱碰,是不是下载个qt 4用好一点!