Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
1d06110b
Commit
1d06110b
authored
Sep 10, 2012
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolved the placeholder issue in the new ubtgadaptabletext implementation
parent
47dd119c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
UBTeacherGuideWidget.cpp
src/gui/UBTeacherGuideWidget.cpp
+4
-0
UBTeacherGuideWidgetsTools.cpp
src/gui/UBTeacherGuideWidgetsTools.cpp
+14
-12
UBTeacherGuideWidgetsTools.h
src/gui/UBTeacherGuideWidgetsTools.h
+1
-2
No files found.
src/gui/UBTeacherGuideWidget.cpp
View file @
1d06110b
...
@@ -1023,14 +1023,18 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode)
...
@@ -1023,14 +1023,18 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode)
QString
inputStyleSheet
(
"QTextEdit { background: white; border-radius: 10px; border: 2px;}"
);
QString
inputStyleSheet
(
"QTextEdit { background: white; border-radius: 10px; border: 2px;}"
);
mpModePushButton
->
hide
();
mpModePushButton
->
hide
();
mpSessionTitle
->
setReadOnly
(
false
);
mpSessionTitle
->
setReadOnly
(
false
);
mpSessionTitle
->
managePlaceholder
(
false
);
mpSessionTitle
->
setStyleSheet
(
inputStyleSheet
);
mpSessionTitle
->
setStyleSheet
(
inputStyleSheet
);
QFont
titleFont
(
QApplication
::
font
().
family
(),
11
,
-
1
);
QFont
titleFont
(
QApplication
::
font
().
family
(),
11
,
-
1
);
mpSessionTitle
->
document
()
->
setDefaultFont
(
titleFont
);
mpSessionTitle
->
document
()
->
setDefaultFont
(
titleFont
);
mpAuthors
->
setReadOnly
(
false
);
mpAuthors
->
setReadOnly
(
false
);
mpAuthors
->
managePlaceholder
(
false
);
mpAuthors
->
setStyleSheet
(
inputStyleSheet
);
mpAuthors
->
setStyleSheet
(
inputStyleSheet
);
mpObjectives
->
setReadOnly
(
false
);
mpObjectives
->
setReadOnly
(
false
);
mpObjectives
->
managePlaceholder
(
false
);
mpObjectives
->
setStyleSheet
(
inputStyleSheet
);
mpObjectives
->
setStyleSheet
(
inputStyleSheet
);
mpKeywords
->
setReadOnly
(
false
);
mpKeywords
->
setReadOnly
(
false
);
mpKeywords
->
managePlaceholder
(
false
);
mpKeywords
->
setStyleSheet
(
inputStyleSheet
);
mpKeywords
->
setStyleSheet
(
inputStyleSheet
);
mpSchoolLevelValueLabel
->
hide
();
mpSchoolLevelValueLabel
->
hide
();
mpSchoolLevelBox
->
show
();
mpSchoolLevelBox
->
show
();
...
...
src/gui/UBTeacherGuideWidgetsTools.cpp
View file @
1d06110b
...
@@ -163,7 +163,7 @@ void UBTGAdaptableText::keyReleaseEvent(QKeyEvent* e)
...
@@ -163,7 +163,7 @@ void UBTGAdaptableText::keyReleaseEvent(QKeyEvent* e)
void
UBTGAdaptableText
::
showEvent
(
QShowEvent
*
e
)
void
UBTGAdaptableText
::
showEvent
(
QShowEvent
*
e
)
{
{
Q_UNUSED
(
e
);
Q_UNUSED
(
e
);
if
(
!
mIsUpdatingSize
&&
mHasPlaceHolder
&&
toPlainText
().
isEmpty
()){
if
(
!
mIsUpdatingSize
&&
mHasPlaceHolder
&&
toPlainText
().
isEmpty
()
&&
!
isReadOnly
()
){
setTextColor
(
QColor
(
Qt
::
lightGray
));
setTextColor
(
QColor
(
Qt
::
lightGray
));
setPlainText
(
mPlaceHolderText
);
setPlainText
(
mPlaceHolderText
);
}
}
...
@@ -204,8 +204,6 @@ void UBTGAdaptableText::onTextChanged()
...
@@ -204,8 +204,6 @@ void UBTGAdaptableText::onTextChanged()
setFocus
();
setFocus
();
}
}
mIsUpdatingSize
=
false
;
mIsUpdatingSize
=
false
;
}
}
void
UBTGAdaptableText
::
setInitialText
(
const
QString
&
text
)
void
UBTGAdaptableText
::
setInitialText
(
const
QString
&
text
)
...
@@ -232,22 +230,26 @@ void UBTGAdaptableText::focusInEvent(QFocusEvent* e){
...
@@ -232,22 +230,26 @@ void UBTGAdaptableText::focusInEvent(QFocusEvent* e){
if
(
isReadOnly
()){
if
(
isReadOnly
()){
e
->
ignore
();
e
->
ignore
();
}
}
managePlaceholder
();
managePlaceholder
(
true
);
QTextEdit
::
focusInEvent
(
e
);
QTextEdit
::
focusInEvent
(
e
);
}
}
void
UBTGAdaptableText
::
focusOutEvent
(
QFocusEvent
*
e
){
void
UBTGAdaptableText
::
focusOutEvent
(
QFocusEvent
*
e
){
if
(
toPlainText
().
isEmpty
()){
managePlaceholder
(
false
);
setTextColor
(
QColor
(
Qt
::
lightGray
));
setPlainText
(
mPlaceHolderText
);
}
QTextEdit
::
focusOutEvent
(
e
);
QTextEdit
::
focusOutEvent
(
e
);
}
}
void
UBTGAdaptableText
::
managePlaceholder
(){
void
UBTGAdaptableText
::
managePlaceholder
(
bool
focus
){
if
(
toPlainText
()
==
mPlaceHolderText
){
if
(
focus
){
setTextColor
(
QColor
(
Qt
::
black
));
if
(
toPlainText
()
==
mPlaceHolderText
){
setPlainText
(
""
);
setTextColor
(
QColor
(
Qt
::
black
));
setPlainText
(
""
);
}
}
else
{
if
(
toPlainText
().
isEmpty
()){
setTextColor
(
QColor
(
Qt
::
lightGray
));
setPlainText
(
mPlaceHolderText
);
}
}
}
}
}
...
...
src/gui/UBTeacherGuideWidgetsTools.h
View file @
1d06110b
...
@@ -100,6 +100,7 @@ public:
...
@@ -100,6 +100,7 @@ public:
QString
text
();
QString
text
();
void
setInitialText
(
const
QString
&
text
);
void
setInitialText
(
const
QString
&
text
);
void
setMaximumLength
(
int
length
);
void
setMaximumLength
(
int
length
);
void
managePlaceholder
(
bool
focus
);
public
slots
:
public
slots
:
void
onTextChanged
();
void
onTextChanged
();
...
@@ -111,8 +112,6 @@ protected:
...
@@ -111,8 +112,6 @@ protected:
void
focusOutEvent
(
QFocusEvent
*
e
);
void
focusOutEvent
(
QFocusEvent
*
e
);
private
:
private
:
void
managePlaceholder
();
int
mBottomMargin
;
int
mBottomMargin
;
QTreeWidgetItem
*
mpTreeWidgetItem
;
QTreeWidgetItem
*
mpTreeWidgetItem
;
int
mMinimumHeight
;
int
mMinimumHeight
;
...
...
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