Qt [LÖST]
Postat: 27 sep 2007, 18:33
Försöker bygga ett program till greenphone, det var med i linux format, har tillochmed klistrat och klippt från en fil men får fel när jag ska kompilera :
--- Jag är nybörjare :S , löste några fel genom att söka igenom koden men kommer inte längre nu.
här är programet.
--- Jag är nybörjare :S , löste några fel genom att söka igenom koden men kommer inte längre nu.
Kod: Markera allt
example.cpp: In member function 'void Example::conVert()':
example.cpp:59: error: 'Qstring' was not declared in this scope
example.cpp:59: error: expected `;' before 'amount_str'
example.cpp:60: error: 'amount_str' was not declared in this scope
example.cpp:64: error: expected primary-expression before '==' token
example.cpp:64: error: expected `;' before ')' token
Kod: Markera allt
#include <qstring.h>
#include <qlineedit.h>
#include <qlcdnumber.h>
#include <qcombobox.h>
#include "example.h"
#include <qpushbutton.h>
ExampleBase::ExampleBase( QWidget *parent, Qt::WFlags f )
: QWidget( parent, f )
{
setupUi( this );
}
ExampleBase::~ExampleBase()
{
}
/*
* Constructs a Example which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
Example::Example( QWidget *parent, Qt::WFlags f )
: ExampleBase( parent, f )
{
connect(quit, SIGNAL(clicked()), this, SLOT(goodBye()));
connect (pushButton, SIGNAL(clicked()), this, SLOT(conVert()));
}
/*
* Destroys the object and frees any allocated resources
*/
Example::~Example()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* A simple slot... not very interesting.
*/
void Example::goodBye()
{
close();
}
void Example::conVert()
{
Qstring amount_str = lineEdit->text();
float amount = amount_str.toFloat();
switch (comboBox->currentIndex())
{
case 0:
if (comboBox_2->currentIndex()) == 1)
amount = amount * 0.3937;
break;
}
lcdNumber->display(amount);
}