• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kalgebra

  • sources
  • kde-4.14
  • kdeedu
  • kalgebra
  • src
askname.h
Go to the documentation of this file.
1 /*************************************************************************************
2  * Copyright (C) 2009 by Aleix Pol <aleixpol@kde.org> *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License *
6  * as published by the Free Software Foundation; either version 2 *
7  * of the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the Free Software *
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
17  *************************************************************************************/
18 
19 #ifndef ASKNAME_H
20 #define ASKNAME_H
21 
22 #include <QtGui/QLineEdit>
23 #include <QtGui/QLabel>
24 #include <QtGui/QDialog>
25 #include <QtGui/QDialogButtonBox>
26 #include <QtGui/QVBoxLayout>
27 #include <QtGui/QRegExpValidator>
28 
29 class AskName : public QDialog
30 {
31  public:
32  AskName(const QString& text, QWidget* parent) : QDialog(parent)
33  {
34  edit=new QLineEdit(this);
35  edit->setValidator(new QRegExpValidator(QRegExp("[a-zA-Z][\\w]*"), edit));
36 
37  QDialogButtonBox * buttonBox;
38  QVBoxLayout *items=new QVBoxLayout(this);
39  items->addWidget(new QLabel(text, this));
40  items->addWidget(edit);
41 // items->addItem(new QSpacerItem());
42  items->addWidget(buttonBox=new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok, Qt::Horizontal, this));
43 
44  connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
45  connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
46  }
47 
48  QString name() const { return edit->text(); }
49  private:
50  QLineEdit *edit;
51 };
52 
53 #endif
AskName
Definition: askname.h:29
QWidget
QDialog::reject
virtual void reject()
QRegExpValidator
QLineEdit::text
text
QDialog::rejected
void rejected()
QDialog::accepted
void accepted()
QRegExp
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QVBoxLayout
QString
QDialog::accept
virtual void accept()
QDialogButtonBox
AskName::name
QString name() const
Definition: askname.h:48
AskName::AskName
AskName(const QString &text, QWidget *parent)
Definition: askname.h:32
QDialog
QLineEdit
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QLabel
QObject::parent
QObject * parent() const
QLineEdit::setValidator
void setValidator(const QValidator *v)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:11:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalgebra

Skip menu "kalgebra"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal