[QGIS Commit] r10790 - trunk/qgis/src/plugins/grass
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu May 14 10:11:46 EDT 2009
Author: rblazek
Date: 2009-05-14 10:11:46 -0400 (Thu, 14 May 2009)
New Revision: 10790
Modified:
trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
trunk/qgis/src/plugins/grass/qgsgrassmodule.h
Log:
more fixes for ticket #1133
Modified: trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp 2009-05-14 11:52:00 UTC (rev 10789)
+++ trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp 2009-05-14 14:11:46 UTC (rev 10790)
@@ -1660,7 +1660,7 @@
}
else
{
- QCheckBox *cb = new QCheckBox( desc, this );
+ QgsGrassModuleCheckBox *cb = new QgsGrassModuleCheckBox( desc, this );
mCheckBoxes.push_back( cb );
mLayout->addWidget( cb );
}
@@ -1944,7 +1944,7 @@
QgsGrassModuleFlag::QgsGrassModuleFlag( QgsGrassModule *module, QString key,
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode,
QWidget * parent )
- : QCheckBox( parent ), QgsGrassModuleItem( module, key, qdesc, gdesc, gnode )
+ : QgsGrassModuleCheckBox( "", parent ), QgsGrassModuleItem( module, key, qdesc, gdesc, gnode )
{
QgsDebugMsg( "called." );
@@ -1956,6 +1956,7 @@
setChecked( false );
setText( mTitle );
+ setToolTip ( mToolTip );
}
QStringList QgsGrassModuleFlag::options()
@@ -1972,18 +1973,6 @@
{
}
-void QgsGrassModuleFlag::resizeEvent ( QResizeEvent * event )
-{
- adjustText();
-}
-
-void QgsGrassModuleFlag::adjustText()
-{
- QString t = fontMetrics().elidedText ( mTitle , Qt::ElideRight, width() - iconSize().width() - 20 );
-
- setText( t );
-}
-
/************************** QgsGrassModuleInput ***************************/
QgsGrassModuleInput::QgsGrassModuleInput( QgsGrassModule *module,
@@ -2925,7 +2914,9 @@
connect( mLayerInput, SIGNAL( valueChanged() ), this, SLOT( updateSelection() ) );
}
+ QHBoxLayout *l = new QHBoxLayout( this );
mLineEdit = new QLineEdit( this );
+ l->addWidget( mLineEdit );
// Fill in layer current fields
updateSelection();
@@ -3127,3 +3118,44 @@
QgsGrassModuleFile::~QgsGrassModuleFile()
{
}
+
+/***************************** QgsGrassModuleCheckBox *********************************/
+
+QgsGrassModuleCheckBox::QgsGrassModuleCheckBox( const QString & text, QWidget * parent )
+ : QCheckBox( text, parent ), mText(text)
+{
+ QgsDebugMsg( "called." );
+ adjustText();
+}
+
+QgsGrassModuleCheckBox::~QgsGrassModuleCheckBox()
+{
+}
+
+void QgsGrassModuleCheckBox::resizeEvent ( QResizeEvent * event )
+{
+ adjustText();
+}
+void QgsGrassModuleCheckBox::setText ( const QString & text )
+{
+ mText = text;
+ adjustText();
+}
+void QgsGrassModuleCheckBox::setToolTip ( const QString & text )
+{
+ mTip = text;
+ QWidget::setToolTip ( text );
+}
+void QgsGrassModuleCheckBox::adjustText()
+{
+ QString t = fontMetrics().elidedText ( mText , Qt::ElideRight, width() - iconSize().width() - 20 );
+ QCheckBox::setText( t );
+
+ if ( mTip.isEmpty() ) {
+ QString tt;
+ if ( t != mText ) {
+ tt = mText;
+ }
+ QWidget::setToolTip ( tt );
+ }
+}
Modified: trunk/qgis/src/plugins/grass/qgsgrassmodule.h
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassmodule.h 2009-05-14 11:52:00 UTC (rev 10789)
+++ trunk/qgis/src/plugins/grass/qgsgrassmodule.h 2009-05-14 14:11:46 UTC (rev 10790)
@@ -281,6 +281,39 @@
bool mUsesRegion;
};
+/****************** QgsGrassModuleGroupBoxItem ************************/
+
+/*! \class QgsGrassModuleCheckBox
+ * \brief Checkbox with elided text
+ */
+class QgsGrassModuleCheckBox: public QCheckBox
+{
+ Q_OBJECT
+
+ public:
+ /*! \brief Constructor
+ */
+ QgsGrassModuleCheckBox( const QString & text, QWidget * parent = 0 );
+
+ //! Destructor
+ virtual ~QgsGrassModuleCheckBox ();
+
+ void resizeEvent ( QResizeEvent * event );
+
+ public slots:
+ void setText ( const QString & text );
+
+ void setToolTip ( const QString & text );
+
+ //! Adjust title size, called on resize
+ void adjustText();
+
+ private:
+ QString mText;
+
+ QString mTip;
+};
+
/*! \class QgsGrassModuleItem
* \brief GRASS module option
*/
@@ -455,7 +488,7 @@
std::vector<QString> mValues;
//! Check boxes
- std::vector<QCheckBox*> mCheckBoxes;
+ std::vector<QgsGrassModuleCheckBox*> mCheckBoxes;
//! Line
std::vector<QLineEdit*> mLineEdits;
@@ -479,7 +512,7 @@
/*! \class QgsGrassModuleFlag
* \brief GRASS flag
*/
-class QgsGrassModuleFlag: public QCheckBox, public QgsGrassModuleItem
+class QgsGrassModuleFlag: public QgsGrassModuleCheckBox, public QgsGrassModuleItem
{
Q_OBJECT
@@ -498,11 +531,6 @@
//! Retruns list of options which will be passed to module
virtual QStringList options();
- void resizeEvent ( QResizeEvent * event );
-
- public slots:
- //! Adjust title size, called on resize
- void adjustText();
};
/************************ QgsGrassModuleInput **********************/
@@ -818,4 +846,5 @@
QStringList mFilters;
};
+
#endif // QGSGRASSMODULE_H
More information about the QGIS-commit
mailing list