From 64542002d65390676b7725bdf3fa94d52c17ed7c Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 6 Jan 2012 15:19:43 +0100 Subject: [PATCH] fixed last scale issues --- src/customWidgets/UBWidgetList.cpp | 8 ++++++++ src/gui/UBMediaPlayer.cpp | 8 +++++--- src/gui/UBTeacherBarWidget.cpp | 7 +++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/customWidgets/UBWidgetList.cpp b/src/customWidgets/UBWidgetList.cpp index d73ded86..cc2ee125 100644 --- a/src/customWidgets/UBWidgetList.cpp +++ b/src/customWidgets/UBWidgetList.cpp @@ -53,6 +53,7 @@ void UBWidgetList::addWidget(QWidget *widget) if(NULL != mpLayout){ mpEmptyLabel->setVisible(false); mWidgetInfo[widget] = widget->size(); + qDebug() << __FUNCTION__ << "widget->size () " << widget->size(); updateView(size()); mpLayout->addWidget(widget); } @@ -75,6 +76,7 @@ void UBWidgetList::removeWidget(QWidget *widget) int UBWidgetList::scaleWidgets(QSize pSize) { int result = 0; + int count = 0; foreach(QWidget* eachWidget, mWidgetInfo.keys()){ qreal scaleFactor = 0; int newWidgetWidth = pSize.width(); @@ -89,6 +91,12 @@ int UBWidgetList::scaleWidgets(QSize pSize) newWidgetWidth = mWidgetInfo[eachWidget].width()/scaleFactor; result += newWidgetWidth; } + qDebug() << __PRETTY_FUNCTION__ << "widget " << &eachWidget; + qDebug() << __PRETTY_FUNCTION__ << "count " << count++; + qDebug() << __PRETTY_FUNCTION__ << "widget orignal size " << mWidgetInfo[eachWidget]; + qDebug() << __PRETTY_FUNCTION__ << "containes size " << pSize; + qDebug() << __PRETTY_FUNCTION__ << "scale factor " << scaleFactor; + qDebug() << __PRETTY_FUNCTION__ << "new height " << result; } return result; } diff --git a/src/gui/UBMediaPlayer.cpp b/src/gui/UBMediaPlayer.cpp index c68253b3..b7c13c78 100644 --- a/src/gui/UBMediaPlayer.cpp +++ b/src/gui/UBMediaPlayer.cpp @@ -100,14 +100,17 @@ UBMediaPlayer::UBMediaPlayer() : // vLayout->addWidget(info); initVideoWindow(); vLayout->addWidget(&m_videoWindow); +// m_videoWidget->setStyleSheet(QString("background:red;")); QVBoxLayout *buttonPanelLayout = new QVBoxLayout(); -// m_videoWindow.hide(); + //m_videoWindow.hide(); // buttonPanelLayout->addLayout(layout); // timeLabel = new QLabel(this); progressLabel = new QLabel(this); QWidget *sliderPanel = new QWidget(this); +// sliderPanel->setStyleSheet(QString("background:green;")); QHBoxLayout *sliderLayout = new QHBoxLayout(); +// playButton->setStyleSheet(QString("background:yellow;")); sliderLayout->addWidget(playButton); sliderLayout->addWidget(slider); // sliderLayout->addWidget(timeLabel); @@ -130,7 +133,6 @@ UBMediaPlayer::UBMediaPlayer() : vLayout->addWidget(buttonPanelWidget); QHBoxLayout *labelLayout = new QHBoxLayout(); - vLayout->addLayout(labelLayout); setLayout(vLayout); @@ -224,7 +226,7 @@ void UBMediaPlayer::initVideoWindow() videoLayout->addWidget(m_videoWidget); videoLayout->setContentsMargins(0, 0, 0, 0); m_videoWindow.setLayout(videoLayout); - m_videoWindow.setMinimumSize(100, 100); + m_videoWindow.setMinimumSize(60, 40); } void UBMediaPlayer::playPause() diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index 646b459d..188f1f0f 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -913,7 +913,7 @@ UBTeacherBarPreviewMedia::UBTeacherBarPreviewMedia(QWidget* parent, const char* mWidget = new UBWidgetList(parent); // mWidget->setEmptyText(tr("No media found")); mLayout.addWidget(mWidget); - mWidget->setStyleSheet(QString("background-color: red;")); +// mWidget->setStyleSheet(QString("background-color: red;")); setLayout(&mLayout); mWidgetList.clear(); } @@ -931,10 +931,13 @@ void UBTeacherBarPreviewMedia::cleanMedia() { foreach(QWidget* eachWidget, mWidgetList.keys()){ if(QString(eachWidget->metaObject()->className()).contains("UBDraggable")){ + mWidget->removeWidget(eachWidget); delete eachWidget; eachWidget = NULL; } - mWidget->removeWidget(eachWidget); + else{ + mWidget->removeWidget(eachWidget); + } } mWidgetList.clear(); }