[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    setView
From:       David Palao <david.palao () uv ! es>(by way of David Palao\
Date:       2004-12-29 12:44:36
Message-ID: 200412291344.36997.david.palao () uv ! es
[Download RAW message or body]

Hello
I'm starting to learn kde and I'm following "KDE 2.0 Development". However
 I'm using KDE 3.1.3.
At the very beginning I found an example which doesn't compile: "ksimpleapp".
I know that this program uses deprecated functions; I tried to translate to
the new counterparts, but I couldn't find the analogue of "setView"; the code
is:

................................. 
#include <qlabel.h>

#include <kstdaccel.h>
#include <kiconloader.h>
#include <kmenubar.h>
#include <kapp.h>
#include <kaction.h>
#include <kstatusbar.h>

#include "ksimpleapp.moc"

unsigned int abre = 65537;
QWidget *pepe;


KSimpleApp::KSimpleApp( const char* name ) :
  KMainWindow( pepe, name , abre )
{
  KAction* reposition = new KAction( "&Reposition Text", QIconSet( BarIcon(
"idea" )),
				     CTRL+Key_R, this, SLOT( slotRepositionText() ), this );
  KAction* quit = new KAction( "&Quit", KStdAccel::quit(), kapp, SLOT(
closeAllWindows() ), this );

  QPopupMenu* filemenu = new QPopupMenu;
  reposition->plug( filemenu );
  filemenu->insertSeparator();
  quit->plug( filemenu );

  menuBar()->insertItem( "&File", filemenu );

  reposition->plug( toolBar() );

  statusBar()->message( "Ready!" );

  text = new QLabel( "Hello!", this );
  text->setBackgroundColor( Qt::white );
  alignment[ 0 ] = QLabel::AlignLeft | QLabel::AlignVCenter;
  alignment[ 1 ] = QLabel::AlignHCenter | QLabel::AlignVCenter;
  alignment[ 2 ] = QLabel::AlignRight | QLabel::AlignVCenter;
  indexalignment = 0;

  text->setAlignment( alignment[ indexalignment ]);
  setView( text );

}

void KSimpleApp::slotRepositionText()
{
  indexalignment = (indexalignment+1)%3;
  text->setAlignment( alignment[ indexalignment] );

  statusBar()->message( "Repositioned text in content area", 1000 );
}
.............................


and the error I get:

ksimpleapp.cpp:50: `setView' declared (first use of this function)


How can I "translate"  the setView function into anything 3.1.3 compliant?

BTW, I guess it could be a headache to continue using this book (it is very
old), so, can anybody advise me another free document? (or am I wrong?)

Thanks in advance,
Regards

David

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic