Added the Links widgets

preferencesAboutTextFull
shibakaneki 13 years ago
parent 9b47022783
commit 80e9b93ae6
  1. 48
      src/gui/UBTeacherBarWidget.cpp
  2. 15
      src/gui/UBTeacherBarWidget.h

@ -47,6 +47,8 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
setObjectName(name); setObjectName(name);
mName = "TeacherBarWidget"; mName = "TeacherBarWidget";
mVisibleState = true; mVisibleState = true;
mActionList.clear();
mUrlList.clear();
setAttribute(Qt::WA_StyledBackground, true); setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet()); setStyleSheet(UBApplication::globalStyleSheet());
@ -284,7 +286,9 @@ void UBTeacherBarWidget::onActionButton()
void UBTeacherBarWidget::onLinkButton() void UBTeacherBarWidget::onLinkButton()
{ {
UBUrlWidget* pUrl = new UBUrlWidget(this);
mUrlList << pUrl;
mpLinks->addWidget(pUrl);
} }
UBTeacherStudentAction::UBTeacherStudentAction(QWidget *parent, const char *name):QWidget(parent) UBTeacherStudentAction::UBTeacherStudentAction(QWidget *parent, const char *name):QWidget(parent)
@ -437,3 +441,45 @@ void UBTeacherBarDropMediaZone::dragMoveEvent(QDragMoveEvent *pEvent)
{ {
pEvent->acceptProposedAction(); pEvent->acceptProposedAction();
} }
// ---------------------------------------------------------------------------------------------
UBUrlWidget::UBUrlWidget(QWidget *parent, const char *name):QWidget(parent)
, mpLayout(NULL)
, mpUrlLabel(NULL)
, mpUrl(NULL)
{
setObjectName(name);
mpLayout = new QHBoxLayout(this);
setLayout(mpLayout);
mpUrlLabel = new QLabel(tr("Url"), this);
mpLayout->addWidget(mpUrlLabel, 0);
mpUrl = new QLineEdit(this);
mpLayout->addWidget(mpUrl, 1);
}
UBUrlWidget::~UBUrlWidget()
{
if(NULL != mpUrlLabel){
delete mpUrlLabel;
mpUrlLabel = NULL;
}
if(NULL != mpUrl){
delete mpUrl;
mpUrl = NULL;
}
if(NULL != mpLayout){
delete mpLayout;
mpLayout = NULL;
}
}
QString UBUrlWidget::url()
{
QString str;
if(NULL != mpUrl){
str = mpUrl->text();
}
return str;
}

@ -59,6 +59,20 @@ protected:
void dragLeaveEvent(QDragLeaveEvent* pEvent); void dragLeaveEvent(QDragLeaveEvent* pEvent);
}; };
class UBUrlWidget : public QWidget
{
public:
UBUrlWidget(QWidget* parent=0, const char* name="UBUrlWidget");
~UBUrlWidget();
QString url();
private:
QHBoxLayout* mpLayout;
QLabel* mpUrlLabel;
QLineEdit* mpUrl;
};
class UBTeacherBarWidget : public UBDockPaletteWidget class UBTeacherBarWidget : public UBDockPaletteWidget
{ {
Q_OBJECT Q_OBJECT
@ -102,6 +116,7 @@ private:
QTextEdit* mpComments; QTextEdit* mpComments;
QVector<UBTeacherStudentAction*> mActionList; QVector<UBTeacherStudentAction*> mActionList;
QVector<UBUrlWidget*> mUrlList;
}; };
#endif // UBTEACHERBARWIDGET_H #endif // UBTEACHERBARWIDGET_H

Loading…
Cancel
Save