From 5d0464ea80bf601dcd34adca3c38dc5e94daa7ab Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 23 Aug 2012 14:13:45 +0200 Subject: [PATCH] fixed issue of widget that doesn't follow the scroll area on the presentation widget --- src/board/UBBoardController.cpp | 6 +----- src/gui/UBTeacherGuideWidget.cpp | 12 ++++++++++++ src/gui/UBTeacherGuideWidget.h | 6 ++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 1fe4b154..2ef4cedf 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -955,8 +955,6 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri { QString mimeType = pContentTypeHeader; - qDebug() << sourceUrl.toString(); - // In some cases "image/jpeg;charset=" is retourned by the drag-n-drop. That is // why we will check if an ; exists and take the first part (the standard allows this kind of mimetype) if(mimeType.isEmpty()) @@ -985,7 +983,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri QPixmap pix; if(pData.length() == 0){ - pix.load(sourceUrl.toString()); + pix.load(sourceUrl.toLocalFile()); } else{ QImage img; @@ -993,8 +991,6 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri pix = QPixmap::fromImage(img); } - - UBGraphicsPixmapItem* pixItem = mActiveScene->addPixmap(pix, NULL, pPos, 1.); pixItem->setSourceUrl(sourceUrl); diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 5322919a..666c64e0 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -468,6 +468,10 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare mpTreeWidget->setIconSize(QSize(24,24)); connect(mpTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(onAddItemClicked(QTreeWidgetItem*,int))); connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); +#ifdef Q_WS_MAC + // on mac and with the custom qt the widget on the tree are not automatically relocated when using the vertical scrollbar. To relocate them we link the valueChange signal of the vertical scrollbar witht a local signal to trig a change and a repaint of the tree widget + connect(mpTreeWidget->verticalScrollBar(),SIGNAL(valueChanged(int)),this,SLOT(onSliderMoved(int))); +#endif } UBTeacherGuidePresentationWidget::~UBTeacherGuidePresentationWidget() @@ -484,6 +488,14 @@ UBTeacherGuidePresentationWidget::~UBTeacherGuidePresentationWidget() DELETEPTR(mpLayout); } +#ifdef Q_WS_MAC +void UBTeacherGuidePresentationWidget::onSliderMoved(int size) +{ + Q_UNUSED(size); + mpMediaSwitchItem->setExpanded(true); +} +#endif + bool UBTeacherGuidePresentationWidget::eventFilter(QObject* object, QEvent* event) { Q_UNUSED(object); diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 775728e5..1d165f13 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -114,6 +114,12 @@ private: QTreeWidgetItem* mpRootWidgetItem; QTreeWidgetItem* mpMediaSwitchItem; + +#ifdef Q_WS_MACX +private slots: + void onSliderMoved(int size); +#endif + }; /***************************************************************************