ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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!??
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. ).
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.
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..
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.