[Uml-devel] KDE/kdesdk/umbrello/umbrello/dialogs
Andi Fischer
andi.fischer at hispeed.ch
Wed Aug 13 18:43:27 UTC 2008
SVN commit 846605 by fischer:
Replacing all q3 widgets.
M +25 -22 umluniqueconstraintdialog.cpp
M +25 -31 umluniqueconstraintdialog.h
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umluniqueconstraintdialog.cpp #846604:846605
@@ -1,5 +1,4 @@
/***************************************************************************
- * *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
@@ -10,15 +9,6 @@
***************************************************************************/
#include "umluniqueconstraintdialog.h"
-#include <QtGui/QLayout>
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QHBoxLayout>
-
-#include <kdebug.h>
-#include <kdialogbuttonbox.h>
-#include <klocale.h>
-#include <kmessagebox.h>
-
#include "attribute.h"
#include "classifierlistitem.h"
#include "classifier.h"
@@ -33,7 +23,20 @@
#include "uniqueconstraint.h"
#include "umldoc.h"
+#include <kcombobox.h>
+#include <kdebug.h>
+#include <kdialogbuttonbox.h>
+#include <klineedit.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <QtGui/QGroupBox>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QLabel>
+#include <QtGui/QListWidget>
+#include <QtGui/QPushButton>
+
UMLUniqueConstraintDialog::UMLUniqueConstraintDialog(QWidget* parent, UMLUniqueConstraint* pUniqueConstraint) : KDialog(parent)
{
setCaption( i18n("Unique Constraint Properties") );
@@ -82,15 +85,15 @@
// group box to hold the column details
// top group box, contains a vertical layout with list box above and buttons below
- m_pAttributeListGB = new Q3GroupBox(i18n( "Attribute Details" ), frame );
+ m_pAttributeListGB = new QGroupBox(i18n( "Attribute Details" ), frame );
mainLayout->addWidget( m_pAttributeListGB );
QVBoxLayout* listVBoxLayout = new QVBoxLayout( m_pAttributeListGB );
listVBoxLayout->setMargin(margin);
listVBoxLayout->setSpacing ( 10 );
- m_pAttributeListLB = new Q3ListBox(m_pAttributeListGB);
- listVBoxLayout->addWidget( m_pAttributeListLB );
+ m_pAttributeListLW = new QListWidget(m_pAttributeListGB);
+ listVBoxLayout->addWidget( m_pAttributeListLW );
// Horizontal Layout to hold attributes CB, the add, and remove buttons
QHBoxLayout* comboButtonHBoxLayout = new QHBoxLayout();
@@ -128,7 +131,7 @@
// add to local cache
m_pConstraintAttributeList.append( att );
// add to list box
- m_pAttributeListLB->insertItem( att->toString( Uml::st_SigNoVis ) );
+ m_pAttributeListLW->addItem( att->toString( Uml::st_SigNoVis ) );
int index = m_pEntityAttributeList.indexOf( att );
m_pEntityAttributeList.removeAt( index );
@@ -139,13 +142,13 @@
m_pNameLE->setText( m_pUniqueConstraint->getName() );
// select firstItem
- if ( m_pAttributeListLB->count()!=0 ) {
- m_pAttributeListLB->setSelected( 0, true );
+ if ( m_pAttributeListLW->count() != 0 ) {
+ m_pAttributeListLW->setCurrentRow( 0 );
}
slotResetWidgetState();
- connect( m_pAttributeListLB, SIGNAL( clicked( Q3ListBoxItem* ) ), this, SLOT( slotResetWidgetState() ) );
+ connect( m_pAttributeListLW, SIGNAL( itemClicked( QListWidgetItem* ) ), this, SLOT( slotResetWidgetState() ) );
}
void UMLUniqueConstraintDialog::slotAddAttribute()
@@ -170,15 +173,15 @@
m_pConstraintAttributeList.append( entAtt );
// add to list box
- int count = m_pAttributeListLB->count();
- m_pAttributeListLB->insertItem( entAtt->toString( Uml::st_SigNoVis ), count );
+ int count = m_pAttributeListLW->count();
+ m_pAttributeListLW->insertItem( count, entAtt->toString( Uml::st_SigNoVis ) );
slotResetWidgetState();
}
void UMLUniqueConstraintDialog::slotDeleteAttribute()
{
- int index = m_pAttributeListLB->currentItem();
+ int index = m_pAttributeListLW->currentRow();
if ( index == -1 ) {
return;
@@ -190,7 +193,7 @@
//remove from constraint
m_pConstraintAttributeList.removeAt( index );
// remove from list box
- m_pAttributeListLB->removeItem( index );
+ m_pAttributeListLW->takeItem( index );
// add to list
m_pEntityAttributeList.append( entAtt );
@@ -244,7 +247,7 @@
m_pRemovePB->setEnabled( true );
// get index of selected Attribute in List Box
- int index = m_pAttributeListLB->currentItem();
+ int index = m_pAttributeListLW->currentRow();
// if index is not invalid ( -1 ), then activate the Remove Button
if ( index == -1 ) {
m_pRemovePB->setEnabled( false );
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umluniqueconstraintdialog.h #846604:846605
@@ -1,5 +1,4 @@
/***************************************************************************
- * *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
@@ -12,26 +11,24 @@
#ifndef UMLUNIQUECONSTRAINTDIALOG_H
#define UMLUNIQUECONSTRAINTDIALOG_H
-//qt includes
-#include <QtGui/QWidget>
-#include <QtGui/QLabel>
-#include <q3groupbox.h>
-#include <q3listbox.h>
-#include <q3textedit.h>
-#include <QtGui/QPushButton>
+//app includes
+#include "umlclassifierlistitemlist.h"
+#include "umlentityattributelist.h"
//kde includes
-#include <karrowbutton.h>
-#include <kcombobox.h>
#include <kdialog.h>
-#include <klineedit.h>
-//app includes
-#include "umlclassifierlistitemlist.h"
-#include "umlentityattributelist.h"
+//qt includes
+#include <QtGui/QWidget>
class UMLDoc;
class UMLUniqueConstraint;
+class KComboBox;
+class KLineEdit;
+class QGroupBox;
+class QLabel;
+class QListWidget;
+class QPushButton;
/**
* A dialog page to display unique constraint properties.
@@ -45,45 +42,43 @@
Q_OBJECT
public:
/**
- * Sets up the UMLUniqueConstraintDialog
- *
+ * Sets up the UMLUniqueConstraintDialog.
* @param parent The parent to the UMLUniqueConstraintDialog.
* @param pUniqueConstraint The Unique Constraint to show the properties of.
*/
UMLUniqueConstraintDialog(QWidget* parent, UMLUniqueConstraint* pUniqueConstraint);
/**
- * Standard destructor
+ * Standard destructor.
*/
~UMLUniqueConstraintDialog();
-
protected:
/**
- * Sets up the dialog
- */
+ * Sets up the dialog.
+ */
void setupDialog();
/**
- * Apply Changes
+ * Apply changes.
*/
bool apply();
+
private:
-
UMLUniqueConstraint* m_pUniqueConstraint;
/**
- * The UMLDocument where all objects live
- */
+ * The UMLDocument where all objects live.
+ */
UMLDoc* m_doc;
/* GUI Widgets */
QGroupBox* m_pAttributeListGB;
QLabel* m_pNameL;
KLineEdit* m_pNameLE;
- Q3ListBox* m_pAttributeListLB;
+ QListWidget* m_pAttributeListLW;
KComboBox* m_pAttributeCB;
QPushButton* m_pAddPB,*m_pRemovePB;
@@ -95,28 +90,27 @@
public slots:
/**
- * Enable or Disable the widgets
- *
+ * Enable or Disable the widgets.
*/
void slotResetWidgetState();
/**
- * Used when the Apply Button is clicked
+ * Used when the Apply Button is clicked.
*/
void slotApply();
/**
- * Used when the OK button is clicked. Calls apply()
+ * Used when the OK button is clicked. Calls apply().
*/
void slotOk();
/**
- * adds attribute to the list
+ * Adds attribute to the list.
*/
void slotAddAttribute();
/**
- * deletes an attribute from the list
+ * Deletes an attribute from the list.
*/
void slotDeleteAttribute();
More information about the umbrello-devel
mailing list