#include <CurveCreator_ICurve.hxx>
#include <CurveCreator_Utils.hxx>
#include <HYDROGUI_CurveCreatorProfile.h>
+#include <HYDROData_Tool.h>
#include <CurveCreator_Displayer.hxx>
#include <OCCViewer_ViewPort3d.h>
#include <QListWidget>
#include <QPushButton>
#include <SUIT_MessageBox.h>
+#include <QColorDialog>
const QString splitter_key = "HYDROGUI_ProfileDlg::splitter";
myProfileNames = new QListWidget(this);
myProfileNames->setSelectionMode(QAbstractItemView::SingleSelection);
name_layout->addWidget(myProfileNames);
+
+ QVBoxLayout* btn_layout = new QVBoxLayout( name_frame );
+ btn_layout->setAlignment(Qt::AlignTop);
+
myAddProfBtn = new QPushButton(tr("ADD_PROFILES"), this);
myRemProfBtn = new QPushButton(tr("REMOVE_PROFILE"), this);
- name_layout->addWidget(myAddProfBtn);
- name_layout->addWidget(myRemProfBtn);
+ mySetColorProfBtn = new QPushButton(tr("SETCOLOR_PROFILE"), this);
+ btn_layout->addWidget(myAddProfBtn);
+ btn_layout->addWidget(myRemProfBtn);
+ btn_layout->addWidget(mySetColorProfBtn);
+
+ name_layout->addLayout(btn_layout);
+
}
insertWidget( name_frame, 0, 0 );
int anActionFlags =
CurveCreator_Widget::DisableNewSection | CurveCreator_Widget::DisableDetectionMode |
- CurveCreator_Widget::DisableClosedSection;
+ CurveCreator_Widget::DisableClosedSection | CurveCreator_Widget::DisableSetColor;
QStringList aCoordTitles;
aCoordTitles << tr( "U_TITLE" ) << tr( "Z_TITLE" );
myEditorWidget = new CurveCreator_Widget( this, NULL, anActionFlags, aCoordTitles );
connect( myProfileNames, SIGNAL( itemChanged(QListWidgetItem*)), this, SLOT( onProfileNameChanged(QListWidgetItem*)));
connect( myAddProfBtn, SIGNAL( clicked(bool)), this, SLOT( onAddBtnPressed(bool)));
connect( myRemProfBtn, SIGNAL( clicked(bool)), this, SLOT( onRemoveBtnPressed(bool)));
+ connect( mySetColorProfBtn, SIGNAL( clicked(bool)), this, SLOT( onSetColorBtnPressed(bool)));
}
myAddElementBox->hide();
emit RemoveProfile(theIndex);
}
+void HYDROGUI_ProfileDlg::onSetColorBtnPressed(bool)
+{
+ int theIndex = GetProfileSelectionIndex();
+ if (theIndex < 0)
+ return;
+
+ HYDROGUI_CurveCreatorProfile* aCurve = (*myProfilesPointer)[theIndex];
+
+ QColor aCurrentColor = HYDROData_Tool::toQtColor(/*aCurve->myCurveColor*/aCurve->getColorSection(0));
+ QColor newQCurCol = QColorDialog::getColor( aCurrentColor, this );
+ if( !newQCurCol.isValid() )
+ return;
+
+ Quantity_Color newOCCCol = HYDROData_Tool::toOccColor(newQCurCol);
+ aCurve->setColorSectionInternal(0, newOCCCol);
+ Handle(AIS_InteractiveObject) anAISObject = aCurve->getAISObject();
+ if (anAISObject)
+ {
+ //color points of shape in the same color as edges
+ Handle(Prs3d_PointAspect) anAspect = anAISObject->Attributes()->PointAspect();
+ anAspect->SetColor(newOCCCol);
+ anAISObject->Attributes()->SetPointAspect( anAspect );
+ }
+
+ QListWidgetItem* item = myProfileNames->item(theIndex);
+ QPixmap SPixmap(16, 16);
+ SPixmap.fill(newQCurCol);
+ QIcon SIcon(SPixmap);
+ item->setIcon( SIcon );
+
+ if( myProfilesPointer &&
+ myProfilesPointer->size()>0 &&
+ myProfilesPointer->at(0) &&
+ myProfilesPointer->at(0)->getDisplayer() )
+ myProfilesPointer->at(0)->getDisplayer()->Update();
+}
+
void HYDROGUI_ProfileDlg::onProfileNameChanged(QListWidgetItem* item)
{
int ind = GetProfileSelectionIndex();