TitleWidget::TitleWidget (QDialog *parent):QDialog(parent){
setupUi(this);
connect (newTextButton,SIGNAL(clicked()), this, SLOT( slotNewText()));
+ connect (newRectButton,SIGNAL(clicked()), this, SLOT( slotNewRect()));
connect (kcolorbutton, SIGNAL ( clicked()), this, SLOT( slotChangeBackground()) ) ;
connect (horizontalSlider, SIGNAL ( valueChanged(int) ), this, SLOT( slotChangeBackground()) ) ;
connect (ktextedit, SIGNAL(textChanged()), this , SLOT (textChanged()));
update();
}
-void TitleWidget::slotNewText(){
+void TitleWidget::slotNewRect(){
+ QGraphicsRectItem * ri=graphicsView->scene()->addRect(-50,-50,100,100);
+ ri->setFlags(QGraphicsItem::ItemIsMovable|QGraphicsItem::ItemIsSelectable);
+
+}
+void TitleWidget::slotNewText(){
QGraphicsTextItem *tt=graphicsView->scene()->addText("Text here");
tt->setFlags(QGraphicsItem::ItemIsMovable|QGraphicsItem::ItemIsSelectable);
tt->setTextInteractionFlags (Qt::TextEditorInteraction);
kDebug() << tt->metaObject()->className();
/*QGraphicsRectItem * ri=graphicsView->scene()->addRect(-50,-50,100,100);
ri->setFlags(QGraphicsItem::ItemIsMovable|QGraphicsItem::ItemIsSelectable);*/
-
+
}
+
void TitleWidget::selectionChanged(){
QList<QGraphicsItem*> l=graphicsView->scene()->selectedItems();
if (l.size()>0){
+ kDebug() << (l[0])->type();
if ((l[0])->type()==8){
ktextedit->setHtml(((QGraphicsTextItem*)l[0])->toHtml());
toolBox->setCurrentIndex(1);
+ }else
+ if ((l[0])->type()==3){
+
+ toolBox->setCurrentIndex(2);
+ }else{
+ toolBox->setCurrentIndex(0);
}
}
}
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QVBoxLayout" >
- <item>
- <widget class="QPushButton" name="pushButton" >
- <property name="text" >
- <string>PushButton</string>
- </property>
- </widget>
- </item>
<item>
<layout class="QHBoxLayout" >
<item>
<item>
<widget class="QToolBox" name="toolBox" >
<property name="currentIndex" >
- <number>1</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="Background" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
- <width>341</width>
- <height>238</height>
+ <width>94</width>
+ <height>65</height>
</rect>
</property>
<attribute name="label" >
<rect>
<x>0</x>
<y>0</y>
- <width>341</width>
- <height>238</height>
+ <width>286</width>
+ <height>136</height>
</rect>
</property>
<attribute name="label" >
<rect>
<x>0</x>
<y>0</y>
- <width>94</width>
- <height>24</height>
+ <width>322</width>
+ <height>295</height>
</rect>
</property>
<attribute name="label" >
<string>Rectangle</string>
</attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QPushButton" name="newRectButton" >
+ <property name="text" >
+ <string>New Rect</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Foreground</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QCheckBox" name="checkBox" >
+ <property name="text" >
+ <string>show</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2" >
+ <widget class="KColorButton" name="kcolorbutton_5" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>Alpha</string>
+ </property>
+ </widget>
+ </item>
+ <item rowspan="2" row="1" column="2" >
+ <widget class="QLabel" name="label_4" >
+ <property name="text" >
+ <string>Linewidth</string>
+ </property>
+ </widget>
+ </item>
+ <item rowspan="2" row="2" column="0" colspan="2" >
+ <widget class="QSlider" name="horizontalSlider_3" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2" >
+ <widget class="QSpinBox" name="spinBox" />
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="title" >
+ <string>Background</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QCheckBox" name="checkBox_2" >
+ <property name="text" >
+ <string>show</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="KColorButton" name="kcolorbutton_6" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Alpha:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Linewidth</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QSlider" name="horizontalSlider_4" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QSpinBox" name="spinBox_2" />
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
</widget>
</item>