LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-08-2004, 08:28 PM   #1
FreakboY
Member
 
Registered: Jun 2002
Location: TX, USA
Distribution: Slackware
Posts: 379

Rep: Reputation: 31
Need help w/tutorial


It sounds stupid... but i just can't get it...

all i want is to make a form with a button and a textbox
and when that button is press i will get a message box
that tells me the contents of the textbox.. as simple as that
but i can make it work!!! it is just to hard for me... so i was
wondering if any of you could send me the sources for this!??
i want to use Kdevelop 3.0 and QT just like this tutorial:
http://women.kde.org/articles/tutorials/kdevelop3/
i can't get it to work...

thanks for your time!




btw, if i install a lot of windows fonts on my system will it make it slow!??
just like windows!??

Last edited by FreakboY; 05-08-2004 at 08:32 PM.
 
Old 05-08-2004, 08:42 PM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
Post what you've got coded, any compile time errors or warnings, etc...

Quote:
btw, if i install a lot of windows fonts on my system will it make it slow!??
just like windows!??
No. Just takes space. The list is cached (Once after each new font is intalled, not at boot ), and read when needed. Theres nothing too slow it down. ( Why windows slows down I don't know. ).
 
Old 05-08-2004, 08:48 PM   #3
FreakboY
Member
 
Registered: Jun 2002
Location: TX, USA
Distribution: Slackware
Posts: 379

Original Poster
Rep: Reputation: 31
i don't have any code or anything... i want to learn from an example!!
 
Old 05-08-2004, 08:54 PM   #4
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
AH I see, well I know KDE better than pure Qt, would that be OKay?
 
Old 05-08-2004, 09:09 PM   #5
FreakboY
Member
 
Registered: Jun 2002
Location: TX, USA
Distribution: Slackware
Posts: 379

Original Poster
Rep: Reputation: 31
ya!! I just want QT for UI and thats all i want to do my coding using Kdev....
 
Old 05-08-2004, 09:09 PM   #6
FreakboY
Member
 
Registered: Jun 2002
Location: TX, USA
Distribution: Slackware
Posts: 379

Original Poster
Rep: Reputation: 31
you can email me to ferdna at hotmail dot com
 
Old 05-08-2004, 09:23 PM   #7
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
Well with KDE start a project with type C++ -> KDE -> Simple KDE Application. I called my app example. So theres only two files you need to edit.

example.h
Code:
#ifndef _EXAMPLE_H_
#define _EXAMPLE_H_

#include <kmainwindow.h>

class KLineEdit;

/// The main window class
class example : public KMainWindow
{
    Q_OBJECT
public:
    /// Default Constructor
    example();

    /// Default Destructor
    virtual ~example();
protected slots:
   /// Slot for activation of the button
   void slotButtonPressed();
private:
   /// The Line edit widget
   KLineEdit *m_pTexBox;
};

#endif // _EXAMPLE_H_
example.cpp
Code:
#include "example.h"

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

#include <kmainwindow.h>
#include <klocale.h>
#include <klineedit.h>
#include <kpushbutton.h>
#include <kdialog.h>
#include <kpassivepopup.h>

example::example()
    : KMainWindow( 0, "example" )
{
	/// A VBoxLayout orders things vertically
   QVBoxLayout *vl = new QVBoxLayout( this, 0, KDialog::spacingHint() );
       /// A HBoxLayout orders things horizontally
   QHBoxLayout *hl = new QHBoxLayout( vl );
   hl->addWidget( new QLabel( i18n( "Test Here:" ), this ) );
   m_pTexBox = new KLineEdit( this );
   hl->addWidget( m_pTexBox );
   KPushButton *button = new KPushButton( i18n( "Press Me" ), this );
   vl->addWidget( button );

   connect( button, SIGNAL( clicked() ), SLOT( slotButtonPressed() ) );
}

example::~example()
{
}

void example::slotButtonPressed()
{
   KPassivePopup::message( i18n( "The Text" ), m_pTexBox->text(), this );
}

#include "example.moc"
Thats it. The popup will probably be at the bottom of the screen somewhere. If you want more options look at subclassing KPassivePopup, or KDialogBase.
 
Old 05-09-2004, 04:30 AM   #8
FreakboY
Member
 
Registered: Jun 2002
Location: TX, USA
Distribution: Slackware
Posts: 379

Original Poster
Rep: Reputation: 31
Thanks leonscape... but is not what i'm looking for....
i want to use QT as my GUI designer... your example
is real good it compiles with out any problems... i want
the same kind of example but using QT designer..
 
Old 05-09-2004, 12:29 PM   #9
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
I've not used the Qt Designer myself. So I can't help you with that. The best thing I can suggest is to follow the tutorial, and follow the examples, and simply change the form to what you want, and alter the code as appropriate.

Sorry.
 
Old 05-09-2004, 11:30 PM   #10
FreakboY
Member
 
Registered: Jun 2002
Location: TX, USA
Distribution: Slackware
Posts: 379

Original Poster
Rep: Reputation: 31
is it a good choice to use QT Designer!??
 
Old 05-10-2004, 05:30 PM   #11
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
Depends I suppose. Most of my stuff doesn't require much flexability in the ui. ( i.e. I haven't got other people tidiying it up, and I'm not inserting it other programs, where styles might be diffrent. )

Using the designer can be helpful for trying out siffrent designs, or you just want something to be going on with that you'll change later. If your going to be adding more things as you go along, the Desginer can help a lot there. Just haven't had call to use it myself yet.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
QT tutorial vinsky2002 Linux - Software 2 03-02-2005 03:15 AM
looking for a tutorial!!! mio_carpe Linux - Networking 2 01-29-2005 02:29 PM
Tutorial Marklar Linux - Networking 11 12-20-2003 07:44 PM
tutorial? Zander Linux - Newbie 2 07-30-2002 03:25 PM
How about a weekly tutorial? or just a tutorial Alinuxnoob LQ Suggestions & Feedback 2 04-09-2002 08:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration