mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Double clicking an attribute item adds it to assigned items
This commit is contained in:
parent
ba0bed00fa
commit
6cd3d77762
@ -343,6 +343,23 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( int inde
|
||||
mScaleDependencyLabel->hide();
|
||||
}
|
||||
}
|
||||
void QgsDiagramProperties::addAttribute( QTreeWidgetItem * item )
|
||||
{
|
||||
QTreeWidgetItem *newItem = new QTreeWidgetItem( mDiagramAttributesTreeWidget );
|
||||
|
||||
newItem->setText( 0, item->text( 0 ) );
|
||||
newItem->setData( 0, Qt::UserRole, item->data( 0, Qt::UserRole ) );
|
||||
newItem->setFlags( newItem->flags() & ~Qt::ItemIsDropEnabled );
|
||||
|
||||
//set initial color for diagram category
|
||||
int red = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
|
||||
int green = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
|
||||
int blue = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
|
||||
QColor randomColor( red, green, blue );
|
||||
newItem->setBackground( 1, QBrush( randomColor ) );
|
||||
mDiagramAttributesTreeWidget->addTopLevelItem( newItem );
|
||||
}
|
||||
|
||||
|
||||
void QgsDiagramProperties::on_mTransparencySlider_valueChanged( int value )
|
||||
{
|
||||
@ -353,22 +370,14 @@ void QgsDiagramProperties::on_mAddCategoryPushButton_clicked()
|
||||
{
|
||||
foreach ( QTreeWidgetItem *attributeItem, mAttributesTreeWidget->selectedItems() )
|
||||
{
|
||||
QTreeWidgetItem *newItem = new QTreeWidgetItem( mDiagramAttributesTreeWidget );
|
||||
|
||||
newItem->setText( 0, attributeItem->text( 0 ) );
|
||||
newItem->setData( 0, Qt::UserRole, attributeItem->data( 0, Qt::UserRole ) );
|
||||
newItem->setFlags( newItem->flags() & ~Qt::ItemIsDropEnabled );
|
||||
|
||||
//set initial color for diagram category
|
||||
int red = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
|
||||
int green = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
|
||||
int blue = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
|
||||
QColor randomColor( red, green, blue );
|
||||
newItem->setBackground( 1, QBrush( randomColor ) );
|
||||
mDiagramAttributesTreeWidget->addTopLevelItem( newItem );
|
||||
addAttribute( attributeItem );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsDiagramProperties::on_mAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem * item, int column )
|
||||
{
|
||||
addAttribute( item );
|
||||
}
|
||||
|
||||
void QgsDiagramProperties::on_mRemoveCategoryPushButton_clicked()
|
||||
{
|
||||
|
@ -29,14 +29,15 @@ class QgsDiagramProperties : public QWidget, private Ui::QgsDiagramPropertiesBas
|
||||
|
||||
public:
|
||||
QgsDiagramProperties( QgsVectorLayer* layer, QWidget* parent );
|
||||
|
||||
//void handleAttributeDoubleClicked( QTreeWidgetItem * item, int column );
|
||||
/**Adds an attribute from the list of available attributes to the assigned attributes with a random color.*/
|
||||
void addAttribute( QTreeWidgetItem * item );
|
||||
|
||||
public slots:
|
||||
void apply();
|
||||
void on_mDiagramTypeComboBox_currentIndexChanged( int index );
|
||||
void on_mTransparencySlider_valueChanged( int value );
|
||||
void on_mAddCategoryPushButton_clicked();
|
||||
void on_mAttributesTreeWidget_itemDoubleClicked( QTreeWidgetItem * item, int column );
|
||||
void on_mBackgroundColorButton_clicked();
|
||||
void on_mFindMaximumValueButton_clicked();
|
||||
void on_mDiagramPenColorButton_clicked();
|
||||
|
Loading…
x
Reference in New Issue
Block a user