1 #include "branchpropwindow.h"
3 #include <QColorDialog>
8 BranchPropertyWindow::BranchPropertyWindow (QWidget *parent):QDialog(parent)
15 ui.tabWidget->setEnabled(false);
17 penColor=QColor (Qt::black);
18 brushColor=QColor (Qt::black);
21 ui.framePenColorButton->setPixmap (pix);
22 ui.frameBrushColorButton->setPixmap (pix);
25 ui.framePenColorButton, SIGNAL (clicked()),
26 this, SLOT (framePenColorClicked()));
28 ui.frameBrushColorButton, SIGNAL (clicked()),
29 this, SLOT (frameBrushColorClicked()));
31 ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)),
32 this, SLOT (frameTypeChanged (int)));
34 ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)),
35 this, SLOT (linkHideUnselectedChanged (int)));
38 void BranchPropertyWindow::setBranch (BranchObj *bo)
43 ui.tabWidget->setEnabled (true);
46 FrameType t=branch->getFrameType();
49 ui.frameTypeCombo->setCurrentIndex (0);
52 ui.colorGroupBox->setEnabled (false);
55 penColor=bo->getFramePenColor();
56 brushColor=bo->getFrameBrushColor();
59 ui.frameBrushColorButton->setPixmap (pix);
60 pix.fill (brushColor);
61 ui.frameBrushColorButton->setPixmap (pix);
62 ui.colorGroupBox->setEnabled (true);
67 ui.frameTypeCombo->setCurrentIndex (1);
70 ui.frameTypeCombo->setCurrentIndex (2);
78 if (branch->getHideLinkUnselected())
79 ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
81 ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
84 ui.tabWidget->setEnabled (false);
88 void BranchPropertyWindow::setMapEditor (MapEditor *me)
92 setBranch (mapEditor->getSelectedBranch() );
94 ui.tabWidget->setEnabled (false);
98 void BranchPropertyWindow::frameTypeChanged (int i)
103 case 0: mapEditor->setFrameType (NoFrame); break;
104 case 1: mapEditor->setFrameType (Rectangle); break;
105 case 2: mapEditor->setFrameType (Ellipse); break;
109 void BranchPropertyWindow::framePenColorClicked()
113 QColor col = QColorDialog::getColor( penColor, this );
117 mapEditor->setFramePenColor (penColor);
122 void BranchPropertyWindow::frameBrushColorClicked()
126 QColor col = QColorDialog::getColor( brushColor, this );
130 mapEditor->setFrameBrushColor (brushColor);
135 void BranchPropertyWindow::linkHideUnselectedChanged (int i)
138 branch->setHideLinkUnselected(i);