[QGIS Commit] r8551 - in trunk/qgis/src: app ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri May 30 11:53:14 EDT 2008
Author: timlinux
Date: 2008-05-30 11:53:14 -0400 (Fri, 30 May 2008)
New Revision: 8551
Modified:
trunk/qgis/src/app/qgsgeomtypedialog.cpp
trunk/qgis/src/ui/qgsgeomtypedialogbase.ui
Log:
Use button box for cross platform consistency
Modified: trunk/qgis/src/app/qgsgeomtypedialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsgeomtypedialog.cpp 2008-05-30 15:51:24 UTC (rev 8550)
+++ trunk/qgis/src/app/qgsgeomtypedialog.cpp 2008-05-30 15:53:14 UTC (rev 8551)
@@ -17,14 +17,19 @@
/* $Id$ */
#include "qgsgeomtypedialog.h"
-#include "qgsaddattrdialog.h"
+#include "qgsapplication.h"
+#include <QPushButton>
QgsGeomTypeDialog::QgsGeomTypeDialog(QWidget *parent, Qt::WFlags fl)
: QDialog(parent, fl)
{
setupUi(this);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ QString myThemePath = QgsApplication::themePath();
+ mAddAttributeButton->setIcon(QIcon(QPixmap(myThemePath + "/mActionNewAttribute.png")));
+ mRemoveAttributeButton->setIcon(QIcon(QPixmap(myThemePath + "/mActionDeleteAttribute.png")));
+ mTypeBox->addItem(tr("Real"),"Real");
+ mTypeBox->addItem(tr("Integer"),"Integer");;
+ mTypeBox->addItem(tr("String"),"String");
mPointRadioButton->setChecked(true);
mFileFormatComboBox->insertItem("ESRI Shapefile");
@@ -58,19 +63,15 @@
void QgsGeomTypeDialog::on_mAddAttributeButton_clicked()
{
- std::list<QString> types;
- types.push_back("Real");
- types.push_back("Integer");
- types.push_back("String");
- QgsAddAttrDialog d(types, this);
- if(d.exec()==QDialog::Accepted)
- {
- mAttributeView->addTopLevelItem(new QTreeWidgetItem(QStringList() << d.name() << d.type()));
- }
+ QString myName = mNameEdit->text();
+ //use userrole to avoid translated type string
+ QString myType = mTypeBox->itemData ( mTypeBox->currentIndex(),Qt::UserRole ).toString();
+ mAttributeView->addTopLevelItem(new QTreeWidgetItem( QStringList() << myName << myType ));
if(mAttributeView->topLevelItemCount()>0)
{
mOkButton->setEnabled(true);
}
+ mNameEdit->clear();
}
void QgsGeomTypeDialog::on_mRemoveAttributeButton_clicked()
Modified: trunk/qgis/src/ui/qgsgeomtypedialogbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsgeomtypedialogbase.ui 2008-05-30 15:51:24 UTC (rev 8550)
+++ trunk/qgis/src/ui/qgsgeomtypedialogbase.ui 2008-05-30 15:53:14 UTC (rev 8551)
@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>400</width>
- <height>427</height>
+ <width>395</width>
+ <height>422</height>
</rect>
</property>
<property name="windowTitle" >
@@ -16,7 +16,7 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" >
- <item row="1" column="0" colspan="2" >
+ <item row="0" column="0" >
<widget class="QLabel" name="mFileFormatLabel" >
<property name="text" >
<string>File format</string>
@@ -26,50 +26,10 @@
</property>
</widget>
</item>
- <item row="1" column="2" colspan="2" >
+ <item row="0" column="1" colspan="3" >
<widget class="QComboBox" name="mFileFormatComboBox" />
</item>
- <item row="3" column="1" colspan="2" >
- <widget class="QPushButton" name="mRemoveAttributeButton" >
- <property name="text" >
- <string>Remove</string>
- </property>
- </widget>
- </item>
- <item row="3" column="3" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>91</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0" colspan="3" >
- <widget class="QLabel" name="mAttributeLabel" >
- <property name="text" >
- <string>Attributes</string>
- </property>
- <property name="buddy" >
- <cstring>mAddAttributeButton</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QPushButton" name="mAddAttributeButton" >
- <property name="text" >
- <string>Add</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" colspan="4" >
+ <item row="1" column="0" colspan="4" >
<widget class="QGroupBox" name="buttonGroup1" >
<property name="title" >
<string>Type</string>
@@ -99,8 +59,89 @@
</layout>
</widget>
</item>
- <item row="4" column="0" colspan="4" >
+ <item row="2" column="0" colspan="4" >
+ <widget class="QLabel" name="mAttributeLabel" >
+ <property name="text" >
+ <string>Attributes</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="textLabel1" >
+ <property name="text" >
+ <string>Name</string>
+ </property>
+ <property name="buddy" >
+ <cstring>mNameEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="3" >
+ <widget class="QLineEdit" name="mNameEdit" />
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="textLabel2" >
+ <property name="text" >
+ <string>Type</string>
+ </property>
+ <property name="buddy" >
+ <cstring>mTypeBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" colspan="3" >
+ <widget class="QComboBox" name="mTypeBox" />
+ </item>
+ <item row="5" column="0" colspan="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>291</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="2" >
+ <widget class="QToolButton" name="mRemoveAttributeButton" >
+ <property name="toolTip" >
+ <string>Remove selected row</string>
+ </property>
+ <property name="text" >
+ <string>...</string>
+ </property>
+ <property name="icon" >
+ <iconset>../../images/themes/default/mActionDeleteAttribute.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="3" >
+ <widget class="QToolButton" name="mAddAttributeButton" >
+ <property name="toolTip" >
+ <string>Add values manually</string>
+ </property>
+ <property name="text" >
+ <string>...</string>
+ </property>
+ <property name="icon" >
+ <iconset>../../images/themes/default/mActionNewAttribute.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" colspan="4" >
<widget class="QTreeWidget" name="mAttributeView" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
<property name="rootIsDecorated" >
<bool>false</bool>
</property>
@@ -116,7 +157,7 @@
</column>
</widget>
</item>
- <item row="5" column="0" colspan="4" >
+ <item row="7" column="0" colspan="4" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
@@ -130,13 +171,50 @@
</widget>
<layoutdefault spacing="6" margin="11" />
<tabstops>
+ <tabstop>mFileFormatComboBox</tabstop>
<tabstop>mPointRadioButton</tabstop>
<tabstop>mLineRadioButton</tabstop>
<tabstop>mPolygonRadioButton</tabstop>
- <tabstop>mFileFormatComboBox</tabstop>
+ <tabstop>mNameEdit</tabstop>
+ <tabstop>mTypeBox</tabstop>
+ <tabstop>mRemoveAttributeButton</tabstop>
<tabstop>mAddAttributeButton</tabstop>
- <tabstop>mRemoveAttributeButton</tabstop>
+ <tabstop>mAttributeView</tabstop>
+ <tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>QgsGeomTypeDialogBase</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>349</x>
+ <y>400</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>387</x>
+ <y>304</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>QgsGeomTypeDialogBase</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>275</x>
+ <y>400</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>242</x>
+ <y>308</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
More information about the QGIS-commit
mailing list