m_buttonCursor->setCheckable(true);
m_buttonCursor->setShortcut(Qt::ALT + Qt::Key_S);
connect(m_buttonCursor, SIGNAL(triggered()), this, SLOT(slotSelectTool()));
+
+ m_toolbar->addSeparator();
m_buttonLoad = m_toolbar->addAction(KIcon("document-open"), i18n("Open Document"));
m_buttonLoad->setCheckable(false);
connect(m_buttonSave, SIGNAL(triggered()), this, SLOT(saveTitle()));
layout->addWidget(m_toolbar);
- text_properties->setHidden(true);
// initialize graphic scene
m_scene = new GraphicsSceneRectMove(this);
} else {
slotRectTool();
}
+
+ showToolbars(TITLE_NONE);
}
TitleWidget::~TitleWidget()
void TitleWidget::slotTextTool()
{
- rect_properties->setHidden(true);
- text_properties->setHidden(false);
m_scene->setTool(TITLE_TEXT);
+ showToolbars(TITLE_TEXT);
m_buttonRect->setChecked(false);
m_buttonCursor->setChecked(false);
}
void TitleWidget::slotRectTool()
{
- text_properties->setHidden(true);
- rect_properties->setHidden(false);
m_scene->setTool(TITLE_RECTANGLE);
+ showToolbars(TITLE_RECTANGLE);
m_buttonText->setChecked(false);
m_buttonCursor->setChecked(false);
m_buttonRect->setChecked(true);
void TitleWidget::slotSelectTool()
{
m_scene->setTool(TITLE_SELECT);
+
+ // Find out which toolbars need to be shown, depending on selected item
+ TITLETOOL t = TITLE_SELECT;
+ QList<QGraphicsItem *> l = graphicsView->scene()->selectedItems();
+ if (l.size() > 0) {
+ switch (l.at(0)->type()) {
+ case TEXTITEM:
+ t = TITLE_TEXT;
+ break;
+ case RECTITEM:
+ t = TITLE_RECTANGLE;
+ break;
+ case IMAGEITEM:
+ t = TITLE_IMAGE;
+ break;
+ }
+ }
+ enableToolbars(t);
+ showToolbars(t);
+
m_buttonCursor->setChecked(true);
m_buttonText->setChecked(false);
m_buttonRect->setChecked(false);
}
}
m_scene->setTool(TITLE_SELECT);
+ showToolbars(TITLE_SELECT);
m_buttonRect->setChecked(false);
m_buttonCursor->setChecked(true);
m_buttonText->setChecked(false);
}
+void TitleWidget::showToolbars(TITLETOOL toolType)
+{
+ bool bText = false;
+ bool bRect = false;
+ bool bNone = false;
+
+ switch (toolType) {
+ case TITLE_TEXT:
+ bText = true;
+ break;
+ case TITLE_RECTANGLE:
+ bRect = true;
+ break;
+ case TITLE_IMAGE: //fall through
+ default:
+ bNone = true;
+ break;
+ }
+ text_properties->setHidden(!bText);
+ rect_properties->setHidden(!bRect);
+ no_properties->setHidden(!bNone);
+}
+
+void TitleWidget::enableToolbars(TITLETOOL toolType)
+{
+ // TITLETOOL is defined in graphicsscenerectmove.h
+ bool bFrame = false;
+ bool bText = false;
+ bool bRect = false;
+ bool bValue_w = false;
+ bool bValue_h = false;
+
+ switch (toolType) {
+ case TITLE_SELECT:
+ break;
+ case TITLE_TEXT:
+ bFrame = true;
+ bText = true;
+ break;
+ case TITLE_RECTANGLE:
+ bFrame = true;
+ bRect = true;
+ bValue_w = true;
+ bValue_h = true;
+ break;
+ case TITLE_IMAGE:
+ bFrame = true;
+ break;
+ default:
+ break;
+ }
+ frame_properties->setEnabled(bFrame);
+ text_properties->setEnabled(bText);
+ rect_properties->setEnabled(bRect);
+ value_w->setEnabled(bValue_w);
+ value_h->setEnabled(bValue_h);
+}
+
void TitleWidget::displayBackgroundFrame()
{
if (!displayBg->isChecked()) {
origin_y_top->setChecked(false);
updateTextOriginX();
updateTextOriginY();
- frame_properties->setEnabled(false);
- text_properties->setEnabled(false);
- rect_properties->setEnabled(false);
+ enableToolbars(TITLE_NONE);
if (blockX) origin_x_left->blockSignals(false);
if (blockY) origin_y_top->blockSignals(false);
} else if (l.size() == 1) {
if (l.at(0)->type() == TEXTITEM) {
- rect_properties->setHidden(true);
- text_properties->setHidden(false);
+ showToolbars(TITLE_TEXT);
QGraphicsTextItem* i = static_cast <QGraphicsTextItem *>(l.at(0));
//if (l[0]->hasFocus())
toolBox->setCurrentIndex(0);
updateAxisButtons(i);
updateCoordinates(i);
updateDimension(i);
- //value_w->setValue((int) i->boundingRect().width());
- //value_h->setValue((int) i->boundingRect().height());
- frame_properties->setEnabled(true);
- text_properties->setEnabled(true);
- rect_properties->setEnabled(false);
- value_w->setEnabled(false);
- value_h->setEnabled(false);
+ enableToolbars(TITLE_TEXT);
} else if ((l.at(0))->type() == RECTITEM) {
- rect_properties->setHidden(false);
- text_properties->setHidden(true);
+ showToolbars(TITLE_RECTANGLE);
settingUp = true;
QGraphicsRectItem *rec = static_cast <QGraphicsRectItem *>(l.at(0));
toolBox->setCurrentIndex(0);
updateAxisButtons(l.at(0));
updateCoordinates(rec);
updateDimension(rec);
- //value_w->setValue((int) rec->rect().width());
- //value_h->setValue((int) rec->rect().height());
- frame_properties->setEnabled(true);
- text_properties->setEnabled(false);
- rect_properties->setEnabled(true);
- value_w->setEnabled(true);
- value_h->setEnabled(true);
+ enableToolbars(TITLE_RECTANGLE);
} else if (l.at(0)->type() == IMAGEITEM) {
updateCoordinates(l.at(0));
updateDimension(l.at(0));
- frame_properties->setEnabled(true);
- text_properties->setEnabled(false);
- rect_properties->setEnabled(false);
- value_x->setEnabled(true);
- value_w->setEnabled(false);
- value_h->setEnabled(false);
+ enableToolbars(TITLE_IMAGE);
} else {
//toolBox->setCurrentIndex(0);
- frame_properties->setEnabled(false);
+ enableToolbars(TITLE_NONE);
+ /*frame_properties->setEnabled(false);
text_properties->setEnabled(false);
- rect_properties->setEnabled(false);
+ rect_properties->setEnabled(false);*/
}
zValue->setValue((int)l.at(0)->zValue());
itemzoom->setValue((int)(m_transformations.value(l.at(0)).scalex * 100.0 + 0.5));
</property>
</spacer>
</item>
+ <item row="1" column="1" colspan="9">
+ <widget class="QFrame" name="no_properties">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ <italic>true</italic>
+ </font>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <property name="text">
+ <string>Item Properties</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
<item row="2" column="1" colspan="9">
<widget class="QFrame" name="rect_properties">
<property name="frameShape">
<property name="rightMargin">
<number>2</number>
</property>
- <item row="0" column="0">
+ <item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QFontComboBox" name="font_family"/>
<rect>
<x>0</x>
<y>0</y>
- <width>443</width>
- <height>143</height>
+ <width>431</width>
+ <height>140</height>
</rect>
</property>
<attribute name="label">
<rect>
<x>0</x>
<y>0</y>
- <width>96</width>
- <height>73</height>
+ <width>431</width>
+ <height>144</height>
</rect>
</property>
<attribute name="label">
<rect>
<x>0</x>
<y>0</y>
- <width>272</width>
- <height>224</height>
+ <width>416</width>
+ <height>198</height>
</rect>
</property>
<attribute name="label">