fixed some presentation issue on lessons page

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent db3c5284bb
commit 5aa50c52db
  1. 44
      src/gui/UBTeacherGuideWidgetsTools.cpp
  2. 1
      src/gui/UBTeacherGuideWidgetsTools.h

@ -77,8 +77,8 @@ UBTGActionWidget::UBTGActionWidget(QTreeWidgetItem* widget, QWidget* parent, con
mpTask->setAcceptRichText(true); mpTask->setAcceptRichText(true);
mpTask->setTextColor(QColor().green()); mpTask->setTextColor(QColor().green());
mpTask->setObjectName("ActionWidgetTaskTextEdit"); mpTask->setObjectName("ActionWidgetTaskTextEdit");
mpLayout->addWidget(mpOwner,0); mpLayout->addWidget(mpOwner);
mpLayout->addWidget(mpTask,1); mpLayout->addWidget(mpTask);
} }
UBTGActionWidget::~UBTGActionWidget() UBTGActionWidget::~UBTGActionWidget()
@ -88,6 +88,7 @@ UBTGActionWidget::~UBTGActionWidget()
DELETEPTR(mpLayout); DELETEPTR(mpLayout);
} }
tUBGEElementNode* UBTGActionWidget::saveData() tUBGEElementNode* UBTGActionWidget::saveData()
{ {
tUBGEElementNode* result = new tUBGEElementNode(); tUBGEElementNode* result = new tUBGEElementNode();
@ -159,6 +160,8 @@ void UBTGAdaptableText::showEvent(QShowEvent* e)
Q_UNUSED(e); Q_UNUSED(e);
if(!mIsUpdatingSize && mHasPlaceHolder && toPlainText().isEmpty()) if(!mIsUpdatingSize && mHasPlaceHolder && toPlainText().isEmpty())
setPlainText(mPlaceHolderText); setPlainText(mPlaceHolderText);
else
onTextChanged();
} }
QString UBTGAdaptableText::text() QString UBTGAdaptableText::text()
@ -184,10 +187,11 @@ void UBTGAdaptableText::onTextChanged()
setFixedHeight(documentSize+mBottomMargin); setFixedHeight(documentSize+mBottomMargin);
updateGeometry(); updateGeometry();
//to trig the widget item to resize it //to trig a resize on the tree widget item
if(mpTreeWidgetItem){ if(mpTreeWidgetItem){
mpTreeWidgetItem->setExpanded(false); mpTreeWidgetItem->setDisabled(true);
mpTreeWidgetItem->setExpanded(true); mpTreeWidgetItem->setExpanded(true);
mpTreeWidgetItem->setDisabled(false);
setFocus(); setFocus();
} }
mIsUpdatingSize = false; mIsUpdatingSize = false;
@ -196,13 +200,8 @@ void UBTGAdaptableText::onTextChanged()
void UBTGAdaptableText::showText(const QString & text) void UBTGAdaptableText::showText(const QString & text)
{ {
setText(text); setText(text);
//A first rendering has to be done to calculate the text's size.
show();
hide();
setReadOnly(true); setReadOnly(true);
onTextChanged(); onTextChanged();
if(isHidden())
show();
} }
void UBTGAdaptableText::bottomMargin(int newValue) void UBTGAdaptableText::bottomMargin(int newValue)
@ -211,11 +210,6 @@ void UBTGAdaptableText::bottomMargin(int newValue)
onTextChanged(); onTextChanged();
} }
void UBTGAdaptableText::resizeEvent(QResizeEvent* e)
{
QTextEdit::resizeEvent(e);
//QTimer::singleShot(100,this,SLOT(onTextChanged()));
}
/*************************************************************************** /***************************************************************************
* class UBTGDraggableWeb * * class UBTGDraggableWeb *
@ -284,7 +278,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const
setAcceptDrops(true); setAcceptDrops(true);
addWidget(mpDropMeWidget); addWidget(mpDropMeWidget);
setMinimumHeight(200); setMinimumHeight(250);
} }
UBTGMediaWidget::UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget, QWidget* parent,const char* name): QStackedWidget(parent) UBTGMediaWidget::UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget, QWidget* parent,const char* name): QStackedWidget(parent)
@ -303,7 +297,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget,
setObjectName(name); setObjectName(name);
setAcceptDrops(false); setAcceptDrops(false);
createWorkWidget(mRelativePath); createWorkWidget(mRelativePath);
setMinimumHeight(200); setFixedHeight(200);
} }
UBTGMediaWidget::~UBTGMediaWidget() UBTGMediaWidget::~UBTGMediaWidget()
@ -401,19 +395,20 @@ void UBTGMediaWidget::createWorkWidget(QString& path)
if(!mIsPresentationMode){ if(!mIsPresentationMode){
mpTitle = new UBTGAdaptableText(mpTreeWidgetItem,mpWorkWidget); mpTitle = new UBTGAdaptableText(mpTreeWidgetItem,mpWorkWidget);
mpTitle->setPlaceHolderText(tr("Type title here...")); mpTitle->setPlaceHolderText(tr("Type title here..."));
mpLayout->addWidget(mpTitle,1); mpLayout->addWidget(mpTitle);
} }
if(mpMediaLabelWidget){ if(mpMediaLabelWidget){
mpMediaLabelWidget->setMaximumHeight(width());
mpMediaLabelWidget->setParent(mpWorkWidget); mpMediaLabelWidget->setParent(mpWorkWidget);
mpLayout->addWidget(mpMediaLabelWidget); mpLayout->addWidget(mpMediaLabelWidget);
} }
else if (mpMediaWidget){ else if (mpMediaWidget){
mpMediaWidget->setMaximumHeight(mpTreeWidgetItem->treeWidget()->size().width()); mpMediaWidget->setMaximumHeight(width());
mpMediaWidget->setParent(mpWorkWidget); mpMediaWidget->setParent(mpWorkWidget);
mpLayout->addWidget(mpMediaWidget); mpLayout->addWidget(mpMediaWidget);
} }
else if (mpWebView){ else if (mpWebView){
mpWebView->setMaximumHeight(mpTreeWidgetItem->treeWidget()->size().width()); mpWebView->setMaximumHeight(width());
mpWebView->setParent(mpWorkWidget); mpWebView->setParent(mpWorkWidget);
mpLayout->addWidget(mpWebView); mpLayout->addWidget(mpWebView);
mpWebView->show(); mpWebView->show();
@ -421,7 +416,6 @@ void UBTGMediaWidget::createWorkWidget(QString& path)
mpWorkWidget->setLayout(mpLayout); mpWorkWidget->setLayout(mpLayout);
addWidget(mpWorkWidget); addWidget(mpWorkWidget);
setCurrentWidget(mpWorkWidget); setCurrentWidget(mpWorkWidget);
updateSize();
} }
} }
@ -469,16 +463,6 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event)
} }
} }
void UBTGMediaWidget::updateSize()
{
if(mpTreeWidgetItem){
mpTreeWidgetItem->setExpanded(false);
mpTreeWidgetItem->setExpanded(true);
if(!mIsPresentationMode)
mpTitle->setFocus();
}
}
/*************************************************************************** /***************************************************************************
* class UBTGUrlWidget * * class UBTGUrlWidget *
***************************************************************************/ ***************************************************************************/

@ -102,7 +102,6 @@ protected:
void keyPressEvent(QKeyEvent* e); void keyPressEvent(QKeyEvent* e);
void keyReleaseEvent(QKeyEvent* e); void keyReleaseEvent(QKeyEvent* e);
void showEvent(QShowEvent* e); void showEvent(QShowEvent* e);
void resizeEvent(QResizeEvent* e);
private: private:
int mBottomMargin; int mBottomMargin;

Loading…
Cancel
Save