Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Tobias Hunger
qt-creator
Commits
b46a0e69
Commit
b46a0e69
authored
Jul 15, 2010
by
Thomas Hartmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QmlDesigner.propertyEditor: tweak to the text pane
parent
7620746e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
src/plugins/qmldesigner/components/propertyeditor/contextpanetextwidget.cpp
...igner/components/propertyeditor/contextpanetextwidget.cpp
+31
-4
src/plugins/qmldesigner/components/propertyeditor/contextpanetextwidget.h
...esigner/components/propertyeditor/contextpanetextwidget.h
+1
-1
No files found.
src/plugins/qmldesigner/components/propertyeditor/contextpanetextwidget.cpp
View file @
b46a0e69
...
...
@@ -59,7 +59,10 @@ ContextPaneTextWidget::ContextPaneTextWidget(QWidget *parent) :
void
ContextPaneTextWidget
::
setProperties
(
QmlJS
::
PropertyReader
*
propertyReader
)
{
if
(
propertyReader
->
hasProperty
(
QLatin1String
(
"font.pointSize"
)))
{
ui
->
fontSizeSpinBox
->
setValue
(
propertyReader
->
readProperty
(
QLatin1String
(
"font.pointSize"
)).
toInt
());
QVariant
variant
=
propertyReader
->
readProperty
(
QLatin1String
(
"font.pointSize"
));
bool
b
;
ui
->
fontSizeSpinBox
->
setValue
(
variant
.
toInt
(
&
b
));
ui
->
fontSizeSpinBox
->
setEnabled
(
b
);
ui
->
fontSizeSpinBox
->
setIsPointSize
(
true
);
}
else
if
(
!
propertyReader
->
hasProperty
(
QLatin1String
(
"font.pixelSize"
)))
{
ui
->
fontSizeSpinBox
->
setValue
(
8
);
...
...
@@ -72,7 +75,11 @@ void ContextPaneTextWidget::setProperties(QmlJS::PropertyReader *propertyReader)
}
if
(
propertyReader
->
hasProperty
(
QLatin1String
(
"font.pixelSize"
)))
{
ui
->
fontSizeSpinBox
->
setValue
(
propertyReader
->
readProperty
(
QLatin1String
(
"font.pixelSize"
)).
toInt
());
QVariant
variant
=
propertyReader
->
readProperty
(
QLatin1String
(
"font.pixelSize"
));
bool
b
;
ui
->
fontSizeSpinBox
->
setValue
(
variant
.
toInt
(
&
b
));
ui
->
fontSizeSpinBox
->
setEnabled
(
b
);
ui
->
fontSizeSpinBox
->
setIsPixelSize
(
true
);
}
...
...
@@ -116,16 +123,26 @@ void ContextPaneTextWidget::setProperties(QmlJS::PropertyReader *propertyReader)
QString
familyName
=
propertyReader
->
readProperty
(
QLatin1String
(
"font.family"
)).
toString
();
QFont
font
;
font
.
setFamily
(
familyName
);
ui
->
fontComboBox
->
setCurrentFont
(
font
);
if
(
propertyReader
->
isBindingOrEnum
(
QLatin1String
(
"font.family"
)))
ui
->
fontComboBox
->
setEnabled
(
false
);
else
ui
->
fontComboBox
->
setEnabled
(
true
);
}
if
(
propertyReader
->
hasProperty
(
QLatin1String
(
"horizontalAlignment"
)))
{
QString
alignment
=
propertyReader
->
readProperty
(
QLatin1String
(
"horizontalAlignment"
)).
toString
();
ui
->
leftAlignmentButton
->
setChecked
(
true
);
ui
->
leftAlignmentButton
->
setEnabled
(
true
);
if
(
alignment
==
QLatin1String
(
"Text.AlignHCenter"
)
||
alignment
==
"AlignHCenter"
)
ui
->
centerHAlignmentButton
->
setChecked
(
true
);
else
if
(
alignment
==
QLatin1String
(
"Text.AlignRight"
)
||
alignment
==
QLatin1String
(
"AlignRight"
))
ui
->
rightAlignmentButton
->
setChecked
(
true
);
else
if
(
alignment
==
QLatin1String
(
"Text.AlignLeft"
)
||
alignment
==
QLatin1String
(
"AlignLeft"
))
ui
->
leftAlignmentButton
->
setChecked
(
true
);
else
ui
->
leftAlignmentButton
->
setEnabled
(
false
);
}
else
{
ui
->
leftAlignmentButton
->
setChecked
(
true
);
}
...
...
@@ -133,10 +150,15 @@ void ContextPaneTextWidget::setProperties(QmlJS::PropertyReader *propertyReader)
if
(
propertyReader
->
hasProperty
(
QLatin1String
(
"verticalAlignment"
)))
{
QString
alignment
=
propertyReader
->
readProperty
(
QLatin1String
(
"verticalAlignment"
)).
toString
();
ui
->
topAlignmentButton
->
setChecked
(
true
);
ui
->
bottomAlignmentButton
->
setEnabled
(
true
);
if
(
alignment
==
QLatin1String
(
"Text.AlignVCenter"
)
||
alignment
==
QLatin1String
(
"AlignVCenter"
))
ui
->
centerVAlignmentButton
->
setChecked
(
true
);
else
if
(
alignment
==
QLatin1String
(
"Text.AlignBottom"
)
||
alignment
==
QLatin1String
(
"AlignBottom"
))
ui
->
bottomAlignmentButton
->
setChecked
(
true
);
else
if
(
alignment
==
QLatin1String
(
"Text.Top"
)
||
alignment
==
QLatin1String
(
"AlignTop"
))
ui
->
topAlignmentButton
->
setChecked
(
true
);
else
ui
->
bottomAlignmentButton
->
setEnabled
(
false
);
}
else
{
ui
->
topAlignmentButton
->
setChecked
(
true
);
}
...
...
@@ -144,12 +166,17 @@ void ContextPaneTextWidget::setProperties(QmlJS::PropertyReader *propertyReader)
if
(
propertyReader
->
hasProperty
(
QLatin1String
(
"style"
)))
{
QString
style
=
propertyReader
->
readProperty
(
QLatin1String
(
"style"
)).
toString
();
ui
->
styleComboBox
->
setCurrentIndex
(
0
);
ui
->
styleComboBox
->
setEnabled
(
true
);
if
(
style
==
QLatin1String
(
"Text.Outline"
)
||
style
==
QLatin1String
(
"Outline"
))
ui
->
styleComboBox
->
setCurrentIndex
(
1
);
if
(
style
==
QLatin1String
(
"Text.Raised"
)
||
style
==
QLatin1String
(
"Raised"
))
ui
->
styleComboBox
->
setCurrentIndex
(
2
);
else
if
(
style
==
QLatin1String
(
"Text.Sunken"
)
||
style
==
QLatin1String
(
"Sunken"
))
ui
->
styleComboBox
->
setCurrentIndex
(
3
);
else
if
(
style
==
QLatin1String
(
"Text.Normal"
)
||
style
==
QLatin1String
(
"Normal"
))
ui
->
styleComboBox
->
setCurrentIndex
(
0
);
else
ui
->
styleComboBox
->
setEnabled
(
false
);
}
else
{
ui
->
styleComboBox
->
setCurrentIndex
(
0
);
}
...
...
@@ -222,9 +249,9 @@ void ContextPaneTextWidget::onFontFormatChanged()
{
int
size
=
ui
->
fontSizeSpinBox
->
value
();
if
(
ui
->
fontSizeSpinBox
->
isPointSize
())
{
emit
removeAndChangeProperty
(
QLatin1String
(
"font.pixelSize"
),
QLatin1String
(
"font.pointSize"
),
size
);
emit
removeAndChangeProperty
(
QLatin1String
(
"font.pixelSize"
),
QLatin1String
(
"font.pointSize"
),
size
,
true
);
}
else
{
emit
removeAndChangeProperty
(
QLatin1String
(
"font.pointSize"
),
QLatin1String
(
"font.pixelSize"
),
size
);
emit
removeAndChangeProperty
(
QLatin1String
(
"font.pointSize"
),
QLatin1String
(
"font.pixelSize"
),
size
,
true
);
}
}
...
...
src/plugins/qmldesigner/components/propertyeditor/contextpanetextwidget.h
View file @
b46a0e69
...
...
@@ -49,7 +49,7 @@ public slots:
signals:
void
propertyChanged
(
const
QString
&
,
const
QVariant
&
);
void
removeProperty
(
const
QString
&
);
void
removeAndChangeProperty
(
const
QString
&
,
const
QString
&
,
const
QVariant
&
);
void
removeAndChangeProperty
(
const
QString
&
,
const
QString
&
,
const
QVariant
&
,
bool
removeFirst
);
protected:
void
changeEvent
(
QEvent
*
e
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment