Ini Mas Ariya KDE yach?

Hehehhe...

Mas saya udah coba nich. tapi belum bisa juga. sampe
akhirnya saya ulang lagi dari awal. saya bikin new
project dan pake directory baru untuk project coba-2x
ini.

Lewat QtDesigner saya saya bikin new project.
trus klik new-> C++ Source File
trus saya salin codenya sbb:
===
#include <qapplication.h> 
#include "qmainwindow.h" 
#include "qpainter.h" 
#include "qpixmap.h" 
 
class PainterExample : public QMainWindow 
{ 
public: 
    PainterExample(); 
    virtual void paintEvent( QPaintEvent * ); 
} 
 
PainterExample::PainterExample(): QMainWindow(0,
"contoh ngegambar pake QPainter") 
{ 
   
} 
 
void PainterExample::paintEvent( QPaintEvent * ) 
{ 
    QPainter p(this); 
    p.drawPixmap(0,0,
QPixmap("images/iamlagiajan.png"), 0, 0, 100, 100); 
} 
 
int main( int argc, char ** argv ) 
{ 
    QApplication a( argc, argv ); 
    QMainWindow * v = new PainterExample(); 
    v->show(); 
    a.connect( &a, SIGNAL( lastWindowClosed() ), &a,
SLOT( quit() ) ); 
    return a.exec(); 
} 
===
trus saya simpen dengan nama file painter.cpp .
trus saya compile sbb :
[EMAIL PROTECTED]:~/arsip/proyek/qt/pix> qmake
-project
[EMAIL PROTECTED]:~/arsip/proyek/qt/pix> qmake
[EMAIL PROTECTED]:~/arsip/proyek/qt/pix> make
g++ -c -pipe -O2 -march=i586 -mcpu=i686
-fmessage-length=0 -Wall -fPIC -Wall -W -O2
-march=i586 -mcpu=i686 -fmessage-length=0 -Wall -fPIC 
-DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT
-I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/include
-I/usr/lib/qt3/include -o painter.o painter.cpp
painter.cpp:13: error: ISO C++ forbids defining types
within return type
painter.cpp:13: error: return type specification for
constructor invalid
make: *** [painter.o] Error 1
[EMAIL PROTECTED]:~/arsip/proyek/qt/pix> ls
Makefile  images  painter.cpp  pix.pro
[EMAIL PROTECTED]:~/arsip/proyek/qt/pix>

Gitu Mas Ariya, kok error sich?

Mohon penerangannya, Mas...
--- Ariya Hidayat <[EMAIL PROTECTED]> wrote:

> > Biasanya saya menampilkan gambar dengan QLabel.
> > Caranya gampang sekali sich. Tapi kali ini saya
> musti
> > menampilkannya dengan QPainter. Pusing nich, susah
> > banget rasanya, mentok mulu. Akhirnya sebelum saya
> > melanjutkan untuk bikin program saya, saya beralih
> > dulu untuk latihan dengan program yang sangat
> > sederhana yaitu menampilkan gambar didalam Dialog
> Form
> > ketika dialog form tersebut di-"show()", code
> untuk
> > menampilkan gambarnya saya taruh di Slot "init()"
> > (constructor). gambar itu berasal dari file gambar
> > yang saya taruh didalam subdirectory "images".
> 
> Anda harus meletakkan rutin untuk menampilkan gambar
> dengan QPainter
> ini di dalam fungsi paintEvent (virtual dari kelas
> QWidget, coba baca
> lagi dokumentasi Qt tentang QWidget dan QPainter).
> Berikut adalah
> contoh sederhananya. Salin saja fragmen source-code
> ini ke dalam file
> painter.cpp lalu compile. Tidak ada file eksternal
> lain yang
> diperlukan.
> 
>
----------------------------------------------------------------
> 
> #include <qmainwindow.h>
> #include <qapplication.h>
> #include <qpainter.h>
> #include <qpixmap.h>
> 
> class PainterExample : public QMainWindow
> {
> public:
>   PainterExample();
>   virtual void paintEvent( QPaintEvent* );
> };
> 
> PainterExample::PainterExample(): QMainWindow( 0,
> "painterexample" )
> {
> }
> 
> void PainterExample::paintEvent( QPaintEvent* )
> {
>   QPainter p( this );
>   p.drawPixmap( 0,0,
> QPixmap("gambar.jpg"),0,0,100,100 );
> }
> 
> int main( int argc, char ** argv )
> {
>   QApplication a( argc, argv );
>   QMainWindow* v = new PainterExample( );
>   v->show();
>   a.connect( &a, SIGNAL(lastWindowClosed()), &a,
> SLOT(quit()) );
>   return a.exec();
> }
> 
> Gampang bukan? Silakan dicoba ! 
> 
> -- 
> Ariya Hidayat
>
http://www.google.com/search?q=ariya+hidayat+kde&btnI
> 
> -- 
> Berhenti langganan:
> [EMAIL PROTECTED]
> Arsip dan info: http://linux.or.id/milis.php
> 
> 



                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

-- 
Berhenti langganan: [EMAIL PROTECTED]
Arsip dan info: http://linux.or.id/milis.php

Kirim email ke